SampleTrack.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * SampleTrack.h - class SampleTrack, a track which provides arrangement of samples
  3. *
  4. * Copyright (c) 2005-2014 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 SAMPLE_TRACK_H
  25. #define SAMPLE_TRACK_H
  26. #include <QLayout>
  27. #include "AudioPort.h"
  28. #include "FadeButton.h"
  29. #include "Mixer.h"
  30. #include "SampleClip.h"
  31. #include "SampleTrackView.h"
  32. #include "Track.h"
  33. class SampleTrack : public Track
  34. {
  35. Q_OBJECT
  36. public:
  37. SampleTrack( TrackContainer* tc );
  38. virtual ~SampleTrack();
  39. virtual bool play( const TimePos & _start, const fpp_t _frames,
  40. const f_cnt_t _frame_base, int _clip_num = -1 ) override;
  41. TrackView * createView( TrackContainerView* tcv ) override;
  42. Clip* createClip(const TimePos & pos) override;
  43. virtual void saveTrackSpecificSettings( QDomDocument & _doc,
  44. QDomElement & _parent ) override;
  45. void loadTrackSpecificSettings( const QDomElement & _this ) override;
  46. inline IntModel * mixerChannelModel()
  47. {
  48. return &m_mixerChannelModel;
  49. }
  50. inline AudioPort * audioPort()
  51. {
  52. return &m_audioPort;
  53. }
  54. QString nodeName() const override
  55. {
  56. return "sampletrack";
  57. }
  58. bool isPlaying()
  59. {
  60. return m_isPlaying;
  61. }
  62. void setPlaying(bool playing)
  63. {
  64. if (m_isPlaying != playing) { emit playingChanged(); }
  65. m_isPlaying = playing;
  66. }
  67. signals:
  68. void playingChanged();
  69. public slots:
  70. void updateClips();
  71. void setPlayingClips( bool isPlaying );
  72. void updateMixerChannel();
  73. private:
  74. FloatModel m_volumeModel;
  75. FloatModel m_panningModel;
  76. IntModel m_mixerChannelModel;
  77. AudioPort m_audioPort;
  78. bool m_isPlaying;
  79. friend class SampleTrackView;
  80. friend class SampleTrackWindow;
  81. } ;
  82. #endif