1 /*  SpiralSound
2  *  Copyleft (C) 2001 David Griffiths <dave@pawfal.org>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include <math.h>
19 #include "RingModPlugin.h"
20 #include "RingModPluginGUI.h"
21 #include <FL/Fl_Button.H>
22 #include "SpiralIcon.xpm"
23 
24 using namespace std;
25 
26 extern "C" {
SpiralPlugin_CreateInstance()27 SpiralPlugin* SpiralPlugin_CreateInstance()
28 {
29 	return new RingModPlugin;
30 }
31 
SpiralPlugin_GetIcon()32 char** SpiralPlugin_GetIcon()
33 {
34 	return SpiralIcon_xpm;
35 }
36 
SpiralPlugin_GetID()37 int SpiralPlugin_GetID()
38 {
39 	return 0x000a;
40 }
41 
SpiralPlugin_GetGroupName()42 string SpiralPlugin_GetGroupName()
43 {
44 	return "Filters/FX";
45 }
46 }
47 
48 ///////////////////////////////////////////////////////
49 
RingModPlugin()50 RingModPlugin::RingModPlugin() :
51 m_Amount(1.0f)
52 {
53 	m_PluginInfo.Name="Ring Mod";
54 	m_PluginInfo.Width=80;
55 	m_PluginInfo.Height=80;
56 	m_PluginInfo.NumInputs=2;
57 	m_PluginInfo.NumOutputs=1;
58 	m_PluginInfo.PortTips.push_back("Input 1");
59 	m_PluginInfo.PortTips.push_back("Input 2");
60 	m_PluginInfo.PortTips.push_back("Output");
61 
62 	m_AudioCH->Register("Amount",&m_Amount);
63 }
64 
~RingModPlugin()65 RingModPlugin::~RingModPlugin()
66 {
67 }
68 
Initialise(const HostInfo * Host)69 PluginInfo &RingModPlugin::Initialise(const HostInfo *Host)
70 {
71 	return SpiralPlugin::Initialise(Host);
72 }
73 
CreateGUI()74 SpiralGUIType *RingModPlugin::CreateGUI()
75 {
76 	return new RingModPluginGUI(m_PluginInfo.Width,
77 								  	    m_PluginInfo.Height,
78 										this,m_AudioCH,m_HostInfo);
79 }
80 
Execute()81 void RingModPlugin::Execute()
82 {
83 	for (int n=0; n<m_HostInfo->BUFSIZE; n++)
84 	{
85 		SetOutput(0,n,GetInput(0,n)*GetInput(1,n)*m_Amount);
86 	}
87 }
88 
Randomise()89 void RingModPlugin::Randomise()
90 {
91 }
92 
StreamOut(ostream & s)93 void RingModPlugin::StreamOut(ostream &s)
94 {
95 	s<<m_Version<<" "<<m_Amount<<" ";
96 }
97 
StreamIn(istream & s)98 void RingModPlugin::StreamIn(istream &s)
99 {
100 	int version;
101 	s>>version;
102 	s>>m_Amount;
103 }
104 
105