at any given point, so that changes to the audio subsystems can be applied live(needed for jack). this is also usefull in that it can give the ability for a Reset button on the toolbar along side a play/pause button for being able to at any point completely kill audio and reset to begining(usefull for recording takes where you want it to start at specific point w/out the delays echos etc overlapping for the first iteration.master
@@ -214,6 +214,20 @@ void ChannelHandler::GetData(const string &ID, void *data) | |||||
pthread_mutex_unlock(m_Mutex); | pthread_mutex_unlock(m_Mutex); | ||||
} | } | ||||
void ChannelHandler::UpdateDataSize(const std::string &ID, int size) | |||||
{ | |||||
map<string,Channel*>::iterator i=m_ChannelMap.find(ID); | |||||
if (i==m_ChannelMap.end()) | |||||
{ | |||||
cerr<<"ChannelHandler: Channel ["<<ID<<"] does not exist"<<endl; | |||||
return; | |||||
} | |||||
pthread_mutex_lock(m_Mutex); | |||||
i->second->size = size; | |||||
pthread_mutex_unlock(m_Mutex); | |||||
} | |||||
void ChannelHandler::SetData(const string &ID, void *s) | void ChannelHandler::SetData(const string &ID, void *s) | ||||
{ | { | ||||
map<string,Channel*>::iterator i=m_ChannelMap.find(ID); | map<string,Channel*>::iterator i=m_ChannelMap.find(ID); | ||||
@@ -79,6 +79,8 @@ public: | |||||
void Set(const std::string &ID, const float& s) { SetData(ID,(void*)&s); } | void Set(const std::string &ID, const float& s) { SetData(ID,(void*)&s); } | ||||
void Set(const std::string &ID, const double& s) { SetData(ID,(void*)&s); } | void Set(const std::string &ID, const double& s) { SetData(ID,(void*)&s); } | ||||
void UpdateDataSize(const std::string &ID, int size); | |||||
void SetCommand(char command); | void SetCommand(char command); | ||||
// initialises the data from the audio side to the internal buffers | // initialises the data from the audio side to the internal buffers | ||||
@@ -87,6 +87,13 @@ SpiralGUIType *AnotherFilterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void AnotherFilterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
vibrapos = 0.0f; | |||||
vibraspeed = 0.0f; | |||||
} | |||||
void AnotherFilterPlugin::Execute() | void AnotherFilterPlugin::Execute() | ||||
{ | { | ||||
float in; | float in; | ||||
@@ -34,6 +34,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -41,8 +43,6 @@ public: | |||||
float GetResonance() { return Resonance; } | float GetResonance() { return Resonance; } | ||||
void Randomise(); | void Randomise(); | ||||
void Clear(); | |||||
private: | private: | ||||
float Cutoff, Resonance; | float Cutoff, Resonance; | ||||
@@ -82,6 +82,16 @@ SpiralGUIType *BeatMatchPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void BeatMatchPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Triggered = false; | |||||
m_EstimatedDuration = 100; | |||||
m_BeatTime = 100; | |||||
m_NextBeat = 100; | |||||
m_OutputLevel = 1.0f; | |||||
} | |||||
void BeatMatchPlugin::Execute() | void BeatMatchPlugin::Execute() | ||||
{ | { | ||||
for (int n=0; n<m_HostInfo->BUFSIZE; n++) | for (int n=0; n<m_HostInfo->BUFSIZE; n++) | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -80,6 +80,15 @@ SpiralGUIType *CounterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void CounterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Current = 0; | |||||
m_Triggered = false; | |||||
m_CurrentLevel = 1.0f; | |||||
} | |||||
void CounterPlugin::Execute() | void CounterPlugin::Execute() | ||||
{ | { | ||||
bool Triggered; | bool Triggered; | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -85,6 +85,15 @@ SpiralGUIType *DelayPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void DelayPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Buffer.Clear(); | |||||
m_Buffer.Allocate((int)(m_HostInfo->SAMPLERATE*MAX_DELAY)); | |||||
m_ReadHeadPos = 0; | |||||
m_WriteHeadPos = 0; | |||||
} | |||||
void DelayPlugin::Execute () { | void DelayPlugin::Execute () { | ||||
int Delay; | int Delay; | ||||
float max_pos = MAX_DELAY * m_HostInfo->SAMPLERATE; | float max_pos = MAX_DELAY * m_HostInfo->SAMPLERATE; | ||||
@@ -31,6 +31,7 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -122,6 +122,15 @@ SpiralGUIType *DistributorPlugin::CreateGUI() | |||||
return new DistributorPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | return new DistributorPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | ||||
} | } | ||||
void DistributorPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Triggered = false; | |||||
m_ChannelSelect = false; | |||||
m_TrigDelay = 0; | |||||
} | |||||
void DistributorPlugin::Execute() { | void DistributorPlugin::Execute() { | ||||
const int Stream = 0; | const int Stream = 0; | ||||
const int Switch = 1; | const int Switch = 1; | ||||
@@ -31,6 +31,7 @@ public: | |||||
virtual SpiralGUIType* CreateGUI (); | virtual SpiralGUIType* CreateGUI (); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
@@ -89,6 +89,20 @@ SpiralGUIType *EchoPlugin::CreateGUI() | |||||
return new EchoPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | return new EchoPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | ||||
} | } | ||||
void EchoPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Buffer[0].Clear(); | |||||
m_Buffer[0].Allocate ((int)(m_HostInfo->SAMPLERATE * MAX_DELAY)); | |||||
m_Buffer[1].Clear(); | |||||
m_Buffer[1].Allocate ((int)(m_HostInfo->SAMPLERATE * MAX_DELAY)); | |||||
m_HeadPos = 0; | |||||
m_Buf0 = 0; | |||||
m_Buf1 = 1; | |||||
} | |||||
void EchoPlugin::Execute() | void EchoPlugin::Execute() | ||||
{ | { | ||||
float Delay; | float Delay; | ||||
@@ -30,6 +30,8 @@ class EchoPlugin : public SpiralPlugin | |||||
virtual PluginInfo &Initialise (const HostInfo *Host); | virtual PluginInfo &Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
float GetDelay() { return m_Delay; } | float GetDelay() { return m_Delay; } | ||||
@@ -79,6 +79,12 @@ SpiralGUIType *EnvFollowerPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void EnvFollowerPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Value = 0; | |||||
} | |||||
void EnvFollowerPlugin::Execute() | void EnvFollowerPlugin::Execute() | ||||
{ | { | ||||
float Value; | float Value; | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -85,6 +85,14 @@ PluginInfo &EnvelopePlugin::Initialise(const HostInfo *Host) | |||||
return Info; | return Info; | ||||
} | } | ||||
void EnvelopePlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_SampleTime=1.0/(float)(m_HostInfo->SAMPLERATE); | |||||
m_Trigger = false; | |||||
m_t = -1.0f; | |||||
} | |||||
SpiralGUIType *EnvelopePlugin::CreateGUI() | SpiralGUIType *EnvelopePlugin::CreateGUI() | ||||
{ | { | ||||
return new EnvelopePluginGUI(m_PluginInfo.Width, | return new EnvelopePluginGUI(m_PluginInfo.Width, | ||||
@@ -33,6 +33,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -110,6 +110,14 @@ SpiralGUIType *FilterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void FilterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
fs=m_HostInfo->SAMPLERATE; | |||||
SetupCoeffs(); | |||||
} | |||||
void FilterPlugin::Execute() | void FilterPlugin::Execute() | ||||
{ | { | ||||
float Cutoff; | float Cutoff; | ||||
@@ -37,7 +37,7 @@ public: | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
void Reset(); | |||||
virtual void Reset(); | |||||
void SetupCoeffs(); | void SetupCoeffs(); | ||||
double GetCutoff() {return fc;} | double GetCutoff() {return fc;} | ||||
@@ -84,6 +84,15 @@ SpiralGUIType *FlipflopPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void FlipflopPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Current = 0; | |||||
m_Triggered = false; | |||||
m_CurrentLevel = 1.0f; | |||||
m_TriggerSamples = 0; | |||||
} | |||||
void FlipflopPlugin::Execute() | void FlipflopPlugin::Execute() | ||||
{ | { | ||||
bool Triggered; | bool Triggered; | ||||
@@ -31,6 +31,7 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -82,13 +82,7 @@ string SpiralPlugin_GetGroupName() | |||||
FormantFilterPlugin::FormantFilterPlugin() : | FormantFilterPlugin::FormantFilterPlugin() : | ||||
m_Vowel(0) | m_Vowel(0) | ||||
{ | { | ||||
for (int i = 0; i < 5; i++) | |||||
{ | |||||
for (int j = 0; j < 10; j++) | |||||
{ | |||||
memory[i][j] = 0; | |||||
} | |||||
} | |||||
Clear(); | |||||
m_PluginInfo.Name="FormantFilter"; | m_PluginInfo.Name="FormantFilter"; | ||||
m_PluginInfo.Width=90; | m_PluginInfo.Width=90; | ||||
@@ -118,6 +112,13 @@ SpiralGUIType *FormantFilterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void FormantFilterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
Clear(); | |||||
} | |||||
void FormantFilterPlugin::Execute() | void FormantFilterPlugin::Execute() | ||||
{ | { | ||||
float res,o[5],out=0, in=0; | float res,o[5],out=0, in=0; | ||||
@@ -127,13 +128,7 @@ void FormantFilterPlugin::Execute() | |||||
//reset memory if disconnected, and skip out (prevents CPU spike) | //reset memory if disconnected, and skip out (prevents CPU spike) | ||||
if (! InputExists(0)) | if (! InputExists(0)) | ||||
{ | { | ||||
for (int i = 0; i < 5; i++) | |||||
{ | |||||
for (int j = 0; j < 10; j++) | |||||
{ | |||||
memory[i][j] = 0; | |||||
} | |||||
} | |||||
Clear(); | |||||
out = 0; | out = 0; | ||||
} | } | ||||
else | else | ||||
@@ -214,6 +209,18 @@ void FormantFilterPlugin::Execute() | |||||
void FormantFilterPlugin::Randomise() | void FormantFilterPlugin::Randomise() | ||||
{ | { | ||||
} | } | ||||
void FormantFilterPlugin::Clear() | |||||
{ | |||||
for (int i = 0; i < 5; i++) | |||||
{ | |||||
for (int j = 0; j < 10; j++) | |||||
{ | |||||
memory[i][j] = 0; | |||||
} | |||||
} | |||||
} | |||||
void FormantFilterPlugin::StreamOut(ostream &s) | void FormantFilterPlugin::StreamOut(ostream &s) | ||||
{ | { | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -68,6 +68,7 @@ LADSPAPlugin::LADSPAPlugin() | |||||
} | } | ||||
m_PlugDesc = NULL; | m_PlugDesc = NULL; | ||||
m_SSMPluginReset = false; | |||||
ClearPlugin(); | ClearPlugin(); | ||||
@@ -150,6 +151,15 @@ SpiralGUIType *LADSPAPlugin::CreateGUI() | |||||
this, m_AudioCH, m_HostInfo, m_LADSPAInfo->GetMenuList()); | this, m_AudioCH, m_HostInfo, m_LADSPAInfo->GetMenuList()); | ||||
} | } | ||||
void LADSPAPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_SSMPluginReset = true; | |||||
UpdatePlugin(m_UniqueID); | |||||
m_SSMPluginReset = false; | |||||
} | |||||
void LADSPAPlugin::Execute() | void LADSPAPlugin::Execute() | ||||
{ | { | ||||
if (m_PlugDesc) | if (m_PlugDesc) | ||||
@@ -857,6 +867,7 @@ bool LADSPAPlugin::UpdatePlugin(unsigned long UniqueID) | |||||
} | } | ||||
// Oops. Clean up. | // Oops. Clean up. | ||||
m_SSMPluginReset = false; | |||||
ClearPlugin(); | ClearPlugin(); | ||||
cerr << "Error loading LADSPA Plugin.\n"; | cerr << "Error loading LADSPA Plugin.\n"; | ||||
@@ -880,13 +891,14 @@ bool LADSPAPlugin::SelectPlugin(unsigned long UniqueID) | |||||
} | } | ||||
// Find number of input and output ports | // Find number of input and output ports | ||||
for (unsigned long i = 0; i < m_PlugDesc->PortCount; i++) { | |||||
if (LADSPA_IS_PORT_INPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
m_PluginInfo.NumInputs++; | |||||
} else if (LADSPA_IS_PORT_OUTPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
m_PluginInfo.NumOutputs++; | |||||
if (! m_SSMPluginReset) | |||||
for (unsigned long i = 0; i < m_PlugDesc->PortCount; i++) { | |||||
if (LADSPA_IS_PORT_INPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
m_PluginInfo.NumInputs++; | |||||
} else if (LADSPA_IS_PORT_OUTPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
m_PluginInfo.NumOutputs++; | |||||
} | |||||
} | } | ||||
} | |||||
///////////////////////////////// | ///////////////////////////////// | ||||
// LADSPA Buffers | // LADSPA Buffers | ||||
@@ -899,7 +911,7 @@ bool LADSPAPlugin::SelectPlugin(unsigned long UniqueID) | |||||
LADSPA_Data *NewPort = new LADSPA_Data[m_HostInfo->BUFSIZE]; | LADSPA_Data *NewPort = new LADSPA_Data[m_HostInfo->BUFSIZE]; | ||||
m_LADSPABufVec.push_back(NewPort); | m_LADSPABufVec.push_back(NewPort); | ||||
m_PlugDesc->connect_port(m_PlugInstHandle, n, m_LADSPABufVec[c]); | m_PlugDesc->connect_port(m_PlugInstHandle, n, m_LADSPABufVec[c]); | ||||
m_PortID.push_back(n); | |||||
m_PortID.push_back(n); | |||||
c++; | c++; | ||||
} | } | ||||
} | } | ||||
@@ -924,53 +936,59 @@ bool LADSPAPlugin::SelectPlugin(unsigned long UniqueID) | |||||
// SSM Buffers | // SSM Buffers | ||||
// Allocate the i/o buffers required | // Allocate the i/o buffers required | ||||
for (int n=0; n<m_PluginInfo.NumInputs; n++) AddInput(); | |||||
for (int n=0; n<m_PluginInfo.NumOutputs; n++) AddOutput(); | |||||
if (! m_SSMPluginReset) | |||||
{ | |||||
for (int n=0; n<m_PluginInfo.NumInputs; n++) AddInput(); | |||||
for (int n=0; n<m_PluginInfo.NumOutputs; n++) AddOutput(); | |||||
} | |||||
////////////////////////////// | ////////////////////////////// | ||||
// Update the GUI stuff | // Update the GUI stuff | ||||
string desc; | |||||
c=0; | |||||
for (unsigned int i = 0; i < m_PlugDesc->PortCount; i++) | |||||
if (! m_SSMPluginReset) | |||||
{ | { | ||||
if (LADSPA_IS_PORT_INPUT(m_PlugDesc->PortDescriptors[i])) | |||||
string desc; | |||||
c=0; | |||||
for (unsigned int i = 0; i < m_PlugDesc->PortCount; i++) | |||||
{ | { | ||||
desc = string(m_PlugDesc->PortNames[i]) + | |||||
(LADSPA_IS_PORT_CONTROL(m_PlugDesc->PortDescriptors[i]) ? " (CV)" : " (AU)"); | |||||
m_PluginInfo.PortTips.push_back(desc.c_str()); | |||||
c++; | |||||
if (LADSPA_IS_PORT_INPUT(m_PlugDesc->PortDescriptors[i])) | |||||
{ | |||||
desc = string(m_PlugDesc->PortNames[i]) + | |||||
(LADSPA_IS_PORT_CONTROL(m_PlugDesc->PortDescriptors[i]) ? " (CV)" : " (AU)"); | |||||
m_PluginInfo.PortTips.push_back(desc.c_str()); | |||||
c++; | |||||
} | |||||
} | } | ||||
} | |||||
for (unsigned int i = 0; i < m_PlugDesc->PortCount; i++) | |||||
{ | |||||
if (LADSPA_IS_PORT_OUTPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
desc = string(m_PlugDesc->PortNames[i]) + | |||||
(LADSPA_IS_PORT_CONTROL(m_PlugDesc->PortDescriptors[i]) ? " (CV)" : " (AU)"); | |||||
m_PluginInfo.PortTips.push_back(desc.c_str()); | |||||
for (unsigned int i = 0; i < m_PlugDesc->PortCount; i++) | |||||
{ | |||||
if (LADSPA_IS_PORT_OUTPUT(m_PlugDesc->PortDescriptors[i])) { | |||||
desc = string(m_PlugDesc->PortNames[i]) + | |||||
(LADSPA_IS_PORT_CONTROL(m_PlugDesc->PortDescriptors[i]) ? " (CV)" : " (AU)"); | |||||
m_PluginInfo.PortTips.push_back(desc.c_str()); | |||||
} | |||||
} | } | ||||
} | |||||
UpdatePluginInfoWithHost(); | |||||
UpdatePluginInfoWithHost(); | |||||
m_UniqueID = m_PlugDesc->UniqueID; | |||||
m_UniqueID = m_PlugDesc->UniqueID; | |||||
m_InputPortCount = m_PluginInfo.NumInputs; | |||||
m_InputPortCount = m_PluginInfo.NumInputs; | |||||
int lbl_length; | |||||
int lbl_length; | |||||
lbl_length = strlen(m_PlugDesc->Name); | |||||
lbl_length = lbl_length > 255 ? 255 : lbl_length; | |||||
strncpy(m_Name, m_PlugDesc->Name, lbl_length); | |||||
m_Name[lbl_length] = '\0'; | |||||
lbl_length = strlen(m_PlugDesc->Name); | |||||
lbl_length = lbl_length > 255 ? 255 : lbl_length; | |||||
strncpy(m_Name, m_PlugDesc->Name, lbl_length); | |||||
m_Name[lbl_length] = '\0'; | |||||
lbl_length = strlen(m_PlugDesc->Maker); | |||||
lbl_length = lbl_length > 255 ? 255 : lbl_length; | |||||
strncpy(m_Maker, m_PlugDesc->Maker, lbl_length); | |||||
m_Maker[lbl_length] = '\0'; | |||||
lbl_length = strlen(m_PlugDesc->Maker); | |||||
lbl_length = lbl_length > 255 ? 255 : lbl_length; | |||||
strncpy(m_Maker, m_PlugDesc->Maker, lbl_length); | |||||
m_Maker[lbl_length] = '\0'; | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
@@ -988,14 +1006,17 @@ void LADSPAPlugin::ClearPlugin(void) | |||||
m_LADSPAInfo->DiscardDescriptorByID(m_UniqueID); | m_LADSPAInfo->DiscardDescriptorByID(m_UniqueID); | ||||
} | } | ||||
m_Page = 1; | |||||
m_UpdateInputs = true; | |||||
m_UniqueID = 0; | |||||
m_InputPortCount = 0; | |||||
m_UnconnectedInputs = 0; | |||||
strncpy(m_Name, "None\0", 5); | |||||
strncpy(m_Maker, "None\0", 5); | |||||
if (! m_SSMPluginReset) | |||||
{ | |||||
m_Page = 1; | |||||
m_UpdateInputs = true; | |||||
m_UniqueID = 0; | |||||
m_InputPortCount = 0; | |||||
m_UnconnectedInputs = 0; | |||||
strncpy(m_Name, "None\0", 5); | |||||
strncpy(m_Maker, "None\0", 5); | |||||
} | |||||
for(vector<LADSPA_Data*>::iterator i=m_LADSPABufVec.begin(); | for(vector<LADSPA_Data*>::iterator i=m_LADSPABufVec.begin(); | ||||
i!=m_LADSPABufVec.end(); i++) | i!=m_LADSPABufVec.end(); i++) | ||||
{ | { | ||||
@@ -1003,18 +1024,25 @@ void LADSPAPlugin::ClearPlugin(void) | |||||
} | } | ||||
m_LADSPABufVec.clear(); | m_LADSPABufVec.clear(); | ||||
RemoveAllInputs(); | |||||
RemoveAllOutputs(); | |||||
m_PluginInfo.NumInputs = 0; | |||||
m_PluginInfo.NumOutputs = 0; | |||||
m_PluginInfo.PortTips.clear(); | |||||
if (! m_SSMPluginReset) | |||||
{ | |||||
RemoveAllInputs(); | |||||
RemoveAllOutputs(); | |||||
m_PluginInfo.NumInputs = 0; | |||||
m_PluginInfo.NumOutputs = 0; | |||||
m_PluginInfo.PortTips.clear(); | |||||
} | |||||
m_PortID.clear(); | m_PortID.clear(); | ||||
m_InputPortMin.clear(); | m_InputPortMin.clear(); | ||||
m_InputPortMax.clear(); | m_InputPortMax.clear(); | ||||
m_InputPortClamp.clear(); | m_InputPortClamp.clear(); | ||||
m_InputPortDefault.clear(); | |||||
if (! m_SSMPluginReset) | |||||
{ | |||||
m_InputPortDefault.clear(); | |||||
} | |||||
} | } | ||||
void LADSPAPlugin::ResetPortSettings(void) | void LADSPAPlugin::ResetPortSettings(void) | ||||
@@ -1125,7 +1153,11 @@ void LADSPAPlugin::ResetPortSettings(void) | |||||
m_InputPortMin.push_back(Min); | m_InputPortMin.push_back(Min); | ||||
m_InputPortMax.push_back(Max); | m_InputPortMax.push_back(Max); | ||||
m_InputPortClamp.push_back(true); | m_InputPortClamp.push_back(true); | ||||
m_InputPortDefault.push_back(Default); | |||||
if (! m_SSMPluginReset) | |||||
{ | |||||
m_InputPortDefault.push_back(Default); | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -52,6 +52,7 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -100,10 +101,12 @@ private: | |||||
void ResetPortSettings(void); | void ResetPortSettings(void); | ||||
void SetGUIExports(void); | void SetGUIExports(void); | ||||
bool m_SSMPluginReset; | |||||
const LADSPA_Descriptor *m_PlugDesc; | const LADSPA_Descriptor *m_PlugDesc; | ||||
std::vector<LADSPA_Data*> m_LADSPABufVec; | std::vector<LADSPA_Data*> m_LADSPABufVec; | ||||
LADSPA_Handle m_PlugInstHandle; | LADSPA_Handle m_PlugInstHandle; | ||||
std::vector<int> m_PortID; | std::vector<int> m_PortID; | ||||
std::vector<float> m_InputPortMin; | std::vector<float> m_InputPortMin; | ||||
std::vector<float> m_InputPortMax; | std::vector<float> m_InputPortMax; | ||||
@@ -102,6 +102,16 @@ float LFOPlugin::AdjustPos (float pos) { | |||||
return pos; | return pos; | ||||
} | } | ||||
void LFOPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
for (int n=0; n<NUM_TABLES; n++) | |||||
m_Table[n].Allocate (m_TableLength); | |||||
WriteWaves(); | |||||
m_CyclePos = 0; | |||||
m_Note = 0; | |||||
} | |||||
void LFOPlugin::Execute() { | void LFOPlugin::Execute() { | ||||
float Incr, Pos; | float Incr, Pos; | ||||
for (int n=0; n<m_HostInfo->BUFSIZE; n++) { | for (int n=0; n<m_HostInfo->BUFSIZE; n++) { | ||||
@@ -32,6 +32,8 @@ class LFOPlugin : public SpiralPlugin { | |||||
virtual PluginInfo &Initialise (const HostInfo *Host); | virtual PluginInfo &Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
//typedef char Type; | //typedef char Type; | ||||
@@ -106,6 +106,14 @@ void MixPitch(Sample &src, Sample &dst, int Pos, float Pitch) | |||||
} | } | ||||
} | } | ||||
void MasherPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_ReadGrain = 0; | |||||
m_WriteGrain = 0; | |||||
} | |||||
void MasherPlugin::Execute() | void MasherPlugin::Execute() | ||||
{ | { | ||||
GetOutputBuf(0)->Zero(); | GetOutputBuf(0)->Zero(); | ||||
@@ -33,6 +33,7 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -154,6 +154,25 @@ SpiralGUIType *MatrixPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void MatrixPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Current = 0; | |||||
m_GUICurrent = 0; | |||||
m_Time = 0.0f; | |||||
m_Step = 0; | |||||
m_TickTime = 1.0f/(float)m_HostInfo->SAMPLERATE; | |||||
m_StepTime = 1.0f; | |||||
m_CurPatSeq = 0; | |||||
m_CurrentNoteCV = 0; | |||||
m_CurrentTriggerCV = 0; | |||||
m_Triggered = false; | |||||
m_ClockHigh = false; | |||||
m_CopyPattern = 0; | |||||
m_PatAdvance = false; | |||||
m_PatReset = false; | |||||
} | |||||
void MatrixPlugin::Execute() | void MatrixPlugin::Execute() | ||||
{ | { | ||||
for (int n=0; n<m_HostInfo->BUFSIZE; n++) | for (int n=0; n<m_HostInfo->BUFSIZE; n++) | ||||
@@ -45,6 +45,7 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -65,6 +65,15 @@ SpiralGUIType *MeterPlugin::CreateGUI() { | |||||
return new MeterPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | return new MeterPluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | ||||
} | } | ||||
void MeterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_DataReady = false; | |||||
delete m_Data; | |||||
m_Data = new float[m_HostInfo->BUFSIZE]; | |||||
m_AudioCH->UpdateDataSize ("AudioData", m_HostInfo->BUFSIZE * sizeof (float)); | |||||
} | |||||
void MeterPlugin::Execute() { | void MeterPlugin::Execute() { | ||||
// Just copy the data through. | // Just copy the data through. | ||||
m_DataReady = InputExists (0); | m_DataReady = InputExists (0); | ||||
@@ -28,6 +28,7 @@ class MeterPlugin : public SpiralPlugin { | |||||
virtual PluginInfo& Initialise (const HostInfo *Host); | virtual PluginInfo& Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
@@ -77,7 +77,6 @@ void MixSwitchPlugin::ExecuteCommands () { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
void MixSwitchPlugin::CreatePorts (int n, bool AddPorts) { | void MixSwitchPlugin::CreatePorts (int n, bool AddPorts) { | ||||
int c; | int c; | ||||
m_PluginInfo.NumInputs = 2 + n; | m_PluginInfo.NumInputs = 2 + n; | ||||
@@ -114,6 +113,19 @@ void MixSwitchPlugin::SetChans (int n) { | |||||
UpdatePluginInfoWithHost (); | UpdatePluginInfoWithHost (); | ||||
} | } | ||||
void MixSwitchPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_SwitchPos = 1; | |||||
m_Triggered = false; | |||||
m_GUIArgs.Chans = 2; | |||||
m_GUIArgs.Switch = 1; | |||||
m_GUIArgs.Echo = 1; | |||||
m_GUIArgs.Auto = false; | |||||
} | |||||
void MixSwitchPlugin::Execute() { | void MixSwitchPlugin::Execute() { | ||||
float f; | float f; | ||||
int p; | int p; | ||||
@@ -29,6 +29,7 @@ class MixSwitchPlugin : public SpiralPlugin { | |||||
virtual PluginInfo& Initialise (const HostInfo *Host); | virtual PluginInfo& Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI (); | virtual SpiralGUIType* CreateGUI (); | ||||
virtual void Execute (); | virtual void Execute (); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
@@ -101,6 +101,13 @@ SpiralGUIType *MoogFilterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void MoogFilterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
fs = m_HostInfo->SAMPLERATE; | |||||
Clear(); | |||||
} | |||||
void MoogFilterPlugin::Execute() | void MoogFilterPlugin::Execute() | ||||
{ | { | ||||
float in, Q; | float in, Q; | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -83,6 +83,12 @@ SpiralGUIType *NoteSnapPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void NoteSnapPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Out = 0; | |||||
} | |||||
void NoteSnapPlugin::Execute() | void NoteSnapPlugin::Execute() | ||||
{ | { | ||||
float Freq=0; | float Freq=0; | ||||
@@ -31,6 +31,7 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -104,6 +104,15 @@ SpiralGUIType *OscillatorPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void OscillatorPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_CyclePos=0; | |||||
m_Note=0; | |||||
m_LastFreq=0; | |||||
} | |||||
void OscillatorPlugin::Execute() | void OscillatorPlugin::Execute() | ||||
{ | { | ||||
short noisev=0; | short noisev=0; | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -146,6 +146,36 @@ bool OutputPlugin::Kill() | |||||
return true; | return true; | ||||
} | } | ||||
void OutputPlugin::Reset() | |||||
{ | |||||
if (m_IsDead) return; | |||||
m_IsDead=true; | |||||
OSSOutput::Get()->Kill(); | |||||
cb_Blocking(m_Parent,false); | |||||
ResetPorts(); | |||||
OSSOutput::Get()->AllocateBuffer(); | |||||
switch (m_Mode) | |||||
{ | |||||
case INPUT : | |||||
OSSOutput::Get()->OpenRead(); | |||||
cb_Blocking(m_Parent,true); | |||||
break; | |||||
case OUTPUT : | |||||
OSSOutput::Get()->OpenWrite(); | |||||
cb_Blocking(m_Parent,true); | |||||
break; | |||||
case DUPLEX : | |||||
OSSOutput::Get()->OpenReadWrite(); | |||||
cb_Blocking(m_Parent,true); | |||||
break; | |||||
default:{} | |||||
} | |||||
m_IsDead=false; | |||||
} | |||||
void OutputPlugin::Execute() | void OutputPlugin::Execute() | ||||
{ | { | ||||
if (m_IsDead) | if (m_IsDead) | ||||
@@ -79,6 +79,8 @@ public: | |||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual bool Kill(); | virtual bool Kill(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s) {} | virtual void StreamOut(std::ostream &s) {} | ||||
virtual void StreamIn(std::istream &s) {} | virtual void StreamIn(std::istream &s) {} | ||||
@@ -176,6 +176,18 @@ SpiralGUIType *PoshSamplerPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void PoshSamplerPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Current = 0; | |||||
for (int s=0; s<NUM_SAMPLES; s++) | |||||
{ | |||||
m_SampleDescVec[s]->Pitch *= m_SampleDescVec[s]->SampleRate/(float)m_HostInfo->SAMPLERATE; | |||||
m_SampleDescVec[s]->LoopEnd=m_SampleVec[s]->GetLength()-1; | |||||
} | |||||
} | |||||
void PoshSamplerPlugin::Execute() | void PoshSamplerPlugin::Execute() | ||||
{ | { | ||||
static bool Pong=false; | static bool Pong=false; | ||||
@@ -54,6 +54,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -100,6 +100,13 @@ SpiralGUIType *SVFilterPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void SVFilterPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
fs = m_HostInfo->SAMPLERATE; | |||||
Clear(); | |||||
} | |||||
void SVFilterPlugin::Execute() | void SVFilterPlugin::Execute() | ||||
{ | { | ||||
float in; | float in; | ||||
@@ -34,6 +34,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -75,6 +75,13 @@ SpiralGUIType *SampleHoldPlugin::CreateGUI() | |||||
return NULL; | return NULL; | ||||
} | } | ||||
void SampleHoldPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_val = 0; | |||||
m_flag = 0; | |||||
} | |||||
void SampleHoldPlugin::Execute() | void SampleHoldPlugin::Execute() | ||||
{ | { | ||||
// Just copy the data through. | // Just copy the data through. | ||||
@@ -31,6 +31,8 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s) {} | virtual void StreamOut(std::ostream &s) {} | ||||
virtual void StreamIn(std::istream &s) {} | virtual void StreamIn(std::istream &s) {} | ||||
@@ -65,6 +65,15 @@ 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::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_DataReady = false; | |||||
delete m_Data; | |||||
m_Data = new float[m_HostInfo->BUFSIZE]; | |||||
m_AudioCH->UpdateDataSize("AudioData",m_HostInfo->BUFSIZE*sizeof(float)); | |||||
} | |||||
void ScopePlugin::Execute() { | void ScopePlugin::Execute() { | ||||
// Just copy the data through. | // Just copy the data through. | ||||
m_DataReady = InputExists (0); | m_DataReady = InputExists (0); | ||||
@@ -29,6 +29,7 @@ class ScopePlugin : public SpiralPlugin { | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s) {} | virtual void StreamOut(std::ostream &s) {} | ||||
virtual void StreamIn(std::istream &s) {} | virtual void StreamIn(std::istream &s) {} | ||||
private: | private: | ||||
@@ -90,6 +90,14 @@ SpiralGUIType *SeqSelectorPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void SeqSelectorPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Pos=0; | |||||
m_Triggered=false; | |||||
m_UseRange=false; | |||||
} | |||||
void SeqSelectorPlugin::Execute() | void SeqSelectorPlugin::Execute() | ||||
{ | { | ||||
for (int n=0; n<m_HostInfo->BUFSIZE; n++) | for (int n=0; n<m_HostInfo->BUFSIZE; n++) | ||||
@@ -33,6 +33,7 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -79,6 +79,12 @@ SpiralGUIType *SmoothPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void SmoothPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Value = 0; | |||||
} | |||||
void SmoothPlugin::Execute() | void SmoothPlugin::Execute() | ||||
{ | { | ||||
float Value; | float Value; | ||||
@@ -31,6 +31,7 @@ public: | |||||
virtual PluginInfo& Initialise(const HostInfo *Host); | virtual PluginInfo& Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -122,6 +122,14 @@ SpiralGUIType *SpiralLoopPlugin::CreateGUI() | |||||
this,m_AudioCH,m_HostInfo); | this,m_AudioCH,m_HostInfo); | ||||
} | } | ||||
void SpiralLoopPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_TickOutput=-m_TickOutput; | |||||
m_TickTime=m_StoreBuffer.GetLength()/m_TicksPerLoop; | |||||
m_TickCurrent=0; | |||||
} | |||||
void SpiralLoopPlugin::Execute() | void SpiralLoopPlugin::Execute() | ||||
{ | { | ||||
if (InputExists(0)) SetRecordingSource(GetInput(0)->GetBuffer()); | if (InputExists(0)) SetRecordingSource(GetInput(0)->GetBuffer()); | ||||
@@ -55,6 +55,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -50,6 +50,20 @@ bool SpiralPlugin::Kill() | |||||
return true; | return true; | ||||
} | } | ||||
void SpiralPlugin::ResetPorts() | |||||
{ | |||||
for (int n=0; n<m_PluginInfo.NumOutputs; n++) | |||||
{ | |||||
m_Output[n]->Clear(); | |||||
m_Output[n]->Allocate(m_HostInfo->BUFSIZE); | |||||
} | |||||
} | |||||
void SpiralPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
} | |||||
PluginInfo &SpiralPlugin::Initialise(const HostInfo *Host) | PluginInfo &SpiralPlugin::Initialise(const HostInfo *Host) | ||||
{ | { | ||||
m_HostInfo=Host; | m_HostInfo=Host; | ||||
@@ -78,6 +78,7 @@ public: | |||||
// execute the audio | // execute the audio | ||||
virtual void Execute()=0; | virtual void Execute()=0; | ||||
virtual bool Kill(); | virtual bool Kill(); | ||||
virtual void Reset(); | |||||
// run the commands from the GUI | // run the commands from the GUI | ||||
virtual void ExecuteCommands() {} | virtual void ExecuteCommands() {} | ||||
@@ -146,6 +147,8 @@ protected: | |||||
void RemoveInput(); | void RemoveInput(); | ||||
void RemoveAllInputs(); | void RemoveAllInputs(); | ||||
void ResetPorts(); | |||||
// the ID number assigned to us by ssm | // the ID number assigned to us by ssm | ||||
int GetID() { return m_HostID; } | int GetID() { return m_HostID; } | ||||
@@ -104,6 +104,15 @@ void SplitSwitchPlugin::SetChans (int n) { | |||||
UpdatePluginInfoWithHost (); | UpdatePluginInfoWithHost (); | ||||
} | } | ||||
void SplitSwitchPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_Triggered=false; | |||||
m_GUIArgs.Chans = 2; | |||||
m_GUIArgs.Switch = 1; | |||||
m_GUIArgs.Echo = 1; | |||||
} | |||||
void SplitSwitchPlugin::Execute() { | void SplitSwitchPlugin::Execute() { | ||||
int n; | int n; | ||||
int NumChans = m_PluginInfo.NumOutputs - 1; | int NumChans = m_PluginInfo.NumOutputs - 1; | ||||
@@ -29,6 +29,7 @@ class SplitSwitchPlugin : public SpiralPlugin { | |||||
virtual PluginInfo& Initialise (const HostInfo *Host); | virtual PluginInfo& Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI (); | virtual SpiralGUIType* CreateGUI (); | ||||
virtual void Execute (); | virtual void Execute (); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands (); | virtual void ExecuteCommands (); | ||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
@@ -101,6 +101,15 @@ SpiralGUIType *StreamPlugin::CreateGUI() { | |||||
return new StreamPluginGUI(m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | return new StreamPluginGUI(m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); | ||||
} | } | ||||
void StreamPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
m_StreamPos = 0; | |||||
m_GlobalPos = 0; | |||||
m_SamplePos = -1; | |||||
m_Pos = 0; | |||||
} | |||||
void StreamPlugin::Execute() { | void StreamPlugin::Execute() { | ||||
if (m_File.IsOpen()) { | if (m_File.IsOpen()) { | ||||
for (int n=0; n<m_HostInfo->BUFSIZE; n++) { | for (int n=0; n<m_HostInfo->BUFSIZE; n++) { | ||||
@@ -30,6 +30,8 @@ class StreamPlugin : public SpiralPlugin { | |||||
virtual PluginInfo &Initialise (const HostInfo *Host); | virtual PluginInfo &Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut (std::ostream &s); | virtual void StreamOut (std::ostream &s); | ||||
virtual void StreamIn (std::istream &s); | virtual void StreamIn (std::istream &s); | ||||
@@ -96,6 +96,12 @@ void WaveShaperPlugin::ExecuteCommands () { | |||||
} | } | ||||
} | } | ||||
void WaveShaperPlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
calc(); | |||||
} | |||||
void WaveShaperPlugin::Execute () { | void WaveShaperPlugin::Execute () { | ||||
float k1, k2; | float k1, k2; | ||||
if (!InputExists (0)) return; | if (!InputExists (0)) return; | ||||
@@ -30,6 +30,7 @@ class WaveShaperPlugin : public SpiralPlugin { | |||||
virtual PluginInfo& Initialise (const HostInfo *Host); | virtual PluginInfo& Initialise (const HostInfo *Host); | ||||
virtual SpiralGUIType* CreateGUI(); | virtual SpiralGUIType* CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void ExecuteCommands(); | virtual void ExecuteCommands(); | ||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -160,6 +160,22 @@ void WaveTablePlugin::WriteWaves() | |||||
} | } | ||||
} | } | ||||
void WaveTablePlugin::Reset() | |||||
{ | |||||
ResetPorts(); | |||||
for (int n=0; n<NUM_TABLES; n++) | |||||
{ | |||||
m_Table[n].Clear(); | |||||
m_Table[n].Allocate(m_TableLength); | |||||
} | |||||
WriteWaves(); | |||||
m_CyclePos=0; | |||||
m_Note=0; | |||||
} | |||||
void WaveTablePlugin::Execute() | void WaveTablePlugin::Execute() | ||||
{ | { | ||||
float Freq=0; | float Freq=0; | ||||
@@ -34,6 +34,8 @@ public: | |||||
virtual PluginInfo &Initialise(const HostInfo *Host); | virtual PluginInfo &Initialise(const HostInfo *Host); | ||||
virtual SpiralGUIType *CreateGUI(); | virtual SpiralGUIType *CreateGUI(); | ||||
virtual void Execute(); | virtual void Execute(); | ||||
virtual void Reset(); | |||||
virtual void StreamOut(std::ostream &s); | virtual void StreamOut(std::ostream &s); | ||||
virtual void StreamIn(std::istream &s); | virtual void StreamIn(std::istream &s); | ||||
@@ -160,7 +160,7 @@ void SynthModular::Update() | |||||
//Erase Device from DeviceWinMap | //Erase Device from DeviceWinMap | ||||
m_DeviceWinMap.erase(i); | m_DeviceWinMap.erase(i); | ||||
} | } | ||||
else if (i->second->m_Device) // if it's not a comment | |||||
else if (i->second->m_Device && !m_ResetingAudioThread) // if it's not a comment and we aren't reseting | |||||
{ | { | ||||
#ifdef DEBUG_PLUGINS | #ifdef DEBUG_PLUGINS | ||||
cerr<<"Updating channelhandler of plugin "<<i->second->m_PluginID<<endl; | cerr<<"Updating channelhandler of plugin "<<i->second->m_PluginID<<endl; | ||||
@@ -191,13 +191,23 @@ void SynthModular::Update() | |||||
cerr<<"Executing plugin "<<di->second->m_PluginID<<endl; | cerr<<"Executing plugin "<<di->second->m_PluginID<<endl; | ||||
#endif | #endif | ||||
di->second->m_Device->Execute(); | |||||
if (m_ResetingAudioThread) | |||||
{ | |||||
di->second->m_Device->Reset(); | |||||
} | |||||
else | |||||
{ | |||||
di->second->m_Device->Execute(); | |||||
} | |||||
#ifdef DEBUG_PLUGINS | #ifdef DEBUG_PLUGINS | ||||
cerr<<"Finished executing"<<endl; | cerr<<"Finished executing"<<endl; | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
//we can safely turn this off here | |||||
m_ResetingAudioThread = false; | |||||
} | } | ||||
////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////// | ||||
@@ -720,15 +730,8 @@ void SynthModular::AddComment(int n) | |||||
void SynthModular::UpdateHostInfo() | void SynthModular::UpdateHostInfo() | ||||
{ | { | ||||
// used to use string streams, but this seems to cause a compiler bug | |||||
// at the moment, so fall back to using a temporary file | |||||
//std::stringstream str; | |||||
fstream ofs("___temp.ssmtmp",ios::out); | |||||
//str<<*this; | |||||
ofs<<*this; | |||||
ClearUp(); | |||||
/* Pause Audio */ | |||||
PauseAudio(); | |||||
// update the settings | // update the settings | ||||
m_Info.BUFSIZE = SpiralInfo::BUFSIZE; | m_Info.BUFSIZE = SpiralInfo::BUFSIZE; | ||||
@@ -739,12 +742,8 @@ void SynthModular::UpdateHostInfo() | |||||
m_Info.MIDIFILE = SpiralInfo::MIDIFILE; | m_Info.MIDIFILE = SpiralInfo::MIDIFILE; | ||||
m_Info.POLY = SpiralInfo::POLY; | m_Info.POLY = SpiralInfo::POLY; | ||||
fstream ifs("___temp.ssmtmp",ios::in); | |||||
//str>>*this; | |||||
ifs>>*this; | |||||
system("rm -f ___temp.ssmtmp"); | |||||
/* Reset all plugin ports/buffers befure Resuming */ | |||||
ResetAudio(); | |||||
} | } | ||||
////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////// | ||||
@@ -106,6 +106,20 @@ public: | |||||
m_CH.Set("PauseAudio",false); | m_CH.Set("PauseAudio",false); | ||||
} | } | ||||
void ResetAudio() | |||||
{ | |||||
if (! m_ResetingAudioThread) | |||||
{ | |||||
if (! IsPaused()) | |||||
PauseAudio(); | |||||
m_ResetingAudioThread = true; | |||||
if (IsPaused()) | |||||
ResumeAudio(); | |||||
} | |||||
} | |||||
// only for audio thread | // only for audio thread | ||||
bool IsPaused() { return m_PauseAudio; } | bool IsPaused() { return m_PauseAudio; } | ||||
@@ -119,6 +133,7 @@ private: | |||||
DeviceWin* NewComment(int n, int x, int y); | DeviceWin* NewComment(int n, int x, int y); | ||||
HostInfo m_Info; | HostInfo m_Info; | ||||
bool m_ResetingAudioThread; | |||||
static DeviceGUIInfo BuildDeviceGUIInfo(PluginInfo &PInfo); | static DeviceGUIInfo BuildDeviceGUIInfo(PluginInfo &PInfo); | ||||