2
2
* channel_track.h - declaration of class channelTrack, a track-class which
3
3
* contains all information about a channel and provides
4
* a settings-window and an API for dealing with
5
* sound-generator-plugins
4
* a settings-window and an API for dealing with instruments
7
* Linux MultiMedia Studio
8
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
6
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
8
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
10
10
* This program is free software; you can redistribute it and/or
11
11
* modify it under the terms of the GNU General Public
59
60
class notePlayHandle;
62
class presetPreviewPlayHandle;
62
66
class surroundArea;
66
class channelTrack : public QWidget, public track, public midiDevice
71
class channelTrack : public QWidget, public track, public midiEventProcessor
70
75
channelTrack( trackContainer * _tc );
71
76
virtual ~channelTrack();
73
// used by sound-generator
74
void FASTCALL processAudioBuffer( sampleFrame * _ab, Uint32 _frames,
78
inline virtual trackTypes type( void ) const
80
return( m_trackType );
85
void FASTCALL processAudioBuffer( sampleFrame * _buf, Uint32 _frames,
75
86
notePlayHandle * _n );
88
virtual void FASTCALL processInEvent( const midiEvent & _me,
89
const midiTime & _time );
90
virtual void FASTCALL processOutEvent( const midiEvent & _me,
91
const midiTime & _time );
77
93
// returns the frequency of a given tone & octave.
78
94
// This function also includes base_tone & base_octave in
79
95
// its calculations
114
130
int FASTCALL masterKey( notePlayHandle * _n ) const;
132
// play everything in given frame-range - creates note-play-handles
116
133
virtual bool FASTCALL play( const midiTime & _start,
117
134
Uint32 _start_frame, Uint32 _frames,
118
135
Uint32 _frame_base,
119
136
Sint16 _tco_num = -1 );
120
inline virtual trackTypes trackType( void ) const
122
return( m_trackType );
137
// create new track-content-object = pattern
125
138
virtual trackContentObject * FASTCALL createTCO( const midiTime &
129
143
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
130
144
QDomElement & _parent );
131
145
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
133
void FASTCALL loadPluginSettings( const QDomElement &
136
QWidget * widgetStack( void )
148
// load instrument whose name matches given one
149
instrument * FASTCALL loadInstrument( const QString & _plugin_name );
151
// parent for all internal tab-widgets
152
QWidget * tabWidgetParent( void )
138
return( m_widgetStack );
154
return( m_tabWidget );
144
160
void surroundAreaPosChanged( const QPoint & _new_p );
145
161
void textChanged( const QString & _new_name );
146
162
void toggledChannelButton( bool _on );
147
void noteDone( const note & _n );
151
166
// capture close-events for toggling channel-button in track
152
void closeEvent( QCloseEvent * _ce );
153
void focusInEvent( QFocusEvent * _fe );
167
virtual void closeEvent( QCloseEvent * _ce );
168
virtual void focusInEvent( QFocusEvent * _fe );
169
virtual void dragEnterEvent( QDragEnterEvent * _dee );
170
virtual void dropEvent( QDropEvent * _de );
154
172
inline virtual QString nodeName( void ) const
156
174
return( "channeltrack" );
167
187
trackTypes m_trackType;
189
midiPort * m_midiPort;
191
audioPort * m_audioPort;
194
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
169
197
tones m_baseTone;
170
198
octaves m_baseOctave;
174
QWidget * m_generalSettingsWidget;
203
// widgets on the top of a channel-track-window
204
tabWidget * m_generalSettingsWidget;
175
205
QLineEdit * m_channelNameLE;
177
QWidget * m_widgetStack;
179
// widgets in widget-stack
180
soundGenerator * m_soundGenPluginWidget;
181
envelopeTabWidget * m_envWidget;
182
arpAndChordsTabWidget * m_arpWidget;
184
// buttons for selecting widgets in widget-stack
185
QPushButton * m_soundGenPluginBtn;
186
QPushButton * m_envBtn;
187
QPushButton * m_arpBtn;
189
// knobs etc. in general-settings-widget
190
206
knob * m_volumeKnob;
191
207
surroundArea * m_surroundArea;
192
208
lcdSpinBox * m_effectChannelNumber;
193
209
QPushButton * m_saveSettingsBtn;
212
// tab-widget with all children
213
tabWidget * m_tabWidget;
214
instrument * m_instrument;
215
envelopeTabWidget * m_envWidget;
216
arpAndChordsTabWidget * m_arpWidget;
217
midiTabWidget * m_midiWidget;
220
// test-piano at the bottom of every channel-settings-window
221
pianoWidget * m_pianoWidget;
195
224
// widgets in track-settings-widget
197
225
knob * m_tswVolumeKnob;
198
226
surroundArea * m_tswSurroundArea;
199
227
channelButton * m_tswChannelButton;
201
// test-piano at the bottom of every channel-settings-window
202
pianoWidget * m_pianoWidget;
230
friend class channelButton;
205
231
friend class notePlayHandle;
232
friend class presetPreviewPlayHandle;
209
void noteFromMidiDeviceDone( const note & _n );
236
void noteDone( const note & _n );
216
243
class channelButton : public QPushButton
219
channelButton( channelTrack * _channel_track ) :
220
QPushButton( _channel_track->getTrackSettingsWidget() ),
221
m_channelTrack( _channel_track )
225
virtual ~channelButton()
246
channelButton( channelTrack * _channel_track );
247
virtual ~channelButton();
231
virtual void drawButtonLabel( QPainter * _p )
233
QString pn = m_channelTrack->pluginName() + ":";
241
_p->setFont( pointSize<7>( _p->font() ) );
243
_p->setPen( QApplication::palette().buttonText().color() );
245
_p->setPen( QApplication::palette().color( QPalette::Normal,
246
QColorGroup::ButtonText ) );
248
_p->drawText( ( width() -
249
QFontMetrics( _p->font() ).width( pn ) ) / 2 +
250
extra, height() / 2 + extra, pn );
251
_p->setPen( QColor( 0, 0, 0 ) );
252
_p->drawText( ( width() -
253
QFontMetrics( _p->font() ).width( text() ) ) /
254
2 + extra, height() / 2 +
255
QFontMetrics( _p->font() ).height() + extra,
251
// since we want to draw a special label (instrument- and channel-name)
252
// on our button, we have to re-implement this for doing so
253
virtual void drawButtonLabel( QPainter * _p );
255
// allow drops on this button - we just forward them to channel-track
256
virtual void dragEnterEvent( QDragEnterEvent * _dee );
257
virtual void dropEvent( QDropEvent * _de );
260
261
channelTrack * m_channelTrack;