2
* instrument.h - declaration of class instrument, which provides a
3
* standard interface for all instrument plugins
5
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
7
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
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.
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.
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., 59 Temple Place - Suite 330,
22
* Boston, MA 02111-1307, USA.
36
#include "qt3support.h"
46
#include <qvaluevector.h>
55
// forward-declarations
60
class instrument : public QWidget, public plugin
63
instrument( channelTrack * _channel_track, const QString & _name );
64
virtual ~instrument();
66
// if the plugin doesn't play each note, it can create an instrument-
67
// play-handle and re-implement this method, so that it mixes it's
68
// output buffer only once per mixer-period
69
virtual void play( void );
71
// must be overloaded by actual plugin
72
virtual void FASTCALL playNote( notePlayHandle * note_to_play );
74
// needed for deleting plugin-specific-data of a note - plugin has to
75
// cast void-ptr so that the plugin-data is deleted properly
76
// (call of dtor if it's a class etc.)
77
virtual void FASTCALL deleteNotePluginData( notePlayHandle *
80
// Get number of sample-frames that should be used when playing beat
81
// (note with unspecified length)
82
// Per default this function returns 0. In this case, channel is using
83
// the length of the longest envelope (if one active).
84
virtual Uint32 FASTCALL beatLen( notePlayHandle * _n ) const;
87
// instrument-play-handles use this for checking whether they can mark
88
// themselves as done, so that mixer trashes them
89
inline virtual bool valid( void ) const
95
// instantiate instrument-plugin with given name or return NULL
97
static instrument * FASTCALL instantiate( const QString & _plugin_name,
98
channelTrack * _channel_track );
101
inline channelTrack * getChannelTrack( void ) const
103
return( m_channelTrack );
106
// instruments can use this for invalidating themselves, which is for
107
// example neccessary when being destroyed and having instrument-play-
109
inline void invalidate( void )
112
mixer::inst()->checkValidityOfPlayHandles();
117
channelTrack * m_channelTrack;