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.

98 lines
2.1KB

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