SampleRecordHandle.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * SampleRecordHandle.h - play-handle for recording a sample
  3. *
  4. * Copyright (c) 2008 Csaba Hruska <csaba.hruska/at/gmail.com>
  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_RECORD_HANDLE_H
  25. #define SAMPLE_RECORD_HANDLE_H
  26. #include <QtCore/QList>
  27. #include <QtCore/QPair>
  28. #include "PlayHandle.h"
  29. #include "TimePos.h"
  30. class PatternTrack;
  31. class SampleBuffer;
  32. class SampleClip;
  33. class Track;
  34. class SampleRecordHandle : public PlayHandle
  35. {
  36. public:
  37. SampleRecordHandle( SampleClip* clip );
  38. virtual ~SampleRecordHandle();
  39. void play( sampleFrame * _working_buffer ) override;
  40. bool isFinished() const override;
  41. bool isFromTrack( const Track * _track ) const override;
  42. f_cnt_t framesRecorded() const;
  43. void createSampleBuffer( SampleBuffer * * _sample_buf );
  44. private:
  45. virtual void writeBuffer( const sampleFrame * _ab,
  46. const f_cnt_t _frames );
  47. typedef QList<QPair<sampleFrame *, f_cnt_t> > bufferList;
  48. bufferList m_buffers;
  49. f_cnt_t m_framesRecorded;
  50. TimePos m_minLength;
  51. Track * m_track;
  52. PatternTrack* m_patternTrack;
  53. SampleClip * m_clip;
  54. } ;
  55. #endif