sid_instrument.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * sid_Instrument.h - ResID based software-synthesizer
  3. *
  4. * Copyright (c) 2008 Csaba Hruska <csaba.hruska/at/gmail.com>
  5. * Attila Herman <attila589/at/gmail.com>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef _SID_H
  26. #define _SID_H
  27. #include <QObject>
  28. #include "Instrument.h"
  29. #include "InstrumentView.h"
  30. #include "Knob.h"
  31. class sidInstrumentView;
  32. class NotePlayHandle;
  33. class automatableButtonGroup;
  34. class PixmapButton;
  35. class voiceObject : public Model
  36. {
  37. Q_OBJECT
  38. MM_OPERATORS
  39. public:
  40. enum WaveForm {
  41. SquareWave = 0,
  42. TriangleWave,
  43. SawWave,
  44. NoiseWave,
  45. NumWaveShapes
  46. };
  47. voiceObject( Model * _parent, int _idx );
  48. virtual ~voiceObject();
  49. private:
  50. FloatModel m_pulseWidthModel;
  51. FloatModel m_attackModel;
  52. FloatModel m_decayModel;
  53. FloatModel m_sustainModel;
  54. FloatModel m_releaseModel;
  55. FloatModel m_coarseModel;
  56. IntModel m_waveFormModel;
  57. BoolModel m_syncModel;
  58. BoolModel m_ringModModel;
  59. BoolModel m_filteredModel;
  60. BoolModel m_testModel;
  61. friend class sidInstrument;
  62. friend class sidInstrumentView;
  63. } ;
  64. class sidInstrument : public Instrument
  65. {
  66. Q_OBJECT
  67. public:
  68. enum FilerType {
  69. HighPass = 0,
  70. BandPass,
  71. LowPass,
  72. NumFilterTypes
  73. };
  74. enum ChipModel {
  75. sidMOS6581 = 0,
  76. sidMOS8580,
  77. NumChipModels
  78. };
  79. sidInstrument( InstrumentTrack * _instrument_track );
  80. virtual ~sidInstrument();
  81. virtual void playNote( NotePlayHandle * _n,
  82. sampleFrame * _working_buffer );
  83. virtual void deleteNotePluginData( NotePlayHandle * _n );
  84. virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
  85. virtual void loadSettings( const QDomElement & _this );
  86. virtual QString nodeName() const;
  87. virtual f_cnt_t desiredReleaseFrames() const;
  88. virtual PluginView * instantiateView( QWidget * _parent );
  89. /*public slots:
  90. void updateKnobHint();
  91. void updateKnobToolTip();*/
  92. private:
  93. // voices
  94. voiceObject * m_voice[3];
  95. // filter
  96. FloatModel m_filterFCModel;
  97. FloatModel m_filterResonanceModel;
  98. IntModel m_filterModeModel;
  99. // misc
  100. BoolModel m_voice3OffModel;
  101. FloatModel m_volumeModel;
  102. IntModel m_chipModel;
  103. friend class sidInstrumentView;
  104. } ;
  105. class sidInstrumentView : public InstrumentViewFixedSize
  106. {
  107. Q_OBJECT
  108. public:
  109. sidInstrumentView( Instrument * _instrument, QWidget * _parent );
  110. virtual ~sidInstrumentView();
  111. private:
  112. virtual void modelChanged();
  113. automatableButtonGroup * m_passBtnGrp;
  114. automatableButtonGroup * m_sidTypeBtnGrp;
  115. struct voiceKnobs
  116. {
  117. voiceKnobs( Knob * a,
  118. Knob * d,
  119. Knob * s,
  120. Knob * r,
  121. Knob * pw,
  122. Knob * crs,
  123. automatableButtonGroup * wfbg,
  124. PixmapButton * syncb,
  125. PixmapButton * ringb,
  126. PixmapButton * filterb,
  127. PixmapButton * testb ) :
  128. m_attKnob( a ),
  129. m_decKnob( d ),
  130. m_sustKnob( s ),
  131. m_relKnob( r ),
  132. m_pwKnob( pw ),
  133. m_crsKnob( crs ),
  134. m_waveFormBtnGrp( wfbg ),
  135. m_syncButton( syncb ),
  136. m_ringModButton( ringb ),
  137. m_filterButton( filterb ),
  138. m_testButton( testb )
  139. {
  140. }
  141. voiceKnobs()
  142. {
  143. }
  144. Knob * m_attKnob;
  145. Knob * m_decKnob;
  146. Knob * m_sustKnob;
  147. Knob * m_relKnob;
  148. Knob * m_pwKnob;
  149. Knob * m_crsKnob;
  150. automatableButtonGroup * m_waveFormBtnGrp;
  151. PixmapButton * m_syncButton;
  152. PixmapButton * m_ringModButton;
  153. PixmapButton * m_filterButton;
  154. PixmapButton * m_testButton;
  155. } ;
  156. voiceKnobs m_voiceKnobs[3];
  157. Knob * m_volKnob;
  158. Knob * m_resKnob;
  159. Knob * m_cutKnob;
  160. PixmapButton * m_offButton;
  161. protected slots:
  162. void updateKnobHint();
  163. void updateKnobToolTip();
  164. } ;
  165. #endif