InstrumentSoundShaping.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * InstrumentSoundShaping.h - declaration of class InstrumentSoundShaping
  3. *
  4. * Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef INSTRUMENT_SOUND_SHAPING_H
  25. #define INSTRUMENT_SOUND_SHAPING_H
  26. #include "ComboBoxModel.h"
  27. class InstrumentTrack;
  28. class EnvelopeAndLfoParameters;
  29. class NotePlayHandle;
  30. class InstrumentSoundShaping : public Model, public JournallingObject
  31. {
  32. Q_OBJECT
  33. public:
  34. InstrumentSoundShaping( InstrumentTrack * _instrument_track );
  35. virtual ~InstrumentSoundShaping();
  36. void processAudioBuffer( sampleFrame * _ab, const fpp_t _frames,
  37. NotePlayHandle * _n );
  38. enum Targets
  39. {
  40. Volume,
  41. Cut,
  42. Resonance,
  43. NumTargets
  44. } ;
  45. f_cnt_t envFrames( const bool _only_vol = false ) const;
  46. f_cnt_t releaseFrames() const;
  47. float volumeLevel( NotePlayHandle * _n, const f_cnt_t _frame );
  48. void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
  49. void loadSettings( const QDomElement & _this ) override;
  50. inline QString nodeName() const override
  51. {
  52. return "eldata";
  53. }
  54. private:
  55. EnvelopeAndLfoParameters * m_envLfoParameters[NumTargets];
  56. InstrumentTrack * m_instrumentTrack;
  57. BoolModel m_filterEnabledModel;
  58. ComboBoxModel m_filterModel;
  59. FloatModel m_filterCutModel;
  60. FloatModel m_filterResModel;
  61. static const char *const targetNames[InstrumentSoundShaping::NumTargets][3];
  62. friend class InstrumentSoundShapingView;
  63. } ;
  64. #endif