LMMS
Loading...
Searching...
No Matches
SamplePlayHandle.h
Go to the documentation of this file.
1
2/*
3 * SamplePlayHandle.h - play-handle for playing a sample
4 *
5 * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_SAMPLE_PLAY_HANDLE_H
27#define LMMS_SAMPLE_PLAY_HANDLE_H
28
29#include "Sample.h"
30#include "PlayHandle.h"
31
32namespace lmms
33{
34
35
36class PatternTrack;
37class SampleClip;
38class Track;
39
40
41class LMMS_EXPORT SamplePlayHandle : public PlayHandle
42{
43public:
44 SamplePlayHandle(Sample* sample, bool ownAudioBusHandle = true);
45 SamplePlayHandle( const QString& sampleFile );
47 ~SamplePlayHandle() override;
48
49 inline bool affinityMatters() const override
50 {
51 return true;
52 }
53
54
55 void play( SampleFrame* buffer ) override;
56 bool isFinished() const override;
57
58 bool isFromTrack( const Track * _track ) const override;
59
60 f_cnt_t totalFrames() const;
61 inline f_cnt_t framesDone() const
62 {
63 return( m_frame );
64 }
65 void setDoneMayReturnTrue( bool _enable )
66 {
67 m_doneMayReturnTrue = _enable;
68 }
69
71 {
72 m_patternTrack = pt;
73 }
74
75private:
78 Sample* m_sample = nullptr;
79 Track* m_track = nullptr;
82 bool m_ownAudioBusHandle = false;
83} ;
84
85
86} // namespace lmms
87
88#endif // LMMS_SAMPLE_PLAY_HANDLE_H
Definition PatternTrack.h:47
PlayHandle(const Type type, f_cnt_t offset=0)
Definition PlayHandle.cpp:36
Definition Sample.h:47
Definition SampleClip.h:46
Definition SampleFrame.h:41
Definition Sample.h:37
f_cnt_t framesDone() const
Definition SamplePlayHandle.h:61
bool m_ownAudioBusHandle
Definition SamplePlayHandle.h:82
Sample::PlaybackState m_state
Definition SamplePlayHandle.h:76
void setPatternTrack(PatternTrack *pt)
Definition SamplePlayHandle.h:70
SamplePlayHandle(Sample *sample, bool ownAudioBusHandle=true)
Definition SamplePlayHandle.cpp:36
bool affinityMatters() const override
Definition SamplePlayHandle.h:49
f_cnt_t m_frame
Definition SamplePlayHandle.h:77
bool m_doneMayReturnTrue
Definition SamplePlayHandle.h:81
PatternTrack * m_patternTrack
Definition SamplePlayHandle.h:80
void setDoneMayReturnTrue(bool _enable)
Definition SamplePlayHandle.h:65
Track * m_track
Definition SamplePlayHandle.h:79
Sample * m_sample
Definition SamplePlayHandle.h:78
Base-class for all tracks.
Definition Track.h:68
Definition AudioAlsa.cpp:35
std::uint64_t f_cnt_t
Definition LmmsTypes.h:43
signed int sample
Definition tap_dynamics_m.c:41