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.

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