@@ -155,6 +155,7 @@ m_Amped(false) | |||||
m_OutData.InputPortNames = (char *)malloc(256 * m_MaxInputPortCount); | m_OutData.InputPortNames = (char *)malloc(256 * m_MaxInputPortCount); | ||||
m_OutData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_MaxInputPortCount); | m_OutData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_MaxInputPortCount); | ||||
m_OutData.InputPortValues = (float *)malloc(sizeof(float) * m_MaxInputPortCount); | |||||
m_InData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_MaxInputPortCount); | m_InData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_MaxInputPortCount); | ||||
if (m_OutData.InputPortNames && | if (m_OutData.InputPortNames && | ||||
@@ -162,6 +163,7 @@ m_Amped(false) | |||||
m_InData.InputPortRanges) { | m_InData.InputPortRanges) { | ||||
m_AudioCH->RegisterData("GetInputPortNames", ChannelHandler::OUTPUT, m_OutData.InputPortNames, 256 * m_MaxInputPortCount); | m_AudioCH->RegisterData("GetInputPortNames", ChannelHandler::OUTPUT, m_OutData.InputPortNames, 256 * m_MaxInputPortCount); | ||||
m_AudioCH->RegisterData("GetInputPortRanges", ChannelHandler::OUTPUT, m_OutData.InputPortRanges, sizeof(PortRange) * m_MaxInputPortCount); | m_AudioCH->RegisterData("GetInputPortRanges", ChannelHandler::OUTPUT, m_OutData.InputPortRanges, sizeof(PortRange) * m_MaxInputPortCount); | ||||
m_AudioCH->RegisterData("GetInputPortValues", ChannelHandler::OUTPUT, m_OutData.InputPortValues, sizeof(float) * m_MaxInputPortCount); | |||||
m_AudioCH->RegisterData("SetInputPortRanges", ChannelHandler::INPUT, m_InData.InputPortRanges, sizeof(PortRange) * m_MaxInputPortCount); | m_AudioCH->RegisterData("SetInputPortRanges", ChannelHandler::INPUT, m_InData.InputPortRanges, sizeof(PortRange) * m_MaxInputPortCount); | ||||
} else { | } else { | ||||
cerr<<"Memory allocation error"<<endl; | cerr<<"Memory allocation error"<<endl; | ||||
@@ -173,6 +175,7 @@ LADSPAPlugin::~LADSPAPlugin() | |||||
// Free allocated buffers | // Free allocated buffers | ||||
if (m_OutData.InputPortNames) free(m_OutData.InputPortNames); | if (m_OutData.InputPortNames) free(m_OutData.InputPortNames); | ||||
if (m_OutData.InputPortRanges) free(m_OutData.InputPortRanges); | if (m_OutData.InputPortRanges) free(m_OutData.InputPortRanges); | ||||
if (m_OutData.InputPortValues) free(m_OutData.InputPortValues); | |||||
if (m_InData.InputPortRanges) free(m_InData.InputPortRanges); | if (m_InData.InputPortRanges) free(m_InData.InputPortRanges); | ||||
} | } | ||||
@@ -220,6 +223,8 @@ void LADSPAPlugin::Execute() | |||||
} | } | ||||
// Update the GUI outputs with the first value in the buffer | // Update the GUI outputs with the first value in the buffer | ||||
//((LADSPAPluginGUI*)m_GUI)->UpdatePortDisplay(n,m_LADSPABufVec[n][0]); | //((LADSPAPluginGUI*)m_GUI)->UpdatePortDisplay(n,m_LADSPABufVec[n][0]); | ||||
// Copy values into OutData value buffer for display in GUI | |||||
m_OutData.InputPortValues[n] = m_LADSPABufVec[n][0]; | |||||
} | } | ||||
else // zero | else // zero | ||||
{ | { | ||||
@@ -131,6 +131,7 @@ private: | |||||
{ | { | ||||
char *InputPortNames; | char *InputPortNames; | ||||
PortRange *InputPortRanges; | PortRange *InputPortRanges; | ||||
float *InputPortValues; | |||||
}; | }; | ||||
// Data received from GUI | // Data received from GUI | ||||
@@ -51,11 +51,12 @@ SpiralPluginGUI(w,h,o,ch) | |||||
} | } | ||||
// Get maximum input port count | // Get maximum input port count | ||||
m_GUICH->GetData("GetMaxInputPortCount",&(m_InData.MaxInputPorts)); | |||||
m_GUICH->GetData("GetMaxInputPortCount",&(m_InData.MaxInputPortCount)); | |||||
// Set up buffers for data transfer via ChannelHandler | // Set up buffers for data transfer via ChannelHandler | ||||
m_InData.InputPortNames = (char *)malloc(256 * m_InData.MaxInputPorts); | |||||
m_InData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_InData.MaxInputPorts); | |||||
m_InData.InputPortNames = (char *)malloc(256 * m_InData.MaxInputPortCount); | |||||
m_InData.InputPortRanges = (PortRange *)malloc(sizeof(PortRange) * m_InData.MaxInputPortCount); | |||||
m_InData.InputPortValues = (float *)malloc(sizeof(float) * m_InData.MaxInputPortCount); | |||||
if (!(m_InData.InputPortNames && m_InData.InputPortRanges)) { | if (!(m_InData.InputPortNames && m_InData.InputPortRanges)) { | ||||
cerr<<"Memory allocation error\n"<<endl; | cerr<<"Memory allocation error\n"<<endl; | ||||
@@ -241,6 +242,16 @@ void LADSPAPluginGUI::UpdateValues(SpiralPlugin *o) | |||||
} | } | ||||
} | } | ||||
void LADSPAPluginGUI::Update(void) | |||||
{ | |||||
m_GUICH->GetData("GetInputPortCount", &(m_InData.InputPortCount)); | |||||
m_GUICH->GetData("GetInputPortValues", m_InData.InputPortValues); | |||||
for (unsigned long n=0; n < m_InData.InputPortCount; n++) { | |||||
UpdatePortDisplay(n, m_InData.InputPortValues[n]); | |||||
} | |||||
} | |||||
inline void LADSPAPluginGUI::cb_Gain_i(Fl_Knob* o, void* v) | inline void LADSPAPluginGUI::cb_Gain_i(Fl_Knob* o, void* v) | ||||
{ | { | ||||
m_GUICH->Set("SetGain",(float)(o->value())); | m_GUICH->Set("SetGain",(float)(o->value())); | ||||
@@ -264,7 +275,7 @@ inline void LADSPAPluginGUI::cb_Select_i(Fl_Hold_Browser* o) | |||||
// Now get the new values to populate GUI controls | // Now get the new values to populate GUI controls | ||||
m_GUICH->GetData("GetName", m_InData.Name); | m_GUICH->GetData("GetName", m_InData.Name); | ||||
m_GUICH->GetData("GetMaker", m_InData.Maker); | m_GUICH->GetData("GetMaker", m_InData.Maker); | ||||
m_GUICH->GetData("GetInputPortCount", &(m_InData.InputPorts)); | |||||
m_GUICH->GetData("GetInputPortCount", &(m_InData.InputPortCount)); | |||||
m_GUICH->GetData("GetInputPortNames", m_InData.InputPortNames); | m_GUICH->GetData("GetInputPortNames", m_InData.InputPortNames); | ||||
m_GUICH->GetData("GetInputPortRanges", m_InData.InputPortRanges); | m_GUICH->GetData("GetInputPortRanges", m_InData.InputPortRanges); | ||||
@@ -274,7 +285,7 @@ inline void LADSPAPluginGUI::cb_Select_i(Fl_Hold_Browser* o) | |||||
// Clear out port info, and refresh | // Clear out port info, and refresh | ||||
ClearPortInfo(); | ClearPortInfo(); | ||||
for (unsigned long n = 0; n < m_InData.InputPorts; n++) { | |||||
for (unsigned long n = 0; n < m_InData.InputPortCount; n++) { | |||||
AddPortInfo((const char *)(m_InData.InputPortNames + n * 256)); | AddPortInfo((const char *)(m_InData.InputPortNames + n * 256)); | ||||
SetMinMax(n, m_InData.InputPortRanges[n].Min, | SetMinMax(n, m_InData.InputPortRanges[n].Min, | ||||
m_InData.InputPortRanges[n].Max, | m_InData.InputPortRanges[n].Max, | ||||
@@ -51,6 +51,7 @@ public: | |||||
~LADSPAPluginGUI(); | ~LADSPAPluginGUI(); | ||||
virtual void UpdateValues(SpiralPlugin *o); | virtual void UpdateValues(SpiralPlugin *o); | ||||
virtual void Update(void); | |||||
void SetName(const char *s); | void SetName(const char *s); | ||||
void SetMaker(const char *s); | void SetMaker(const char *s); | ||||
@@ -61,8 +62,8 @@ public: | |||||
void SetMinMax(int n, float min, float max, bool clamp); | void SetMinMax(int n, float min, float max, bool clamp); | ||||
void GetMinMax(int n, float &min, float &max, bool &clamp); | void GetMinMax(int n, float &min, float &max, bool &clamp); | ||||
string GetFilename() { return m_Filename; } | |||||
string GetLabel() { return m_Label; } | |||||
string GetFilename(void) { return m_Filename; } | |||||
string GetLabel(void) { return m_Label; } | |||||
void SetFilename(string s) { m_Filename=s; } | void SetFilename(string s) { m_Filename=s; } | ||||
void SetLabel(string s) { m_Label=s; } | void SetLabel(string s) { m_Label=s; } | ||||
@@ -108,10 +109,11 @@ private: | |||||
float Gain; | float Gain; | ||||
char Name[256]; | char Name[256]; | ||||
char Maker[256]; | char Maker[256]; | ||||
unsigned long MaxInputPorts; | |||||
unsigned long InputPorts; | |||||
unsigned long MaxInputPortCount; | |||||
unsigned long InputPortCount; | |||||
char *InputPortNames; | char *InputPortNames; | ||||
PortRange *InputPortRanges; | PortRange *InputPortRanges; | ||||
float *InputPortValues; | |||||
}; | }; | ||||
InChannelData m_InData; | InChannelData m_InData; | ||||