You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.2KB

  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. using namespace std;
  24. extern "C" {
  25. SpiralPlugin* SpiralPlugin_CreateInstance()
  26. {
  27. return new RingModPlugin;
  28. }
  29. char** SpiralPlugin_GetIcon()
  30. {
  31. return SpiralIcon_xpm;
  32. }
  33. int SpiralPlugin_GetID()
  34. {
  35. return 0x000a;
  36. }
  37. string SpiralPlugin_GetGroupName()
  38. {
  39. return "Filters/FX";
  40. }
  41. }
  42. ///////////////////////////////////////////////////////
  43. RingModPlugin::RingModPlugin() :
  44. m_Amount(1.0f)
  45. {
  46. m_PluginInfo.Name="Ring Mod";
  47. m_PluginInfo.Width=80;
  48. m_PluginInfo.Height=80;
  49. m_PluginInfo.NumInputs=2;
  50. m_PluginInfo.NumOutputs=1;
  51. m_PluginInfo.PortTips.push_back("Input 1");
  52. m_PluginInfo.PortTips.push_back("Input 2");
  53. m_PluginInfo.PortTips.push_back("Output");
  54. m_AudioCH->Register("Amount",&m_Amount);
  55. }
  56. RingModPlugin::~RingModPlugin()
  57. {
  58. }
  59. PluginInfo &RingModPlugin::Initialise(const HostInfo *Host)
  60. {
  61. return SpiralPlugin::Initialise(Host);
  62. }
  63. SpiralGUIType *RingModPlugin::CreateGUI()
  64. {
  65. return new RingModPluginGUI(m_PluginInfo.Width,
  66. m_PluginInfo.Height,
  67. this,m_AudioCH,m_HostInfo);
  68. }
  69. void RingModPlugin::Execute()
  70. {
  71. for (int n=0; n<m_HostInfo->BUFSIZE; n++)
  72. {
  73. SetOutput(0,n,GetInput(0,n)*GetInput(1,n)*m_Amount);
  74. }
  75. }
  76. void RingModPlugin::Randomise()
  77. {
  78. }
  79. void RingModPlugin::StreamOut(ostream &s)
  80. {
  81. s<<m_Version<<" "<<m_Amount<<" ";
  82. }
  83. void RingModPlugin::StreamIn(istream &s)
  84. {
  85. int version;
  86. s>>version;
  87. s>>m_Amount;
  88. }