Made 0.4.12 release
[lmms/mlankhorst.git] / include / sample_play_handle.h
blob2c116173745c02dfa5b551682bb06ac96f0bdec8
1 /*
2 * sample_play_handle.h - play-handle for playing a sample
4 * Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
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.
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.
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.
26 #ifndef _SAMPLE_PLAY_HANDLE_H
27 #define _SAMPLE_PLAY_HANDLE_H
29 #include "mixer.h"
30 #include "sample_buffer.h"
31 #include "AutomatableModel.h"
33 class bbTrack;
34 class pattern;
35 class sampleTCO;
36 class track;
37 class AudioPort;
40 class samplePlayHandle : public playHandle
42 public:
43 samplePlayHandle( const QString & _sample_file );
44 samplePlayHandle( sampleBuffer * _sample_buffer );
45 samplePlayHandle( sampleTCO * _tco );
46 samplePlayHandle( pattern * _pattern );
47 virtual ~samplePlayHandle();
49 virtual inline bool affinityMatters() const
51 return true;
55 virtual void play( sampleFrame * _working_buffer );
56 virtual bool done() const;
58 virtual bool isFromTrack( const track * _track ) const;
60 f_cnt_t totalFrames() const;
61 inline f_cnt_t framesDone() const
63 return( m_frame );
65 void setDoneMayReturnTrue( bool _enable )
67 m_doneMayReturnTrue = _enable;
70 void setBBTrack( bbTrack * _bb_track )
72 m_bbTrack = _bb_track;
75 void setVolumeModel( FloatModel * _model )
77 m_volumeModel = _model;
81 private:
82 sampleBuffer * m_sampleBuffer;
83 bool m_doneMayReturnTrue;
85 f_cnt_t m_frame;
86 sampleBuffer::handleState m_state;
88 AudioPort * m_audioPort;
89 const bool m_ownAudioPort;
91 FloatModel m_defaultVolumeModel;
92 FloatModel * m_volumeModel;
93 track * m_track;
95 bbTrack * m_bbTrack;
97 } ;
100 #endif