| @@ -62,7 +62,6 @@ m_DC(0.0f) | |||||
| m_PluginInfo.PortTips.push_back("Gain CV"); | m_PluginInfo.PortTips.push_back("Gain CV"); | ||||
| m_PluginInfo.PortTips.push_back("DC Offset CV"); | m_PluginInfo.PortTips.push_back("DC Offset CV"); | ||||
| m_PluginInfo.PortTips.push_back("Output"); | m_PluginInfo.PortTips.push_back("Output"); | ||||
| m_AudioCH->Register("Gain",&m_Gain); | m_AudioCH->Register("Gain",&m_Gain); | ||||
| m_AudioCH->Register("DC",&m_DC); | m_AudioCH->Register("DC",&m_DC); | ||||
| } | } | ||||
| @@ -92,7 +91,8 @@ void AmpPlugin::Execute() | |||||
| in = GetInput(0,n); | in = GetInput(0,n); | ||||
| in *= m_Gain+GetInput(1,n); | in *= m_Gain+GetInput(1,n); | ||||
| in += (-m_DC)+GetInput(2,n); | in += (-m_DC)+GetInput(2,n); | ||||
| SetOutput(0,n,in); | |||||
| SetOutput(0,n,in); | |||||
| //cerr << m_Gain << " "; | |||||
| } | } | ||||
| } | } | ||||
| @@ -14,14 +14,14 @@ | |||||
| * You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
| * along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | ||||
| * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||||
| */ | |||||
| #include "../SpiralPlugin.h" | |||||
| #include <FL/Fl.h> | |||||
| */ | |||||
| #ifndef AMPPLUGIN | #ifndef AMPPLUGIN | ||||
| #define AMPPLUGIN | #define AMPPLUGIN | ||||
| #include "../SpiralPlugin.h" | |||||
| #include <FL/Fl.h> | |||||
| class AmpPlugin : public SpiralPlugin | class AmpPlugin : public SpiralPlugin | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -37,15 +37,13 @@ public: | |||||
| // has to be defined in the plugin | // has to be defined in the plugin | ||||
| virtual void UpdateGUI() { Fl::check(); } | virtual void UpdateGUI() { Fl::check(); } | ||||
| float GetGain() { return m_Gain; } | |||||
| float GetDC() { return m_DC; } | |||||
| float GetGain() { return m_Gain; } | |||||
| float GetDC() { return m_DC; } | |||||
| void Randomise(); | void Randomise(); | ||||
| private: | private: | ||||
| float m_Gain; | |||||
| float m_DC; | |||||
| float m_Gain, m_DC; | |||||
| friend std::istream &operator>>(std::istream &s, AmpPlugin &o); | friend std::istream &operator>>(std::istream &s, AmpPlugin &o); | ||||
| friend std::ostream &operator<<(std::ostream &s, AmpPlugin &o); | friend std::ostream &operator<<(std::ostream &s, AmpPlugin &o); | ||||
| }; | }; | ||||
| @@ -166,7 +166,7 @@ void AmpPluginGUI::cb_NumDC (Fl_Counter* o, void* v) { | |||||
| inline void AmpPluginGUI::cb_Reset_i (Fl_Button* o, void* v) { | inline void AmpPluginGUI::cb_Reset_i (Fl_Button* o, void* v) { | ||||
| m_NumGain->value (1.0); | m_NumGain->value (1.0); | ||||
| m_Gain->value (1.0); | m_Gain->value (1.0); | ||||
| m_GUICH->Set ("Gain", 0); | |||||
| m_GUICH->Set ("Gain", 1.0f); | |||||
| m_NumDC->value (0.0); | m_NumDC->value (0.0); | ||||
| m_DC->value (2.0); | m_DC->value (2.0); | ||||
| m_GUICH->Set ("DC", 0); | m_GUICH->Set ("DC", 0); | ||||
| @@ -36,6 +36,7 @@ string SpiralPlugin_GetGroupName() { return "Control"; } | |||||
| MeterPlugin::MeterPlugin(): | MeterPlugin::MeterPlugin(): | ||||
| m_Data (NULL), | m_Data (NULL), | ||||
| m_DataReady (false), | |||||
| m_VUMode (true) | m_VUMode (true) | ||||
| { | { | ||||
| m_PluginInfo.Name = "Meter"; | m_PluginInfo.Name = "Meter"; | ||||
| @@ -45,6 +46,7 @@ m_VUMode (true) | |||||
| m_PluginInfo.NumOutputs = 1; | m_PluginInfo.NumOutputs = 1; | ||||
| m_PluginInfo.PortTips.push_back ("Input"); | m_PluginInfo.PortTips.push_back ("Input"); | ||||
| m_PluginInfo.PortTips.push_back ("Output"); | m_PluginInfo.PortTips.push_back ("Output"); | ||||
| m_AudioCH->Register ("DataReady", &m_DataReady, ChannelHandler::OUTPUT); | |||||
| m_Version = 1; | m_Version = 1; | ||||
| } | } | ||||
| @@ -64,12 +66,13 @@ SpiralGUIType *MeterPlugin::CreateGUI() { | |||||
| } | } | ||||
| void MeterPlugin::Execute() { | 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)); | |||||
| } | |||||
| // Just copy the data through. | |||||
| m_DataReady = InputExists (0); | |||||
| if (GetOutputBuf (0)) GetOutputBuf (0)->Zero(); | |||||
| if (m_DataReady) { | |||||
| GetOutputBuf (0)->Mix (*GetInput(0), 0); | |||||
| memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); | |||||
| } | |||||
| } | } | ||||
| void MeterPlugin::ExecuteCommands () { | void MeterPlugin::ExecuteCommands () { | ||||
| @@ -35,7 +35,8 @@ class MeterPlugin : public SpiralPlugin { | |||||
| enum GUICommands {NONE, SETVU, SETMM}; | enum GUICommands {NONE, SETVU, SETMM}; | ||||
| private: | private: | ||||
| float *m_Data; | float *m_Data; | ||||
| bool m_VUMode; // This value isn't USED for anything, it's here so we can save/load it | |||||
| // m_VUMode isn't USED for anything, it's here so we can save/load it | |||||
| bool m_DataReady, m_VUMode; | |||||
| }; | }; | ||||
| #endif | #endif | ||||
| @@ -94,7 +94,8 @@ void MeterPluginGUI::draw() { | |||||
| SpiralGUIType::draw (); | SpiralGUIType::draw (); | ||||
| if (! m_Bypass) { | if (! m_Bypass) { | ||||
| float datum = 0.0; | float datum = 0.0; | ||||
| m_GUICH->GetData ("AudioData", m_Data); | |||||
| if (m_GUICH->GetBool ("DataReady")) m_GUICH->GetData ("AudioData", m_Data); | |||||
| else memset (m_Data, 0, m_BufSize * sizeof (float)); | |||||
| // The min and max values are based on the whole buffer | // The min and max values are based on the whole buffer | ||||
| for (int c=0; c<m_BufSize; c++) { | for (int c=0; c<m_BufSize; c++) { | ||||
| datum = m_Data[c]; | datum = m_Data[c]; | ||||
| @@ -35,15 +35,17 @@ string SpiralPlugin_GetGroupName() { return "Control"; } | |||||
| /////////////////////////////////////////////////////// | /////////////////////////////////////////////////////// | ||||
| ScopePlugin::ScopePlugin() | |||||
| ScopePlugin::ScopePlugin(): | |||||
| m_DataReady(false) | |||||
| { | { | ||||
| m_PluginInfo.Name="Scope"; | |||||
| m_PluginInfo.Width=260; | |||||
| m_PluginInfo.Height=115; | |||||
| m_PluginInfo.NumInputs=1; | |||||
| m_PluginInfo.NumOutputs=1; | |||||
| m_PluginInfo.PortTips.push_back("Input"); | |||||
| m_PluginInfo.PortTips.push_back("Output"); | |||||
| m_PluginInfo.Name = "Scope"; | |||||
| m_PluginInfo.Width = 260; | |||||
| m_PluginInfo.Height = 115; | |||||
| m_PluginInfo.NumInputs = 1; | |||||
| m_PluginInfo.NumOutputs = 1; | |||||
| m_PluginInfo.PortTips.push_back("Input"); | |||||
| m_PluginInfo.PortTips.push_back("Output"); | |||||
| m_AudioCH->Register ("DataReady", &m_DataReady, ChannelHandler::OUTPUT); | |||||
| } | } | ||||
| ScopePlugin::~ScopePlugin() | ScopePlugin::~ScopePlugin() | ||||
| @@ -65,10 +67,10 @@ SpiralGUIType *ScopePlugin::CreateGUI() | |||||
| void ScopePlugin::Execute() { | void ScopePlugin::Execute() { | ||||
| // Just copy the data through. | // Just copy the data through. | ||||
| m_DataReady = InputExists (0); | |||||
| if (GetOutputBuf (0)) GetOutputBuf (0)->Zero(); | if (GetOutputBuf (0)) GetOutputBuf (0)->Zero(); | ||||
| if (GetInput (0)) { | |||||
| if (m_DataReady) { | |||||
| GetOutputBuf (0)->Mix (*GetInput(0), 0); | GetOutputBuf (0)->Mix (*GetInput(0), 0); | ||||
| memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); | memcpy (m_Data, GetInput (0)->GetBuffer (), m_HostInfo->BUFSIZE * sizeof (float)); | ||||
| } | } | ||||
| } | } | ||||
| @@ -16,27 +16,24 @@ | |||||
| * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||||
| */ | */ | ||||
| #include "../SpiralPlugin.h" | |||||
| #include <FL/Fl_Pixmap.H> | |||||
| #ifndef SCOPEPLUGIN | #ifndef SCOPEPLUGIN | ||||
| #define SCOPEPLUGIN | #define SCOPEPLUGIN | ||||
| class ScopePlugin : public SpiralPlugin | |||||
| { | |||||
| public: | |||||
| ScopePlugin(); | |||||
| virtual ~ScopePlugin(); | |||||
| virtual PluginInfo& Initialise(const HostInfo *Host); | |||||
| virtual SpiralGUIType* CreateGUI(); | |||||
| virtual void Execute(); | |||||
| virtual void StreamOut(std::ostream &s) {} | |||||
| virtual void StreamIn(std::istream &s) {} | |||||
| private: | |||||
| #include "../SpiralPlugin.h" | |||||
| #include <FL/Fl_Pixmap.H> | |||||
| float *m_Data; | |||||
| class ScopePlugin : public SpiralPlugin { | |||||
| public: | |||||
| ScopePlugin(); | |||||
| virtual ~ScopePlugin(); | |||||
| virtual PluginInfo& Initialise(const HostInfo *Host); | |||||
| virtual SpiralGUIType* CreateGUI(); | |||||
| virtual void Execute(); | |||||
| virtual void StreamOut(std::ostream &s) {} | |||||
| virtual void StreamIn(std::istream &s) {} | |||||
| private: | |||||
| float *m_Data; | |||||
| bool m_DataReady; | |||||
| }; | }; | ||||
| #endif | #endif | ||||
| @@ -43,6 +43,8 @@ void ScopeWidget::draw() { | |||||
| int ho=h()/2; | int ho=h()/2; | ||||
| fl_color (color()); | fl_color (color()); | ||||
| fl_rectf (x(), y(), w(), h()); | fl_rectf (x(), y(), w(), h()); | ||||
| fl_color (m_MarkColour); | |||||
| fl_line (x(), y()+ho, x()+w(), y()+ho); | |||||
| if (!m_Data) return; | if (!m_Data) return; | ||||
| fl_push_clip (x(), y(), w(), h()); | fl_push_clip (x(), y(), w(), h()); | ||||
| float Value=0, NextValue=0; | float Value=0, NextValue=0; | ||||
| @@ -63,9 +65,10 @@ ScopePluginGUI::ScopePluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch | |||||
| SpiralPluginGUI(w,h,o,ch), | SpiralPluginGUI(w,h,o,ch), | ||||
| m_Bypass(false) | m_Bypass(false) | ||||
| { | { | ||||
| m_Scope = new ScopeWidget(5, 20, 210, 85, "Scope", Info->BUFSIZE); | |||||
| m_BufSize = Info->BUFSIZE; | |||||
| m_Scope = new ScopeWidget(5, 20, 210, 85, "Scope", m_BufSize); | |||||
| m_Scope->color (Info->SCOPE_BG_COLOUR); | m_Scope->color (Info->SCOPE_BG_COLOUR); | ||||
| m_Scope->SetWaveColour (Info->SCOPE_FG_COLOUR); | |||||
| m_Scope->SetColours (Info->SCOPE_MRK_COLOUR, Info->SCOPE_FG_COLOUR); | |||||
| m_Attenuation = new Fl_Knob (220, 10, 40, 40, "Attenuation"); | m_Attenuation = new Fl_Knob (220, 10, 40, 40, "Attenuation"); | ||||
| m_Attenuation->color(Info->GUI_COLOUR); | m_Attenuation->color(Info->GUI_COLOUR); | ||||
| m_Attenuation->type(Fl_Knob::LINELIN); | m_Attenuation->type(Fl_Knob::LINELIN); | ||||
| @@ -91,12 +94,6 @@ m_Bypass(false) | |||||
| end(); | end(); | ||||
| } | } | ||||
| void ScopePluginGUI::Display(const float *data) | |||||
| { | |||||
| //m_Scope->m_Data=data; | |||||
| if (!m_Bypass) m_Scope->redraw(); | |||||
| } | |||||
| void ScopePluginGUI::Update() | void ScopePluginGUI::Update() | ||||
| { | { | ||||
| redraw(); | redraw(); | ||||
| @@ -104,11 +101,12 @@ void ScopePluginGUI::Update() | |||||
| void ScopePluginGUI::draw() | void ScopePluginGUI::draw() | ||||
| { | { | ||||
| SpiralGUIType::draw(); | |||||
| const float *data; | |||||
| //cerr<<"getting and drawing..."<<endl; | |||||
| m_GUICH->GetData("AudioData",(void*)m_Scope->m_Data); | |||||
| Display(data); | |||||
| SpiralGUIType::draw(); | |||||
| const float *data; | |||||
| //cerr<<"getting and drawing..."<<endl; | |||||
| if (m_GUICH->GetBool ("DataReady")) m_GUICH->GetData ("AudioData", (void*)m_Scope->m_Data); | |||||
| else memset ((void*)m_Scope->m_Data, 0, m_BufSize * sizeof (float)); | |||||
| if (!m_Bypass) m_Scope->redraw(); | |||||
| } | } | ||||
| void ScopePluginGUI::UpdateValues(SpiralPlugin* o) | void ScopePluginGUI::UpdateValues(SpiralPlugin* o) | ||||
| @@ -16,15 +16,15 @@ | |||||
| * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||||
| */ | */ | ||||
| #ifndef SCOPEGUI | |||||
| #define SCOPEGUI | |||||
| #include <FL/Fl.H> | #include <FL/Fl.H> | ||||
| #include <FL/Fl_Button.H> | #include <FL/Fl_Button.H> | ||||
| #include "../Widgets/Fl_Knob.H" | #include "../Widgets/Fl_Knob.H" | ||||
| #include "ScopePlugin.h" | #include "ScopePlugin.h" | ||||
| #include "../SpiralPluginGUI.h" | #include "../SpiralPluginGUI.h" | ||||
| #ifndef SCOPEGUI | |||||
| #define SCOPEGUI | |||||
| class ScopeWidget : public Fl_Widget | class ScopeWidget : public Fl_Widget | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -32,14 +32,14 @@ class ScopeWidget : public Fl_Widget | |||||
| ~ScopeWidget(); | ~ScopeWidget(); | ||||
| void draw(); | void draw(); | ||||
| //void SetNumChannels (int s) { m_Channels=s; } | //void SetNumChannels (int s) { m_Channels=s; } | ||||
| void SetWaveColour (unsigned c) { m_WaveColour=(Fl_Color)c; } | |||||
| void SetColours (unsigned m, unsigned f) { m_MarkColour=(Fl_Color)m; m_WaveColour=(Fl_Color)f; } | |||||
| void SetAttenuation (float c) { m_Attenuation=c; } | void SetAttenuation (float c) { m_Attenuation=c; } | ||||
| void SetTimeBase (float c) { m_TimeBase=c; } | void SetTimeBase (float c) { m_TimeBase=c; } | ||||
| const float *m_Data; | const float *m_Data; | ||||
| //int m_Channels; | //int m_Channels; | ||||
| private: | private: | ||||
| //int m_GUIColour, m_GUIBGColour; | //int m_GUIColour, m_GUIBGColour; | ||||
| Fl_Color m_WaveColour; | |||||
| Fl_Color m_MarkColour, m_WaveColour; | |||||
| float m_Attenuation, m_TimeBase; | float m_Attenuation, m_TimeBase; | ||||
| int m_Bufsize; | int m_Bufsize; | ||||
| }; | }; | ||||
| @@ -52,11 +52,11 @@ class ScopePluginGUI : public SpiralPluginGUI | |||||
| virtual void UpdateValues (SpiralPlugin* o); | virtual void UpdateValues (SpiralPlugin* o); | ||||
| virtual void Update(); | virtual void Update(); | ||||
| virtual void draw(); | virtual void draw(); | ||||
| void Display (const float *data); | |||||
| protected: | protected: | ||||
| const std::string GetHelpText (const std::string &loc); | const std::string GetHelpText (const std::string &loc); | ||||
| private: | private: | ||||
| bool m_Bypass; | bool m_Bypass; | ||||
| int m_BufSize; | |||||
| // Fl_Button *Bypass; | // Fl_Button *Bypass; | ||||
| ScopeWidget *m_Scope; | ScopeWidget *m_Scope; | ||||
| Fl_Knob *m_Attenuation, *m_TimeBase; | Fl_Knob *m_Attenuation, *m_TimeBase; | ||||