Browse Source

Just a little tidy of the DiskWriter code

master
edgeeffect 21 years ago
parent
commit
7121d518b7
2 changed files with 27 additions and 29 deletions
  1. +21
    -22
      SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C
  2. +6
    -7
      SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.h

+ 21
- 22
SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C View File

@@ -36,14 +36,13 @@

using namespace std;

static const HostInfo* host;

// what's this for - should it still be here?
#define CHECK_AND_REPORT_ERROR if (result<0) \
{ \
perror("Sound device did not accept settings"); \
m_OutputOk=false; \
return false; \
}
{ \
perror("Sound device did not accept settings"); \
m_OutputOk=false; \
return false; \
}

extern "C"
{
@@ -53,7 +52,7 @@ SpiralPlugin* SpiralPlugin_CreateInstance()
}

char** SpiralPlugin_GetIcon()
{
{
return SpiralIcon_xpm;
}

@@ -71,7 +70,7 @@ string SpiralPlugin_GetGroupName()
///////////////////////////////////////////////////////

DiskWriterPlugin::DiskWriterPlugin()
{
{
m_PluginInfo.Name="DiskWriter";
m_PluginInfo.Width=160;
m_PluginInfo.Height=115;
@@ -85,7 +84,7 @@ DiskWriterPlugin::DiskWriterPlugin()
m_GUIArgs.Stereo = true;
m_GUIArgs.Recording = false;
m_GUIArgs.TimeRecorded = 0;
m_AudioCH->RegisterData("Filename",ChannelHandler::INPUT,m_GUIArgs.Name,256);
m_AudioCH->Register("BitsPerSample",&m_GUIArgs.BitsPerSample,ChannelHandler::INPUT);
m_AudioCH->Register("Stereo",&m_GUIArgs.Stereo,ChannelHandler::INPUT);
@@ -94,13 +93,13 @@ DiskWriterPlugin::DiskWriterPlugin()
}

DiskWriterPlugin::~DiskWriterPlugin()
{
{
}

PluginInfo &DiskWriterPlugin::Initialise(const HostInfo *Host)
{
{
PluginInfo& Info= SpiralPlugin::Initialise(Host);
host=Host;
//host=Host;
return Info;
}

@@ -114,20 +113,20 @@ SpiralGUIType *DiskWriterPlugin::CreateGUI()
}

void DiskWriterPlugin::Execute()
{
if(m_GUIArgs.Recording && m_Wav.IsOpen())
{
{
if(m_GUIArgs.Recording && m_Wav.IsOpen())
{
int on=0;
float LeftBuffer[host->BUFSIZE], RightBuffer[host->BUFSIZE];
for (int n=0; n<host->BUFSIZE; n++)
float LeftBuffer[GetHostInfo()->BUFSIZE], RightBuffer[GetHostInfo()->BUFSIZE];
for (int n=0; n<GetHostInfo()->BUFSIZE; n++)
{
// stereo channels - interleave
// stereo channels - interleave
LeftBuffer[n]=GetInput(0,n);
RightBuffer[n]=GetInput(1,n);
}
m_Wav.Save(LeftBuffer, RightBuffer, host->BUFSIZE);
m_Wav.Save(LeftBuffer, RightBuffer, GetHostInfo()->BUFSIZE);
m_GUIArgs.TimeRecorded = m_Wav.GetSize()/m_Wav.GetSamplerate();
}
}


+ 6
- 7
SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.h View File

@@ -16,13 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef DiskWriterPLUGIN
#define DiskWriterPLUGIN

#include "../SpiralPlugin.h"
#include "../../RiffWav.h"
#include <FL/Fl_Pixmap.H>

#ifndef OscillatorPLUGIN
#define OscillatorPLUGIN

class DiskWriterPlugin : public SpiralPlugin
{
public:
@@ -35,7 +35,7 @@ public:
virtual void ExecuteCommands();
virtual void StreamOut(std::ostream &s) {}
virtual void StreamIn(std::istream &s) {}
enum GUICommands {NONE,OPENWAV,CLOSEWAV,RECORD,STOP};
struct GUIArgs
{
@@ -43,10 +43,9 @@ public:
int BitsPerSample;
bool Stereo;
bool Recording;

float TimeRecorded;
float TimeRecorded;
};
private:
GUIArgs m_GUIArgs;
WavFile m_Wav;


Loading…
Cancel
Save