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.

94 lines
2.3KB

  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 "ScopePlugin.h"
  19. #include "ScopePluginGUI.h"
  20. #include <FL/Fl_Button.h>
  21. #include "SpiralIcon.xpm"
  22. extern "C"
  23. {
  24. SpiralPlugin* SpiralPlugin_CreateInstance()
  25. {
  26. return new ScopePlugin;
  27. }
  28. char** SpiralPlugin_GetIcon()
  29. {
  30. return SpiralIcon_xpm;
  31. }
  32. int SpiralPlugin_GetID()
  33. {
  34. return 0x0001;
  35. }
  36. string SpiralPlugin_GetGroupName()
  37. {
  38. return "Control";
  39. }
  40. }
  41. ///////////////////////////////////////////////////////
  42. ScopePlugin::ScopePlugin()
  43. {
  44. m_PluginInfo.Name="Scope";
  45. //m_PluginInfo.Width=220;
  46. m_PluginInfo.Width=260;
  47. //m_PluginInfo.Height=125;
  48. m_PluginInfo.Height=115;
  49. m_PluginInfo.NumInputs=1;
  50. m_PluginInfo.NumOutputs=1;
  51. m_PluginInfo.PortTips.push_back("Input");
  52. m_PluginInfo.PortTips.push_back("Output");
  53. }
  54. ScopePlugin::~ScopePlugin()
  55. {
  56. }
  57. PluginInfo &ScopePlugin::Initialise(const HostInfo *Host)
  58. {
  59. PluginInfo& Info = SpiralPlugin::Initialise(Host);
  60. m_Data = new float[Host->BUFSIZE];
  61. m_AudioCH->RegisterData("AudioData",ChannelHandler::OUTPUT,m_Data,Host->BUFSIZE*sizeof(float));
  62. return Info;
  63. }
  64. SpiralGUIType *ScopePlugin::CreateGUI()
  65. {
  66. return new ScopePluginGUI(m_PluginInfo.Width,
  67. m_PluginInfo.Height,
  68. this,
  69. m_AudioCH,
  70. m_HostInfo);
  71. }
  72. void ScopePlugin::Execute()
  73. {
  74. // Just copy the data through.
  75. if (GetOutputBuf(0)) GetOutputBuf(0)->Zero();
  76. if (GetInput(0)) GetOutputBuf(0)->Mix(*GetInput(0),0);
  77. if (GetInput(0))
  78. {
  79. //cerr<<1<<" "<<m_HostInfo->BUFSIZE<<endl;
  80. memcpy(m_Data,GetInput(0)->GetBuffer(),m_HostInfo->BUFSIZE*sizeof(float));
  81. }
  82. }