SampleClip.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * SampleClip.h
  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_CLIP_H
  25. #define SAMPLE_CLIP_H
  26. #include "SampleBuffer.h"
  27. #include "SampleTrack.h"
  28. #include "Clip.h"
  29. class SampleClip : public Clip
  30. {
  31. Q_OBJECT
  32. mapPropertyFromModel(bool,isRecord,setRecord,m_recordModel);
  33. public:
  34. SampleClip( Track * _track );
  35. SampleClip( const SampleClip& orig );
  36. virtual ~SampleClip();
  37. SampleClip& operator=( const SampleClip& that ) = delete;
  38. void changeLength( const TimePos & _length ) override;
  39. const QString & sampleFile() const;
  40. void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
  41. void loadSettings( const QDomElement & _this ) override;
  42. inline QString nodeName() const override
  43. {
  44. return "sampleclip";
  45. }
  46. SampleBuffer* sampleBuffer()
  47. {
  48. return m_sampleBuffer;
  49. }
  50. TimePos sampleLength() const;
  51. void setSampleStartFrame( f_cnt_t startFrame );
  52. void setSamplePlayLength( f_cnt_t length );
  53. ClipView * createView( TrackView * _tv ) override;
  54. bool isPlaying() const;
  55. void setIsPlaying(bool isPlaying);
  56. public slots:
  57. void setSampleBuffer( SampleBuffer* sb );
  58. void setSampleFile( const QString & _sf );
  59. void updateLength();
  60. void toggleRecord();
  61. void playbackPositionChanged();
  62. void updateTrackClips();
  63. private:
  64. SampleBuffer* m_sampleBuffer;
  65. BoolModel m_recordModel;
  66. bool m_isPlaying;
  67. friend class SampleClipView;
  68. signals:
  69. void sampleChanged();
  70. void wasReversed();
  71. } ;
  72. #endif