diff --git a/SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C b/SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C index d949c54..f22297b 100644 --- a/SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C +++ b/SpiralSound/Plugins/DiskWriterPlugin/DiskWriterPlugin.C @@ -14,21 +14,18 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ +*/ +// is this still relevant // for lrintf() #define _ISOC9X_SOURCE 1 #define _ISOC99_SOURCE 1 -#include - -#include -#include -#include -#include -#include -#include -#include +//#include +//#include +//#include +//#include +//#include #include "DiskWriterPlugin.h" #include "DiskWriterPluginGUI.h" #include @@ -46,25 +43,15 @@ using namespace std; extern "C" { -SpiralPlugin* SpiralPlugin_CreateInstance() -{ - return new DiskWriterPlugin; -} -char** SpiralPlugin_GetIcon() -{ - return SpiralIcon_xpm; -} +SpiralPlugin* SpiralPlugin_CreateInstance() { return new DiskWriterPlugin; } -int SpiralPlugin_GetID() -{ - return 41; -} +char** SpiralPlugin_GetIcon() { return SpiralIcon_xpm; } + +int SpiralPlugin_GetID() { return 41; } + +string SpiralPlugin_GetGroupName() { return "InputOutput"; } -string SpiralPlugin_GetGroupName() -{ - return "InputOutput"; -} } /////////////////////////////////////////////////////// @@ -101,17 +88,12 @@ DiskWriterPlugin::~DiskWriterPlugin() PluginInfo &DiskWriterPlugin::Initialise(const HostInfo *Host) { PluginInfo& Info= SpiralPlugin::Initialise(Host); - //host=Host; return Info; } SpiralGUIType *DiskWriterPlugin::CreateGUI() { - return new DiskWriterPluginGUI(m_PluginInfo.Width, - m_PluginInfo.Height, - this, - m_AudioCH, - m_HostInfo); + return new DiskWriterPluginGUI(m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); } void DiskWriterPlugin::Execute() @@ -157,26 +139,26 @@ void DiskWriterPlugin::ExecuteCommands() } } -void DiskWriterPlugin::StreamOut (ostream &s) +void DiskWriterPlugin::StreamOut (ostream &s) { s << m_Version << " " << m_GUIArgs.BitsPerSample << " " << m_GUIArgs.Stereo << " "; } -void DiskWriterPlugin::StreamIn (istream &s) +void DiskWriterPlugin::StreamIn (istream &s) { char Test; int Version, BitsPerSample, Stereo; - - //originally DiskWriter had NO streaming code whatsover + + // originally DiskWriter had NO streaming code whatsover // so to test if this is an old patch we must // read ahead and find out what the first char // of the next line is - - s.seekg (2, ios_base::cur );//skip to next line - Test = s.peek();//peek first char - s.seekg (-2, ios_base::cur );//jump back to prior line - - //This test works because if the char + + s.seekg (2, ios::cur ); //skip to next line + Test = s.peek(); //peek first char + s.seekg (-2, ios::cur ); //jump back to prior line + + // This test works because if the char // of the next line isn't a version number // it will only be 'D', ' ', #13, or '-' if ( (Test >= '0') && (Test <= '9') ) @@ -188,7 +170,7 @@ void DiskWriterPlugin::StreamIn (istream &s) //No Version, so use Version 1 Version = 1; } - + switch (Version) { case 2: @@ -198,7 +180,7 @@ void DiskWriterPlugin::StreamIn (istream &s) m_GUIArgs.Stereo = Stereo; } break; - + case 1: { //use original fixed defaults @@ -206,5 +188,5 @@ void DiskWriterPlugin::StreamIn (istream &s) m_GUIArgs.Stereo = true; } break; - } + } } diff --git a/SpiralSound/Plugins/JackPlugin/JackPlugin.C b/SpiralSound/Plugins/JackPlugin/JackPlugin.C index 53d6dce..6a1547e 100644 --- a/SpiralSound/Plugins/JackPlugin/JackPlugin.C +++ b/SpiralSound/Plugins/JackPlugin/JackPlugin.C @@ -622,9 +622,9 @@ void JackPlugin::StreamIn (istream &s) char Test; int Version, NumInputs, NumOutputs; - s.seekg (2, ios_base::cur );//skip to next line - Test = s.peek();//peek first char - s.seekg (-2, ios_base::cur );//jump back to prior line + s.seekg (2, ios::cur ); //skip to next line + Test = s.peek(); //peek first char + s.seekg (-2, ios::cur ); //jump back to prior line if ( (Test >= '0') && (Test <= '9') ) { diff --git a/SpiralSound/Plugins/MeterPlugin/MeterPlugin.C b/SpiralSound/Plugins/MeterPlugin/MeterPlugin.C index 501e3b7..1b88424 100644 --- a/SpiralSound/Plugins/MeterPlugin/MeterPlugin.C +++ b/SpiralSound/Plugins/MeterPlugin/MeterPlugin.C @@ -45,7 +45,6 @@ m_VUMode (true) m_PluginInfo.NumOutputs = 1; m_PluginInfo.PortTips.push_back ("Input"); m_PluginInfo.PortTips.push_back ("Output"); - m_Version = 1; } @@ -68,8 +67,8 @@ void MeterPlugin::Execute() { // Just copy the data through. if (GetOutputBuf (0)) GetOutputBuf (0)->Zero(); if (GetInput (0)) { - GetOutputBuf (0)->Mix (*GetInput(0), 0); - memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); + GetOutputBuf (0)->Mix (*GetInput(0), 0); + memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); } } diff --git a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C index 7317d32..b08d2bd 100644 --- a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C +++ b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C @@ -21,13 +21,16 @@ using namespace std; -char label_buf[10]; +char label_buf[65]; + +MeterPluginGUI::~MeterPluginGUI () { + delete m_Data; +} MeterPluginGUI::MeterPluginGUI (int w, int h, MeterPlugin *o, ChannelHandler *ch, const HostInfo *Info) : SpiralPluginGUI (w, h, o, ch), m_Bypass (false) { - // If I'm only going to use the first value from this, is it worth doing all this m_BufSize = Info->BUFSIZE; m_Data = new float[m_BufSize]; // Create the widgets and stuff! @@ -90,18 +93,21 @@ m_Bypass (false) void MeterPluginGUI::draw() { SpiralGUIType::draw (); if (! m_Bypass) { + float datum = 0.0; m_GUICH->GetData ("AudioData", m_Data); // The min and max values are based on the whole buffer for (int c=0; cvalue ()) m_Data[c] = fabs (m_Data[c]); - if (m_Data[c] < m_Min) m_Min=m_Data[c]; - if (m_Data[c] > m_Max) m_Max=m_Data[c]; + datum = m_Data[c]; + if (VUMode->value ()) datum = fabs (datum); + if (datum < m_Min) m_Min = datum; + if (datum > m_Max) m_Max = datum; } SetMinMax (m_Min, m_Max); - // The meter displays the first datum in the buffer (it's a quick average) - Meter->value (*m_Data); + // The meter displays the last datum we touched (it's a quick average) + Meter->value (datum); Meter->redraw(); - snprintf (label_buf, 64, "%1.5f", *m_Data); + // Yeuck - have I REALLY used stdio for that - this is supposed to be C++ + //snprintf (label_buf, 64, "%1.5f", *m_Data); char* c = label_buf; for (int display=0; display<8; display++) { Digits[display] -> dp (off); diff --git a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.h b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.h index 1b09653..4736431 100644 --- a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.h +++ b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.h @@ -19,6 +19,7 @@ #ifndef METERGUI #define METERGUI +#include #include #include "../Widgets/Fl_VU_Meter.h" #include "../Widgets/Fl_SevenSeg.H" @@ -30,6 +31,7 @@ class MeterPluginGUI : public SpiralPluginGUI { public: MeterPluginGUI (int w, int h, MeterPlugin *o, ChannelHandler *ch, const HostInfo *Info); + ~MeterPluginGUI (); virtual void UpdateValues (SpiralPlugin* o); virtual void Update (); virtual void draw (); diff --git a/SpiralSound/Plugins/ScopePlugin/ScopePlugin.C b/SpiralSound/Plugins/ScopePlugin/ScopePlugin.C index 9a7325c..e17f602 100644 --- a/SpiralSound/Plugins/ScopePlugin/ScopePlugin.C +++ b/SpiralSound/Plugins/ScopePlugin/ScopePlugin.C @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ +*/ #include "ScopePlugin.h" #include "ScopePluginGUI.h" #include @@ -24,25 +24,13 @@ using namespace std; extern "C" { -SpiralPlugin* SpiralPlugin_CreateInstance() -{ - return new ScopePlugin; -} +SpiralPlugin* SpiralPlugin_CreateInstance() { return new ScopePlugin; } -char** SpiralPlugin_GetIcon() -{ - return SpiralIcon_xpm; -} +char** SpiralPlugin_GetIcon() { return SpiralIcon_xpm; } -int SpiralPlugin_GetID() -{ - return 0x0001; -} +int SpiralPlugin_GetID() { return 0x0001; } -string SpiralPlugin_GetGroupName() -{ - return "Control"; -} +string SpiralPlugin_GetGroupName() { return "Control"; } } /////////////////////////////////////////////////////// @@ -50,9 +38,7 @@ string SpiralPlugin_GetGroupName() ScopePlugin::ScopePlugin() { m_PluginInfo.Name="Scope"; - //m_PluginInfo.Width=220; m_PluginInfo.Width=260; - //m_PluginInfo.Height=125; m_PluginInfo.Height=115; m_PluginInfo.NumInputs=1; m_PluginInfo.NumOutputs=1; @@ -65,8 +51,8 @@ ScopePlugin::~ScopePlugin() } PluginInfo &ScopePlugin::Initialise(const HostInfo *Host) -{ - PluginInfo& Info = SpiralPlugin::Initialise(Host); +{ + PluginInfo& Info = SpiralPlugin::Initialise(Host); m_Data = new float[Host->BUFSIZE]; m_AudioCH->RegisterData("AudioData",ChannelHandler::OUTPUT,m_Data,Host->BUFSIZE*sizeof(float)); return Info; @@ -74,22 +60,15 @@ PluginInfo &ScopePlugin::Initialise(const HostInfo *Host) SpiralGUIType *ScopePlugin::CreateGUI() { - return new ScopePluginGUI(m_PluginInfo.Width, - m_PluginInfo.Height, - this, - m_AudioCH, - m_HostInfo); + return new ScopePluginGUI(m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); } -void ScopePlugin::Execute() -{ - // Just copy the data through. - if (GetOutputBuf(0)) GetOutputBuf(0)->Zero(); - if (GetInput(0)) GetOutputBuf(0)->Mix(*GetInput(0),0); - - if (GetInput(0)) - { - //cerr<<1<<" "<BUFSIZE<GetBuffer(),m_HostInfo->BUFSIZE*sizeof(float)); - } +void ScopePlugin::Execute() { + // Just copy the data through. + if (GetOutputBuf (0)) GetOutputBuf (0)->Zero(); + if (GetInput (0)) { + GetOutputBuf (0)->Mix (*GetInput(0), 0); + memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); + } } + diff --git a/SpiralSound/Plugins/SpiralPluginGUI.C b/SpiralSound/Plugins/SpiralPluginGUI.C index a37a893..9ea0343 100644 --- a/SpiralSound/Plugins/SpiralPluginGUI.C +++ b/SpiralSound/Plugins/SpiralPluginGUI.C @@ -60,7 +60,7 @@ SpiralGUIType(0,0,w,h,"") SpiralPluginGUI::~SpiralPluginGUI() { // Needed to properly remove the window. - Fl::check(); + Fl::check(); } void SpiralPluginGUI::Resize (int neww, int newh) { diff --git a/SpiralSynthModular.C b/SpiralSynthModular.C index ec0d256..7968ed0 100644 --- a/SpiralSynthModular.C +++ b/SpiralSynthModular.C @@ -201,31 +201,34 @@ void SynthModular::UpdatePluginGUIs() if (i->second->m_DeviceGUI->Killed()) { - PauseAudio(); + PauseAudio(); - //Hide Device GUI FIRST + // Hide Device GUI FIRST if (i->second->m_DeviceGUI->GetPluginWindow()) { i->second->m_DeviceGUI->GetPluginWindow()->hide(); } - //Clear and remove Device GUI from canvas + // Clear and remove Device GUI from canvas i->second->m_DeviceGUI->Clear(); m_Canvas->RemoveDevice(i->second->m_DeviceGUI); - - //Delete Device GUI - must delete here or sometimes plugin will randomly crash + + // Delete Device GUI - must delete here or sometimes plugin will randomly crash + // SOMETIMES AT THIS POINT THE WHOLE THING JUST LOCKS UP + // In the previous version of this code this next line was commented out + // with the comment "deleted by Canvas::Remove()? seems to cause random crashes" delete i->second->m_DeviceGUI; - //Delete Device Sometimes deleting audio before GUI causes an odd crash, so do it afterword + // Delete Device Sometimes deleting audio before GUI causes an odd crash, so do it afterword if (i->second->m_Device) { delete i->second->m_Device; i->second->m_Device=NULL; } - //Erase Device from DeviceWinMap + // Erase Device from DeviceWinMap m_DeviceWinMap.erase(i); - + ResumeAudio(); break; } diff --git a/SpiralSynthModular.h b/SpiralSynthModular.h index 740d1ac..f433341 100644 --- a/SpiralSynthModular.h +++ b/SpiralSynthModular.h @@ -40,7 +40,7 @@ #include "SpiralSound/ChannelHandler.h" #include "SettingsWindow.h" -const static string VER_STRING = "0.2.2rc1"; +const static string VER_STRING = "0.2.2rc2"; typedef Fl_Double_Window SpiralWindowType; // typedef Fl_Window SpiralWindowType;