merged note's tone and octave-property into one key-property which makes us save calculations in a lot of places and also shrinks sizes of XML-files, renamed various note-related constants and enums to match current coding-style
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@806 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
51
ChangeLog
51
ChangeLog
@@ -1,3 +1,52 @@
|
||||
2008-03-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/core/ladspa_control.cpp:
|
||||
added missing break in switch which made a lot of messages appear in
|
||||
console when time-based knobs were used by LADSPA-plugins
|
||||
|
||||
* plugins/organic/organic.cpp:
|
||||
* plugins/organic/organic.h:
|
||||
* plugins/vibed/vibed.h:
|
||||
* plugins/vibed/vibed.cpp:
|
||||
* plugins/triple_oscillator/triple_oscillator.cpp:
|
||||
* plugins/audio_file_processor/audio_file_processor.cpp:
|
||||
* plugins/vestige/vestige.cpp:
|
||||
* plugins/vestige/vestige.h:
|
||||
* plugins/sf2_player/artwork.png:
|
||||
* plugins/midi_import/midi_import.cpp:
|
||||
* include/note.h:
|
||||
* include/mixer.h:
|
||||
* include/instrument_track.h:
|
||||
* include/sample_buffer.h:
|
||||
* include/fx_mixer.h:
|
||||
* include/piano.h:
|
||||
* include/volume.h:
|
||||
* include/midi_port.h:
|
||||
* include/panning.h:
|
||||
* src/midi/midi_client.cpp:
|
||||
* src/midi/midi_port.cpp:
|
||||
* src/midi/midi_alsa_seq.cpp:
|
||||
* src/lib/sample_buffer.cpp:
|
||||
* src/widgets/instrument_midi_io_view.cpp:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
* src/core/preset_preview_play_handle.cpp:
|
||||
* src/core/note_play_handle.cpp:
|
||||
* src/core/mixer.cpp:
|
||||
* src/core/piano_roll.cpp:
|
||||
* src/core/instrument_functions.cpp:
|
||||
* src/core/instrument_midi_io.cpp:
|
||||
* src/core/note.cpp:
|
||||
* src/core/piano.cpp:
|
||||
* src/core/fx_mixer.cpp:
|
||||
- merged note's tone and octave-property into one key-property which
|
||||
makes us save calculations in a lot of places and also shrinks
|
||||
sizes of XML-files
|
||||
- renamed various note-related constants and enums to match current
|
||||
coding-style
|
||||
|
||||
* data/themes/default/effect_plugin.png:
|
||||
improved effect-plugin-artwork made with Inkscape
|
||||
|
||||
2008-03-22 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* plugins/organic/organic.cpp:
|
||||
@@ -14,7 +63,6 @@
|
||||
* src/core/main.cpp:
|
||||
Just playing around with palette colors.
|
||||
|
||||
|
||||
2008-03-16 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* Makefile.am:
|
||||
@@ -178,7 +226,6 @@
|
||||
Can change this file to ignore more stuff. Reapply by running:
|
||||
svn -R propset svn:ignore -F .svnignore .
|
||||
|
||||
|
||||
2008-03-16 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/widgets/visualization_widget.cpp:
|
||||
|
||||
1
TODO
1
TODO
@@ -1,6 +1,5 @@
|
||||
- do not process effects when playing frozen patterns
|
||||
- select number of channels in export-project-dialog
|
||||
- MIDI over Ethernet support
|
||||
- try to make vestige-plugin-dlls relative
|
||||
- do song-editor-tempo-connection to vst-plugin inside remoteVSTPlugin
|
||||
- add/remove-steps button in bb-editor for adding/removing according number of steps to/from all patterns of visible beat/baseline
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "journalling_object.h"
|
||||
|
||||
|
||||
const int NUM_FX_CHANNELS = 64;
|
||||
const int NumFxChannels = 64;
|
||||
|
||||
class fader;
|
||||
class fxLine;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
fxChannel * m_fxChannels[NUM_FX_CHANNELS+1]; // +1 = master
|
||||
fxChannel * m_fxChannels[NumFxChannels+1]; // +1 = master
|
||||
|
||||
|
||||
friend class mixerWorkerThread;
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
fader * m_fader;
|
||||
} ;
|
||||
|
||||
fxChannelView m_fxChannelViews[NUM_FX_CHANNELS+1];
|
||||
fxChannelView m_fxChannelViews[NumFxChannels+1];
|
||||
|
||||
QWidget * m_fxRackArea;
|
||||
fxLine * m_currentFxLine;
|
||||
|
||||
@@ -169,7 +169,7 @@ private:
|
||||
midiPort * m_midiPort;
|
||||
audioPort m_audioPort;
|
||||
|
||||
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
|
||||
notePlayHandle * m_notes[NumKeys];
|
||||
|
||||
intModel m_baseNoteModel;
|
||||
|
||||
|
||||
@@ -47,16 +47,16 @@ class midiTime;
|
||||
class midiPort
|
||||
{
|
||||
public:
|
||||
enum modes
|
||||
enum Modes
|
||||
{
|
||||
DUMMY, // don't route any MIDI-events (default)
|
||||
INPUT, // from MIDI-client to MIDI-event-processor
|
||||
OUTPUT, // from MIDI-event-processor to MIDI-client
|
||||
DUPLEX // both directions
|
||||
Disabled, // don't route any MIDI-events (default)
|
||||
Input, // from MIDI-client to MIDI-event-processor
|
||||
Output, // from MIDI-event-processor to MIDI-client
|
||||
Duplex // both directions
|
||||
} ;
|
||||
|
||||
midiPort( midiClient * _mc, midiEventProcessor * _mep,
|
||||
const QString & _name, modes _mode = DUMMY );
|
||||
const QString & _name, Modes _mode = Disabled );
|
||||
~midiPort();
|
||||
|
||||
inline const QString & name( void ) const
|
||||
@@ -66,12 +66,12 @@ public:
|
||||
|
||||
void FASTCALL setName( const QString & _name );
|
||||
|
||||
inline modes mode( void ) const
|
||||
inline Modes mode( void ) const
|
||||
{
|
||||
return( m_mode );
|
||||
}
|
||||
|
||||
void FASTCALL setMode( modes _mode );
|
||||
void FASTCALL setMode( Modes _mode );
|
||||
|
||||
inline Sint8 inputChannel( void ) const
|
||||
{
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
midiClient * m_midiClient;
|
||||
midiEventProcessor * m_midiEventProcessor;
|
||||
QString m_name;
|
||||
modes m_mode;
|
||||
Modes m_mode;
|
||||
Sint8 m_inputChannel;
|
||||
Sint8 m_outputChannel;
|
||||
bool m_defaultVelocityForInEventsEnabled;
|
||||
|
||||
@@ -87,9 +87,9 @@ const Uint8 BYTES_PER_SURROUND_FRAME = sizeof( surroundSampleFrame );
|
||||
const float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;
|
||||
|
||||
|
||||
const float BASE_FREQ = 440.0f;
|
||||
const tones BASE_TONE = A;
|
||||
const octaves BASE_OCTAVE = OCTAVE_4;
|
||||
const float BaseFreq = 440.0f;
|
||||
const Keys BaseKey = Key_A;
|
||||
const Octaves BaseOctave = DefaultOctave;
|
||||
|
||||
|
||||
class mixerWorkerThread;
|
||||
|
||||
103
include/note.h
103
include/note.h
@@ -2,7 +2,7 @@
|
||||
* note.h - declaration of class note which contains all informations about a
|
||||
* note + definitions of several constants and enums
|
||||
*
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -37,45 +37,45 @@
|
||||
class detuningHelper;
|
||||
|
||||
|
||||
enum tones
|
||||
enum Keys
|
||||
{
|
||||
C = 0,
|
||||
CIS = 1, DES = 1,
|
||||
D = 2,
|
||||
DIS = 3, ES = 3,
|
||||
E = 4, FES = 4,
|
||||
F = 5,
|
||||
FIS = 6, GES = 6,
|
||||
G = 7,
|
||||
GIS = 8, AS = 8,
|
||||
A = 9,
|
||||
AIS = 10, B = 10,
|
||||
H = 11
|
||||
Key_C = 0,
|
||||
Key_CIS = 1, Key_DES = 1,
|
||||
Key_D = 2,
|
||||
Key_DIS = 3, Key_ES = 3,
|
||||
Key_E = 4, Key_FES = 4,
|
||||
Key_F = 5,
|
||||
Key_FIS = 6, Key_GES = 6,
|
||||
Key_G = 7,
|
||||
Key_GIS = 8, Key_AS = 8,
|
||||
Key_A = 9,
|
||||
Key_AIS = 10, Key_B = 10,
|
||||
Key_H = 11
|
||||
} ;
|
||||
|
||||
|
||||
enum octaves
|
||||
enum Octaves
|
||||
{
|
||||
OCTAVE_0,
|
||||
OCTAVE_1,
|
||||
OCTAVE_2,
|
||||
OCTAVE_3,
|
||||
OCTAVE_4, // default
|
||||
OCTAVE_5,
|
||||
OCTAVE_6,
|
||||
OCTAVE_7,
|
||||
OCTAVE_8
|
||||
Octave_0,
|
||||
Octave_1,
|
||||
Octave_2,
|
||||
Octave_3,
|
||||
Octave_4, DefaultOctave = Octave_4,
|
||||
Octave_5,
|
||||
Octave_6,
|
||||
Octave_7,
|
||||
Octave_8,
|
||||
NumOctaves
|
||||
} ;
|
||||
|
||||
const octaves DEFAULT_OCTAVE = OCTAVE_4;
|
||||
const octaves MIN_OCTAVE = OCTAVE_0;
|
||||
const octaves MAX_OCTAVE = OCTAVE_8;
|
||||
|
||||
const int WHITE_KEYS_PER_OCTAVE = 7;
|
||||
const int BLACK_KEYS_PER_OCTAVE = 5;
|
||||
const int NOTES_PER_OCTAVE = WHITE_KEYS_PER_OCTAVE + BLACK_KEYS_PER_OCTAVE;
|
||||
const int OCTAVES = MAX_OCTAVE+1;
|
||||
const int NOTES = OCTAVES*NOTES_PER_OCTAVE;
|
||||
const int WhiteKeysPerOctave = 7;
|
||||
const int BlackKeysPerOctave = 5;
|
||||
const int KeysPerOctave = WhiteKeysPerOctave + BlackKeysPerOctave;
|
||||
const int NumKeys = NumOctaves * KeysPerOctave;
|
||||
const int DefaultKey = DefaultOctave*KeysPerOctave + Key_A;
|
||||
|
||||
const float MaxDetuning = 4 * 12.0f;
|
||||
|
||||
|
||||
|
||||
@@ -84,21 +84,18 @@ class note : public journallingObject
|
||||
public:
|
||||
note( const midiTime & _length = 0,
|
||||
const midiTime & _pos = 0,
|
||||
tones _tone = A,
|
||||
octaves _octave = DEFAULT_OCTAVE,
|
||||
volume _volume = DEFAULT_VOLUME,
|
||||
panning _panning = DEFAULT_PANNING,
|
||||
int key = DefaultKey,
|
||||
volume _volume = DefaultVolume,
|
||||
panning _panning = DefaultPanning,
|
||||
detuningHelper * _detuning = NULL ) FASTCALL;
|
||||
note( const note & _note );
|
||||
virtual ~note();
|
||||
|
||||
void FASTCALL setLength( const midiTime & _length );
|
||||
void FASTCALL setPos( const midiTime & _pos );
|
||||
void FASTCALL setTone( const tones _tone = C );
|
||||
void FASTCALL setOctave( const octaves _octave = DEFAULT_OCTAVE );
|
||||
void FASTCALL setKey( const int _key );
|
||||
void FASTCALL setVolume( const volume _volume = DEFAULT_VOLUME );
|
||||
void FASTCALL setPanning( const panning _panning = DEFAULT_PANNING );
|
||||
void FASTCALL setVolume( const volume _volume = DefaultVolume );
|
||||
void FASTCALL setPanning( const panning _panning = DefaultPanning );
|
||||
void FASTCALL quantizeLength( const int _q_grid );
|
||||
void FASTCALL quantizePos( const int _q_grid );
|
||||
|
||||
@@ -122,19 +119,9 @@ public:
|
||||
return( m_pos - _base_pos );
|
||||
}
|
||||
|
||||
inline tones tone( void ) const
|
||||
{
|
||||
return( m_tone );
|
||||
}
|
||||
|
||||
inline octaves octave( void ) const
|
||||
{
|
||||
return( m_octave );
|
||||
}
|
||||
|
||||
inline int key( void ) const
|
||||
{
|
||||
return( m_octave * NOTES_PER_OCTAVE + m_tone );
|
||||
return( m_key );
|
||||
}
|
||||
|
||||
inline volume getVolume( void ) const
|
||||
@@ -180,17 +167,17 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
enum actions
|
||||
enum Actions
|
||||
{
|
||||
CHANGE_KEY, CHANGE_VOLUME, CHANGE_PANNING,
|
||||
CHANGE_LENGTH, CHANGE_POSITION
|
||||
ChangeKey,
|
||||
ChangeVolume,
|
||||
ChangePanning,
|
||||
ChangeLength,
|
||||
ChangePosition
|
||||
} ;
|
||||
|
||||
static const float MAX_DETUNING;
|
||||
|
||||
|
||||
tones m_tone;
|
||||
octaves m_octave;
|
||||
int m_key;
|
||||
volume m_volume;
|
||||
panning m_panning;
|
||||
midiTime m_length;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* panning.h - declaration of some constants and types, concerning the
|
||||
* panning of a note
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
const panning PANNING_RIGHT = ( 0 + 100);
|
||||
const panning PANNING_LEFT = - PANNING_RIGHT;
|
||||
const panning PANNING_CENTER = 0;
|
||||
const panning DEFAULT_PANNING = PANNING_CENTER;
|
||||
const panning PanningRight = ( 0 + 100);
|
||||
const panning PanningLeft = - PanningRight;
|
||||
const panning PanningCenter = 0;
|
||||
const panning DefaultPanning = PanningCenter;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
private:
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
|
||||
bool m_pressedKeys[NumKeys];
|
||||
|
||||
|
||||
friend class pianoView;
|
||||
@@ -104,9 +104,7 @@ private:
|
||||
piano * m_piano;
|
||||
|
||||
QScrollBar * m_pianoScroll;
|
||||
tones m_startTone; // first key when drawing
|
||||
octaves m_startOctave;
|
||||
|
||||
int m_startKey; // first key when drawing
|
||||
int m_lastKey;
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
bool FASTCALL play( sampleFrame * _ab, handleState * _state,
|
||||
const fpp_t _frames,
|
||||
const float _freq = BASE_FREQ,
|
||||
const float _freq = BaseFreq,
|
||||
const bool _looped = FALSE ) const;
|
||||
|
||||
void FASTCALL visualize( QPainter & _p, const QRect & _dr,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* volume.h - declaration of some constants and types, concerning the volume
|
||||
* of a note
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
const volume MIN_VOLUME = 0;
|
||||
const volume MAX_VOLUME = 200;
|
||||
const volume DEFAULT_VOLUME = 100;
|
||||
const volume MinVolume = 0;
|
||||
const volume MaxVolume = 200;
|
||||
const volume DefaultVolume = 100;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -205,7 +205,7 @@ QString audioFileProcessor::nodeName( void ) const
|
||||
|
||||
Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
|
||||
{
|
||||
const float freq_factor = BASE_FREQ / _n->frequency() *
|
||||
const float freq_factor = BaseFreq / _n->frequency() *
|
||||
engine::getMixer()->sampleRate() / DEFAULT_SAMPLE_RATE;
|
||||
|
||||
return( static_cast<Uint32>( floorf( ( m_sampleBuffer.endFrame() -
|
||||
|
||||
@@ -287,8 +287,8 @@ invalid_format:
|
||||
it->addTCO( p );
|
||||
|
||||
// init keys
|
||||
int keys[NOTES_PER_OCTAVE * OCTAVES][2];
|
||||
for( int j = 0; j < NOTES_PER_OCTAVE * OCTAVES; ++j )
|
||||
int keys[NumKeys][2];
|
||||
for( int j = 0; j < NumKeys; ++j )
|
||||
{
|
||||
keys[j][0] = -1;
|
||||
}
|
||||
@@ -302,8 +302,7 @@ invalid_format:
|
||||
switch( ev.m_type )
|
||||
{
|
||||
case NOTE_ON:
|
||||
if( ev.key() >=
|
||||
NOTES_PER_OCTAVE * OCTAVES )
|
||||
if( ev.key() >= NumKeys )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -316,15 +315,12 @@ invalid_format:
|
||||
}
|
||||
|
||||
case NOTE_OFF:
|
||||
if( ev.key() <
|
||||
NOTES_PER_OCTAVE * OCTAVES &&
|
||||
if( ev.key() < NumKeys &&
|
||||
keys[ev.key()][0] >= 0 )
|
||||
{
|
||||
note n( midiTime( ( ( tick - keys[ev.key()][0] ) * multiplier ) / divisor ),
|
||||
midiTime( ( keys[ev.key()][0] * multiplier ) / divisor ),
|
||||
(tones)( ev.key() % NOTES_PER_OCTAVE ),
|
||||
(octaves)( ev.key() / NOTES_PER_OCTAVE ),
|
||||
keys[ev.key()][1] * 100 / 128 );
|
||||
ev.key(), keys[ev.key()][1] * 100 / 128 );
|
||||
p->addNote( n, FALSE );
|
||||
keys[ev.key()][0] = -1;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ QPixmap * organicInstrumentView::s_artwork = NULL;
|
||||
organicInstrument::organicInstrument( instrumentTrack * _channel_track ) :
|
||||
instrument( _channel_track, &organic_plugin_descriptor ),
|
||||
m_modulationAlgo( oscillator::SignalMix ),
|
||||
m_fx1Knob( 0.0f, 0.0f, 0.99f, 0.01f , this ),
|
||||
m_volKnob( 100.0f, 0.0f, 200.0f, 1.0f, this )
|
||||
m_fx1Model( 0.0f, 0.0f, 0.99f, 0.01f , this ),
|
||||
m_volModel( 100.0f, 0.0f, 200.0f, 1.0f, this )
|
||||
{
|
||||
m_numOscillators = 8;
|
||||
|
||||
@@ -88,13 +88,13 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) :
|
||||
m_osc[i]->m_numOscillators = m_numOscillators;
|
||||
|
||||
// Connect events
|
||||
connect( &m_osc[i]->m_oscKnob, SIGNAL( dataChanged() ),
|
||||
connect( &m_osc[i]->m_oscModel, SIGNAL( dataChanged() ),
|
||||
m_osc[i], SLOT ( oscButtonChanged() ) );
|
||||
connect( &m_osc[i]->m_volKnob, SIGNAL( dataChanged() ),
|
||||
connect( &m_osc[i]->m_volModel, SIGNAL( dataChanged() ),
|
||||
m_osc[i], SLOT( updateVolume() ) );
|
||||
connect( &m_osc[i]->m_panKnob, SIGNAL( dataChanged() ),
|
||||
connect( &m_osc[i]->m_panModel, SIGNAL( dataChanged() ),
|
||||
m_osc[i], SLOT( updateVolume() ) );
|
||||
connect( &m_osc[i]->m_detuneKnob, SIGNAL( dataChanged() ),
|
||||
connect( &m_osc[i]->m_detuneModel, SIGNAL( dataChanged() ),
|
||||
m_osc[i], SLOT( updateDetuning() ) );
|
||||
|
||||
m_osc[i]->updateVolume();
|
||||
@@ -135,19 +135,19 @@ organicInstrument::~organicInstrument()
|
||||
void organicInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "num_osc", QString::number( m_numOscillators ) );
|
||||
m_fx1Knob.saveSettings( _doc, _this, "foldback" );
|
||||
m_volKnob.saveSettings( _doc, _this, "vol" );
|
||||
m_fx1Model.saveSettings( _doc, _this, "foldback" );
|
||||
m_volModel.saveSettings( _doc, _this, "vol" );
|
||||
|
||||
for( int i = 0; i < m_numOscillators; ++i )
|
||||
{
|
||||
QString is = QString::number( i );
|
||||
m_osc[i]->m_volKnob.saveSettings( _doc, _this, "vol" + is );
|
||||
m_osc[i]->m_panKnob.saveSettings( _doc, _this, "pan" + is );
|
||||
m_osc[i]->m_volModel.saveSettings( _doc, _this, "vol" + is );
|
||||
m_osc[i]->m_panModel.saveSettings( _doc, _this, "pan" + is );
|
||||
_this.setAttribute( "harmonic" + is, QString::number(
|
||||
powf( 2.0f, m_osc[i]->m_harmonic ) ) );
|
||||
m_osc[i]->m_detuneKnob.saveSettings( _doc, _this, "detune"
|
||||
m_osc[i]->m_detuneModel.saveSettings( _doc, _this, "detune"
|
||||
+ is );
|
||||
m_osc[i]->m_oscKnob.saveSettings( _doc, _this, "wavetype"
|
||||
m_osc[i]->m_oscModel.saveSettings( _doc, _this, "wavetype"
|
||||
+ is );
|
||||
}
|
||||
}
|
||||
@@ -163,14 +163,14 @@ void organicInstrument::loadSettings( const QDomElement & _this )
|
||||
for( int i = 0; i < m_numOscillators; ++i )
|
||||
{
|
||||
QString is = QString::number( i );
|
||||
m_osc[i]->m_volKnob.loadSettings( _this, "vol" + is );
|
||||
m_osc[i]->m_detuneKnob.loadSettings( _this, "detune" + is );
|
||||
m_osc[i]->m_panKnob.loadSettings( _this, "pan" + is );
|
||||
m_osc[i]->m_oscKnob.loadSettings( _this, "wavetype" + is );
|
||||
m_osc[i]->m_volModel.loadSettings( _this, "vol" + is );
|
||||
m_osc[i]->m_detuneModel.loadSettings( _this, "detune" + is );
|
||||
m_osc[i]->m_panModel.loadSettings( _this, "pan" + is );
|
||||
m_osc[i]->m_oscModel.loadSettings( _this, "wavetype" + is );
|
||||
}
|
||||
|
||||
m_volKnob.loadSettings( _this, "vol" );
|
||||
m_fx1Knob.loadSettings( _this, "foldback" );
|
||||
m_volModel.loadSettings( _this, "vol" );
|
||||
m_fx1Model.loadSettings( _this, "foldback" );
|
||||
}
|
||||
|
||||
|
||||
@@ -265,13 +265,13 @@ void organicInstrument::playNote( notePlayHandle * _n, bool )
|
||||
// -- fx section --
|
||||
|
||||
// fxKnob is [0;1]
|
||||
float t = m_fx1Knob.value();
|
||||
float t = m_fx1Model.value();
|
||||
|
||||
for (int i=0 ; i < frames ; i++)
|
||||
{
|
||||
buf[i][0] = waveshape( buf[i][0], t ) * m_volKnob.value()
|
||||
buf[i][0] = waveshape( buf[i][0], t ) * m_volModel.value()
|
||||
/ 100.0f;
|
||||
buf[i][1] = waveshape( buf[i][1], t ) * m_volKnob.value()
|
||||
buf[i][1] = waveshape( buf[i][1], t ) * m_volModel.value()
|
||||
/ 100.0f;
|
||||
}
|
||||
|
||||
@@ -322,15 +322,13 @@ void organicInstrument::randomiseSettings( void )
|
||||
|
||||
for( int i = 0; i < m_numOscillators; i++ )
|
||||
{
|
||||
m_osc[i]->m_volKnob.setValue( intRand( 0, 100 ) );
|
||||
m_osc[i]->m_volModel.setValue( intRand( 0, 100 ) );
|
||||
|
||||
m_osc[i]->m_detuneKnob.setValue( intRand( -5, 5 ) );
|
||||
m_osc[i]->m_detuneModel.setValue( intRand( -5, 5 ) );
|
||||
|
||||
m_osc[i]->m_panKnob.setValue(
|
||||
//(int)gaussRand(PANNING_LEFT, PANNING_RIGHT,1,0)
|
||||
0 );
|
||||
m_osc[i]->m_panModel.setValue( 0 );
|
||||
|
||||
m_osc[i]->m_oscKnob.setValue( intRand( 0, 5 ) );
|
||||
m_osc[i]->m_oscModel.setValue( intRand( 0, 5 ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -421,8 +419,8 @@ void organicInstrumentView::modelChanged( void )
|
||||
|
||||
m_numOscillators = oi->m_numOscillators;
|
||||
|
||||
m_fx1Knob->setModel( &oi->m_fx1Knob );
|
||||
m_volKnob->setModel( &oi->m_volKnob );
|
||||
m_fx1Knob->setModel( &oi->m_fx1Model );
|
||||
m_volKnob->setModel( &oi->m_volModel );
|
||||
|
||||
// TODO: Delete existing oscKnobs if they exist
|
||||
|
||||
@@ -465,30 +463,26 @@ void organicInstrumentView::modelChanged( void )
|
||||
|
||||
// Attach to models
|
||||
m_oscKnobs[i].m_volKnob->setModel(
|
||||
&oi->m_osc[i]->m_volKnob );
|
||||
&oi->m_osc[i]->m_volModel );
|
||||
m_oscKnobs[i].m_oscKnob->setModel(
|
||||
&oi->m_osc[i]->m_oscKnob );
|
||||
&oi->m_osc[i]->m_oscModel );
|
||||
m_oscKnobs[i].m_panKnob->setModel(
|
||||
&oi->m_osc[i]->m_panKnob );
|
||||
&oi->m_osc[i]->m_panModel );
|
||||
m_oscKnobs[i].m_detuneKnob->setModel(
|
||||
&oi->m_osc[i]->m_detuneKnob );
|
||||
|
||||
|
||||
/*connect( m_oscKnobs[i].m_userWaveButton,
|
||||
SIGNAL( doubleClicked() ),
|
||||
t->m_osc[i], SLOT( oscUserDefWaveDblClick() ) );
|
||||
*/
|
||||
&oi->m_osc[i]->m_detuneModel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
oscillatorObject::oscillatorObject( model * _parent, track * _track ) :
|
||||
model( _parent ),
|
||||
m_waveShape( oscillator::SineWave, 0, oscillator::NumWaveShapes-1, 1, this ),
|
||||
m_oscKnob( 0.0f, 0.0f, 5.0f, 1.0f, this ),
|
||||
m_volKnob( 100.0f, 0.0f, 100.0f, 1.0f, this ),
|
||||
m_panKnob( DEFAULT_PANNING, PANNING_LEFT, PANNING_RIGHT, 1.0f, this ),
|
||||
m_detuneKnob( 0.0f, -100.0f, 100.0f, 1.0f, this )
|
||||
m_oscModel( 0.0f, 0.0f, 5.0f, 1.0f, this ),
|
||||
m_volModel( 100.0f, 0.0f, 100.0f, 1.0f, this ),
|
||||
m_panModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this ),
|
||||
m_detuneModel( 0.0f, -100.0f, 100.0f, 1.0f, this )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -515,7 +509,7 @@ void oscillatorObject::oscButtonChanged( void )
|
||||
oscillator::ExponentialWave
|
||||
} ;
|
||||
|
||||
m_waveShape.setValue( shapes[(int)roundf( m_oscKnob.value() )] );
|
||||
m_waveShape.setValue( shapes[(int)roundf( m_oscModel.value() )] );
|
||||
|
||||
}
|
||||
|
||||
@@ -524,10 +518,10 @@ void oscillatorObject::oscButtonChanged( void )
|
||||
|
||||
void oscillatorObject::updateVolume( void )
|
||||
{
|
||||
m_volumeLeft = ( 1.0f - m_panKnob.value() / (float)PANNING_RIGHT )
|
||||
* m_volKnob.value() / m_numOscillators / 100.0f;
|
||||
m_volumeRight = ( 1.0f + m_panKnob.value() / (float)PANNING_RIGHT )
|
||||
* m_volKnob.value() / m_numOscillators / 100.0f;
|
||||
m_volumeLeft = ( 1.0f - m_panModel.value() / (float)PanningRight )
|
||||
* m_volModel.value() / m_numOscillators / 100.0f;
|
||||
m_volumeRight = ( 1.0f + m_panModel.value() / (float)PanningRight )
|
||||
* m_volModel.value() / m_numOscillators / 100.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -536,10 +530,10 @@ void oscillatorObject::updateVolume( void )
|
||||
void oscillatorObject::updateDetuning( void )
|
||||
{
|
||||
m_detuningLeft = powf( 2.0f, m_harmonic
|
||||
+ (float)m_detuneKnob.value() / 100.0f )
|
||||
+ (float)m_detuneModel.value() / 100.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
m_detuningRight = powf( 2.0f, m_harmonic
|
||||
- (float)m_detuneKnob.value() / 100.0f )
|
||||
- (float)m_detuneModel.value() / 100.0f )
|
||||
/ engine::getMixer()->sampleRate();
|
||||
}
|
||||
|
||||
@@ -564,7 +558,7 @@ plugin * lmms_plugin_main( model *, void * _data )
|
||||
* - 32.692 Hz in the bass to 5919.85 Hz of treble in a Hammond organ
|
||||
* => implement harmonic foldback
|
||||
*
|
||||
m_osc[i].m_oscKnob->setInitValue( 0.0f );
|
||||
m_osc[i].m_oscModel->setInitValue( 0.0f );
|
||||
* - randomize preset
|
||||
*/
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ class oscillatorObject : public model
|
||||
private:
|
||||
int m_numOscillators;
|
||||
intModel m_waveShape;
|
||||
floatModel m_oscKnob;
|
||||
floatModel m_volKnob;
|
||||
floatModel m_panKnob;
|
||||
floatModel m_detuneKnob;
|
||||
floatModel m_oscModel;
|
||||
floatModel m_volModel;
|
||||
floatModel m_panModel;
|
||||
floatModel m_detuneModel;
|
||||
|
||||
float m_harmonic;
|
||||
float m_volumeLeft;
|
||||
@@ -123,8 +123,8 @@ private:
|
||||
|
||||
const intModel m_modulationAlgo;
|
||||
|
||||
floatModel m_fx1Knob;
|
||||
floatModel m_volKnob;
|
||||
floatModel m_fx1Model;
|
||||
floatModel m_volModel;
|
||||
|
||||
virtual pluginView * instantiateView( QWidget * _parent );
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ plugin::descriptor tripleoscillator_plugin_descriptor =
|
||||
|
||||
oscillatorObject::oscillatorObject( model * _parent, track * _track ) :
|
||||
model( _parent ),
|
||||
m_volumeModel( DEFAULT_VOLUME / NUM_OF_OSCILLATORS,
|
||||
MIN_VOLUME, MAX_VOLUME, 1.0f, this ),
|
||||
m_panModel( DEFAULT_PANNING, PANNING_LEFT, PANNING_RIGHT, 1.0f, this ),
|
||||
m_coarseModel( 0, -2 * NOTES_PER_OCTAVE, 2 * NOTES_PER_OCTAVE,
|
||||
m_volumeModel( DefaultVolume / NUM_OF_OSCILLATORS,
|
||||
MinVolume, MaxVolume, 1.0f, this ),
|
||||
m_panModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this ),
|
||||
m_coarseModel( 0, -2 * KeysPerOctave, 2 * KeysPerOctave,
|
||||
1.0f, this ),
|
||||
m_fineLeftModel( 0.0f, -100.0f, 100.0f, 1.0f, this ),
|
||||
m_fineRightModel( 0.0f, -100.0f, 100.0f, 1.0f, this ),
|
||||
@@ -159,7 +159,7 @@ void oscillatorObject::updateVolume( void )
|
||||
if( m_panModel.value() >= 0.0f )
|
||||
{
|
||||
const float panningFactorLeft = 1.0f - m_panModel.value()
|
||||
/ (float)PANNING_RIGHT;
|
||||
/ (float)PanningRight;
|
||||
m_volumeLeft = panningFactorLeft * m_volumeModel.value() /
|
||||
100.0f;
|
||||
m_volumeRight = m_volumeModel.value() / 100.0f;
|
||||
@@ -168,7 +168,7 @@ void oscillatorObject::updateVolume( void )
|
||||
{
|
||||
m_volumeLeft = m_volumeModel.value() / 100.0f;
|
||||
const float panningFactorRight = 1.0f + m_panModel.value()
|
||||
/ (float)PANNING_RIGHT;
|
||||
/ (float)PanningRight;
|
||||
m_volumeRight = panningFactorRight * m_volumeModel.value() /
|
||||
100.0f;
|
||||
}
|
||||
@@ -768,9 +768,6 @@ tripleOscillatorView::tripleOscillatorView( instrument * _instrument,
|
||||
wsbg->addButton( white_noise_btn );
|
||||
wsbg->addButton( uwb );
|
||||
|
||||
/* connect( m_osc[i].m_usrWaveBtn, SIGNAL( doubleClicked() ),
|
||||
&m_osc[i], SLOT( oscUserDefWaveDblClick() ) );*/
|
||||
|
||||
m_oscKnobs[i] = oscillatorKnobs( vk, pk, ck, flk, frk, pok,
|
||||
spdk, uwb, wsbg );
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ vestigeInstrument::vestigeInstrument( instrumentTrack * _instrument_track ) :
|
||||
m_plugin( NULL ),
|
||||
m_pluginMutex()
|
||||
{
|
||||
for( int i = 0; i < NOTES; ++i )
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_runningNotes[i] = 0;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ void vestigeInstrumentView::noteOffAll( void )
|
||||
m_vi->m_pluginMutex.lock();
|
||||
if( m_vi->m_plugin != NULL )
|
||||
{
|
||||
for( int key = 0; key < OCTAVES * NOTES_PER_OCTAVE; ++key )
|
||||
for( int key = 0; key < NumKeys; ++key )
|
||||
{
|
||||
m_vi->m_plugin->enqueueMidiEvent( midiEvent( NOTE_OFF, 0,
|
||||
key, 0 ), 0 );
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
private:
|
||||
void closePlugin( void );
|
||||
|
||||
int m_runningNotes[NOTES];
|
||||
int m_runningNotes[NumKeys];
|
||||
|
||||
|
||||
remoteVSTPlugin * m_plugin;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* vibed.cpp - combination of PluckedStringSynth and BitInvader
|
||||
*
|
||||
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/yahoo/com>
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/yahoo/com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -77,7 +77,8 @@ vibed::vibed( instrumentTrack * instrument_track ) :
|
||||
|
||||
for( Uint8 harm = 0; harm < 9; harm++ )
|
||||
{
|
||||
knob = new knobModel( DEFAULT_VOLUME, MIN_VOLUME, MAX_VOLUME, 1.0f, this );
|
||||
knob = new knobModel( DefaultVolume, MinVolume, MaxVolume,
|
||||
1.0f, this );
|
||||
m_volumeKnobs.append( knob );
|
||||
|
||||
knob = new knobModel( 0.0f, 0.0f, 0.05f, 0.001f, this );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* vibed_strings.h -
|
||||
/*
|
||||
* vibed.h - combination of PluckedStringSynth and BitInvader
|
||||
*
|
||||
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/yahoo/com>
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/yahoo/com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
|
||||
@@ -84,7 +84,7 @@ fxMixer::fxMixer() :
|
||||
journallingObject(),
|
||||
model( NULL )
|
||||
{
|
||||
for( int i = 0; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
m_fxChannels[i] = new fxChannel( this );
|
||||
}
|
||||
@@ -97,7 +97,7 @@ fxMixer::fxMixer() :
|
||||
|
||||
fxMixer::~fxMixer()
|
||||
{
|
||||
for( int i = 0; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
delete m_fxChannels[i];
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void fxMixer::prepareMasterMix( void )
|
||||
const surroundSampleFrame * fxMixer::masterMix( void )
|
||||
{
|
||||
surroundSampleFrame * buf = m_fxChannels[0]->m_buffer;
|
||||
for( int i = 1; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 1; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
if( m_fxChannels[i]->m_used )
|
||||
{
|
||||
@@ -192,7 +192,7 @@ const surroundSampleFrame * fxMixer::masterMix( void )
|
||||
|
||||
void fxMixer::clear()
|
||||
{
|
||||
for( int i = 0; i <= NUM_FX_CHANNELS; ++i )
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
m_fxChannels[i]->m_fxChain.clear();
|
||||
m_fxChannels[i]->m_volumeModel.setValue( 1.0f );
|
||||
@@ -207,14 +207,14 @@ void fxMixer::clear()
|
||||
|
||||
void fxMixer::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
for( int i = 0; i <= NUM_FX_CHANNELS; ++i )
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
QDomElement fxch = _doc.createElement(
|
||||
QString( "fxchannel%1" ).arg( i ) );
|
||||
QDomElement fxch = _doc.createElement( QString( "fxchannel" ) );
|
||||
_this.appendChild( fxch );
|
||||
m_fxChannels[i]->m_fxChain.saveState( _doc, fxch );
|
||||
m_fxChannels[i]->m_volumeModel.saveSettings( _doc, fxch,
|
||||
"volume" );
|
||||
fxch.setAttribute( "num", i );
|
||||
fxch.setAttribute( "name", m_fxChannels[i]->m_name );
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void fxMixer::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void fxMixer::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
clear();
|
||||
for( int i = 0; i <= NUM_FX_CHANNELS; ++i )
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
QDomElement fxch = _this.firstChildElement(
|
||||
QString( "fxchannel%1" ).arg( i ) );
|
||||
@@ -341,7 +341,7 @@ fxMixerView::fxMixerView() :
|
||||
bl->setMargin( 0 );
|
||||
a->setWidget( base );
|
||||
|
||||
base->setFixedSize( (NUM_FX_CHANNELS+1)*33+6+10, 200 );
|
||||
base->setFixedSize( (NumFxChannels+1)*33+6+10, 200 );
|
||||
pal = base->palette();
|
||||
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
|
||||
base->setPalette( pal );
|
||||
@@ -359,7 +359,7 @@ fxMixerView::fxMixerView() :
|
||||
|
||||
bl->addSpacing( 6 );
|
||||
|
||||
for( int i = 0; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
fxChannelView * cv = &m_fxChannelViews[i];
|
||||
cv->m_fxLine = new fxLine( base, this,
|
||||
@@ -406,7 +406,7 @@ fxMixerView::~fxMixerView()
|
||||
void fxMixerView::setCurrentFxLine( fxLine * _line )
|
||||
{
|
||||
m_currentFxLine = _line;
|
||||
for( int i = 0; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
if( m_fxChannelViews[i].m_fxLine == _line )
|
||||
{
|
||||
@@ -425,7 +425,7 @@ void fxMixerView::setCurrentFxLine( fxLine * _line )
|
||||
|
||||
void fxMixerView::clear( void )
|
||||
{
|
||||
for( int i = 0; i <= NUM_FX_CHANNELS; ++i )
|
||||
for( int i = 0; i <= NumFxChannels; ++i )
|
||||
{
|
||||
m_fxChannelViews[i].m_rackView->clear();
|
||||
}
|
||||
@@ -437,7 +437,7 @@ void fxMixerView::clear( void )
|
||||
void fxMixerView::updateFaders( void )
|
||||
{
|
||||
fxMixer * m = engine::getFxMixer();
|
||||
for( int i = 0; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
const float opl = m_fxChannelViews[i].m_fader->getPeak_L();
|
||||
const float opr = m_fxChannelViews[i].m_fader->getPeak_R();
|
||||
|
||||
@@ -217,7 +217,7 @@ void chordCreator::processNote( notePlayHandle * _n )
|
||||
octave_cnt < m_chordRangeModel.value(); ++octave_cnt )
|
||||
{
|
||||
const int sub_note_key_base = base_note_key +
|
||||
octave_cnt * NOTES_PER_OCTAVE;
|
||||
octave_cnt * KeysPerOctave;
|
||||
// if octave_cnt == 1 we're in the first octave and
|
||||
// the base-note is already done, so we don't have to
|
||||
// create it in the following loop, then we loop until
|
||||
@@ -232,16 +232,12 @@ void chordCreator::processNote( notePlayHandle * _n )
|
||||
selected_chord].interval[i];
|
||||
// maybe we're out of range -> let's get outta
|
||||
// here!
|
||||
if( sub_note_key > NOTES_PER_OCTAVE*OCTAVES )
|
||||
if( sub_note_key > NumKeys )
|
||||
{
|
||||
break;
|
||||
}
|
||||
// create copy of base-note
|
||||
note note_copy( _n->length(), 0,
|
||||
(tones)( sub_note_key %
|
||||
NOTES_PER_OCTAVE ),
|
||||
(octaves)( sub_note_key /
|
||||
NOTES_PER_OCTAVE ),
|
||||
note note_copy( _n->length(), 0, sub_note_key,
|
||||
_n->getVolume(),
|
||||
_n->getPanning(),
|
||||
_n->detuning() );
|
||||
@@ -447,12 +443,12 @@ void arpeggiator::processNote( notePlayHandle * _n )
|
||||
// now calculate final key for our arp-note
|
||||
const int sub_note_key = base_note_key + (cur_arp_idx /
|
||||
cur_chord_size ) *
|
||||
NOTES_PER_OCTAVE +
|
||||
KeysPerOctave +
|
||||
chordCreator::s_chordTable[selected_arp].
|
||||
interval[cur_arp_idx % cur_chord_size];
|
||||
|
||||
// range-checking
|
||||
if( sub_note_key >= NOTES_PER_OCTAVE * OCTAVES ||
|
||||
if( sub_note_key >= NumKeys ||
|
||||
sub_note_key < 0 ||
|
||||
engine::getMixer()->criticalXRuns() )
|
||||
{
|
||||
@@ -467,10 +463,7 @@ void arpeggiator::processNote( notePlayHandle * _n )
|
||||
|
||||
// create new arp-note
|
||||
note new_note( midiTime( 0 ), midiTime( 0 ),
|
||||
static_cast<tones>( sub_note_key %
|
||||
NOTES_PER_OCTAVE ),
|
||||
static_cast<octaves>( sub_note_key /
|
||||
NOTES_PER_OCTAVE ),
|
||||
sub_note_key,
|
||||
static_cast<volume>( _n->getVolume() *
|
||||
vol_level ),
|
||||
_n->getPanning(), _n->detuning() );
|
||||
|
||||
@@ -77,11 +77,11 @@ instrumentMidiIO::instrumentMidiIO( instrumentTrack * _instrument_track,
|
||||
updateOutputChannel();
|
||||
|
||||
|
||||
const midiPort::modes m = m_midiPort->mode();
|
||||
m_receiveEnabledModel.setValue( m == midiPort::INPUT ||
|
||||
m == midiPort::DUPLEX );
|
||||
m_sendEnabledModel.setValue( m == midiPort::OUTPUT ||
|
||||
m == midiPort::DUPLEX );
|
||||
const midiPort::Modes m = m_midiPort->mode();
|
||||
m_receiveEnabledModel.setValue( m == midiPort::Input ||
|
||||
m == midiPort::Duplex );
|
||||
m_sendEnabledModel.setValue( m == midiPort::Output ||
|
||||
m == midiPort::Duplex );
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
@@ -240,10 +240,10 @@ void instrumentMidiIO::updateDefaultVelOut( void )
|
||||
void instrumentMidiIO::updateMidiPortMode( void )
|
||||
{
|
||||
// this small lookup-table makes everything easier
|
||||
static const midiPort::modes modeTable[2][2] =
|
||||
static const midiPort::Modes modeTable[2][2] =
|
||||
{
|
||||
{ midiPort::DUMMY, midiPort::OUTPUT },
|
||||
{ midiPort::INPUT, midiPort::DUPLEX }
|
||||
{ midiPort::Disabled, midiPort::Output },
|
||||
{ midiPort::Input, midiPort::Duplex }
|
||||
} ;
|
||||
m_midiPort->setMode( modeTable[m_receiveEnabledModel.value()]
|
||||
[m_sendEnabledModel.value()] );
|
||||
@@ -341,8 +341,8 @@ void instrumentMidiIO::activatedReadablePort(
|
||||
{
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _port.second == TRUE &&
|
||||
m_midiPort->mode() != midiPort::INPUT &&
|
||||
m_midiPort->mode() != midiPort::DUPLEX )
|
||||
m_midiPort->mode() != midiPort::Input &&
|
||||
m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
@@ -358,8 +358,8 @@ void instrumentMidiIO::activatedWriteablePort(
|
||||
{
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _port.second == TRUE &&
|
||||
m_midiPort->mode() != midiPort::OUTPUT &&
|
||||
m_midiPort->mode() != midiPort::DUPLEX )
|
||||
m_midiPort->mode() != midiPort::Output &&
|
||||
m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
m_sendEnabledModel.setValue( TRUE );
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ if( COND_NPH )
|
||||
}
|
||||
}
|
||||
}
|
||||
for( int i = 1; i < NUM_FX_CHANNELS+1; ++i )
|
||||
for( int i = 1; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
engine::getFxMixer()->processChannel( i );
|
||||
}
|
||||
|
||||
@@ -35,29 +35,21 @@
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
const float note::MAX_DETUNING = 4 * 12.0f;
|
||||
|
||||
|
||||
|
||||
|
||||
note::note( const midiTime & _length, const midiTime & _pos,
|
||||
tones _tone, octaves _octave, volume _volume,
|
||||
panning _panning, detuningHelper * _detuning ) :
|
||||
m_tone( C ),
|
||||
m_octave( DEFAULT_OCTAVE ),
|
||||
m_volume( DEFAULT_VOLUME ),
|
||||
m_panning( DEFAULT_PANNING ),
|
||||
int _key, volume _volume, panning _panning,
|
||||
detuningHelper * _detuning ) :
|
||||
m_key( tLimit( _key, 0, NumKeys ) ),
|
||||
m_volume( tLimit( _volume, MinVolume, MaxVolume ) ),
|
||||
m_panning( tLimit( _panning, PanningLeft, PanningRight ) ),
|
||||
m_length( _length ),
|
||||
m_pos( _pos )
|
||||
{
|
||||
//saveJournallingState( FALSE );
|
||||
setJournalling( FALSE );
|
||||
|
||||
setTone( _tone );
|
||||
setOctave( _octave );
|
||||
setVolume( _volume );
|
||||
setPanning( _panning );
|
||||
|
||||
if( _detuning )
|
||||
{
|
||||
m_detuning = sharedObject::ref( _detuning );
|
||||
@@ -74,8 +66,7 @@ note::note( const midiTime & _length, const midiTime & _pos,
|
||||
|
||||
note::note( const note & _note ) :
|
||||
journallingObject( _note ),
|
||||
m_tone( _note.m_tone ),
|
||||
m_octave( _note.m_octave ),
|
||||
m_key( _note.m_key),
|
||||
m_volume( _note.m_volume ),
|
||||
m_panning( _note.m_panning ),
|
||||
m_length( _note.m_length ),
|
||||
@@ -97,7 +88,7 @@ note::~note()
|
||||
|
||||
void note::setLength( const midiTime & _length )
|
||||
{
|
||||
addJournalEntry( journalEntry( CHANGE_LENGTH, m_length - _length ) );
|
||||
addJournalEntry( journalEntry( ChangeLength, m_length - _length ) );
|
||||
m_length = _length;
|
||||
}
|
||||
|
||||
@@ -106,42 +97,18 @@ void note::setLength( const midiTime & _length )
|
||||
|
||||
void note::setPos( const midiTime & _pos )
|
||||
{
|
||||
addJournalEntry( journalEntry( CHANGE_POSITION, m_pos - _pos ) );
|
||||
addJournalEntry( journalEntry( ChangePosition, m_pos - _pos ) );
|
||||
m_pos = _pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void note::setTone( const tones _tone )
|
||||
{
|
||||
const tones t = tLimit( _tone, C, H );
|
||||
addJournalEntry( journalEntry( CHANGE_KEY, (int) m_tone - t ) );
|
||||
m_tone = t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void note::setOctave( const octaves _octave )
|
||||
{
|
||||
const octaves o = tLimit( _octave, MIN_OCTAVE, MAX_OCTAVE );
|
||||
addJournalEntry( journalEntry( CHANGE_KEY, NOTES_PER_OCTAVE *
|
||||
( (int) m_octave - o ) ) );
|
||||
m_octave = o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void note::setKey( const int _key )
|
||||
{
|
||||
const int k = key();
|
||||
saveJournallingState( FALSE );
|
||||
setTone( static_cast<tones>( _key % NOTES_PER_OCTAVE ) );
|
||||
setOctave( static_cast<octaves>( _key / NOTES_PER_OCTAVE ) );
|
||||
restoreJournallingState();
|
||||
addJournalEntry( journalEntry( CHANGE_KEY, k - key() ) );
|
||||
const int k = tLimit( _key, 0, NumKeys );
|
||||
addJournalEntry( journalEntry( ChangeKey, m_key - k ) );
|
||||
m_key = k;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,8 +116,8 @@ void note::setKey( const int _key )
|
||||
|
||||
void note::setVolume( const volume _volume )
|
||||
{
|
||||
const volume v = tMin( _volume, MAX_VOLUME );
|
||||
addJournalEntry( journalEntry( CHANGE_VOLUME, (int) m_volume - v ) );
|
||||
const volume v = tLimit( _volume, MinVolume, MaxVolume );
|
||||
addJournalEntry( journalEntry( ChangeVolume, (int) m_volume - v ) );
|
||||
m_volume = v;
|
||||
}
|
||||
|
||||
@@ -159,8 +126,8 @@ void note::setVolume( const volume _volume )
|
||||
|
||||
void note::setPanning( const panning _panning )
|
||||
{
|
||||
const panning p = tLimit( _panning, PANNING_LEFT, PANNING_RIGHT );
|
||||
addJournalEntry( journalEntry( CHANGE_PANNING, (int) m_panning - p ) );
|
||||
const panning p = tLimit( _panning, PanningLeft, PanningRight );
|
||||
addJournalEntry( journalEntry( ChangePanning, (int) m_panning - p ) );
|
||||
m_panning = p;
|
||||
}
|
||||
|
||||
@@ -202,8 +169,7 @@ void note::quantizePos( const int _q_grid )
|
||||
|
||||
void note::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "tone", m_tone );
|
||||
_this.setAttribute( "oct", m_octave );
|
||||
_this.setAttribute( "key", m_key );
|
||||
_this.setAttribute( "vol", m_volume );
|
||||
_this.setAttribute( "pan", m_panning );
|
||||
_this.setAttribute( "len", m_length );
|
||||
@@ -219,8 +185,9 @@ void note::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
void note::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_tone = static_cast<tones>( _this.attribute( "tone" ).toInt() );
|
||||
m_octave = static_cast<octaves>( _this.attribute( "oct" ).toInt() );
|
||||
const int old_key = _this.attribute( "tone" ).toInt() +
|
||||
_this.attribute( "oct" ).toInt() * KeysPerOctave;
|
||||
m_key = qMax( old_key, _this.attribute( "key" ).toInt() );
|
||||
m_volume = _this.attribute( "vol" ).toInt();
|
||||
m_panning = _this.attribute( "pan" ).toInt();
|
||||
m_length = _this.attribute( "len" ).toInt();
|
||||
@@ -234,25 +201,25 @@ void note::loadSettings( const QDomElement & _this )
|
||||
void note::undoStep( journalEntry & _je )
|
||||
{
|
||||
saveJournallingState( FALSE );
|
||||
switch( static_cast<actions>( _je.actionID() ) )
|
||||
switch( static_cast<Actions>( _je.actionID() ) )
|
||||
{
|
||||
case CHANGE_KEY:
|
||||
case ChangeKey:
|
||||
setKey( key() - _je.data().toInt() );
|
||||
break;
|
||||
|
||||
case CHANGE_VOLUME:
|
||||
case ChangeVolume:
|
||||
setVolume( getVolume() - _je.data().toInt() );
|
||||
break;
|
||||
|
||||
case CHANGE_PANNING:
|
||||
case ChangePanning:
|
||||
setVolume( getPanning() - _je.data().toInt() );
|
||||
break;
|
||||
|
||||
case CHANGE_LENGTH:
|
||||
case ChangeLength:
|
||||
setLength( length() - _je.data().toInt() );
|
||||
break;
|
||||
|
||||
case CHANGE_POSITION:
|
||||
case ChangePosition:
|
||||
setPos( pos() - _je.data().toInt() );
|
||||
break;
|
||||
}
|
||||
@@ -283,7 +250,7 @@ void note::createDetuning( void )
|
||||
{
|
||||
m_detuning = new detuningHelper;
|
||||
m_detuning->initAutomationPattern();
|
||||
m_detuning->setRange( -MAX_DETUNING, MAX_DETUNING, 0.1f );
|
||||
m_detuning->setRange( -MaxDetuning, MaxDetuning, 0.1f );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
|
||||
notePlayHandle * _parent,
|
||||
const bool _arp_note ) :
|
||||
playHandle( NotePlayHandle, _offset ),
|
||||
note( _n.length(), _n.pos(), _n.tone(), _n.octave(),
|
||||
note( _n.length(), _n.pos(), _n.key(),
|
||||
_n.getVolume(), _n.getPanning(), _n.detuning() ),
|
||||
m_pluginData( NULL ),
|
||||
m_filter( NULL ),
|
||||
@@ -437,14 +437,14 @@ bool notePlayHandle::operator==( const notePlayHandle & _nph ) const
|
||||
void notePlayHandle::updateFrequency( void )
|
||||
{
|
||||
const int base_tone = m_instrumentTrack->baseNoteModel()->value() %
|
||||
NOTES_PER_OCTAVE;
|
||||
KeysPerOctave;
|
||||
const int base_octave = m_instrumentTrack->baseNoteModel()->value() /
|
||||
NOTES_PER_OCTAVE;
|
||||
const float pitch = (float)( tone() - base_tone +
|
||||
KeysPerOctave;
|
||||
const float pitch = (float)( key() % KeysPerOctave - base_tone +
|
||||
engine::getSong()->masterPitch() ) / 12.0f +
|
||||
(float)( octave() - base_octave ) +
|
||||
(float)( key() / KeysPerOctave - base_octave ) +
|
||||
m_base_detuning->value() / 12.0f;
|
||||
m_frequency = BASE_FREQ * powf( 2.0f, pitch );
|
||||
m_frequency = BaseFreq * powf( 2.0f, pitch );
|
||||
|
||||
for( notePlayHandleVector::iterator it = m_subNotes.begin();
|
||||
it != m_subNotes.end(); ++it )
|
||||
|
||||
@@ -61,9 +61,9 @@ const KeyTypes KEY_ORDER[] =
|
||||
} ;
|
||||
|
||||
|
||||
tones WhiteKeyS[] =
|
||||
Keys WhiteKeys[] =
|
||||
{
|
||||
C, D, E, F, G, A, H
|
||||
Key_C, Key_D, Key_E, Key_F, Key_G, Key_A, Key_H
|
||||
} ;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ piano::piano( instrumentTrack * _it ) :
|
||||
model( _it ),
|
||||
m_instrumentTrack( _it )
|
||||
{
|
||||
for( int i = 0; i < NOTES_PER_OCTAVE * OCTAVES; ++i )
|
||||
for( int i = 0; i < KeysPerOctave * NumOctaves; ++i )
|
||||
{
|
||||
m_pressedKeys[i] = FALSE;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ piano::~piano()
|
||||
|
||||
void piano::setKeyState( int _key, bool _on )
|
||||
{
|
||||
m_pressedKeys[tLimit( _key, 0, NOTES_PER_OCTAVE * OCTAVES - 1 )] = _on;
|
||||
m_pressedKeys[tLimit( _key, 0, KeysPerOctave * NumOctaves - 1 )] = _on;
|
||||
emit dataChanged();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void piano::setKeyState( int _key, bool _on )
|
||||
void piano::handleKeyPress( int _key )
|
||||
{
|
||||
m_instrumentTrack->processInEvent( midiEvent( NOTE_ON, 0, _key,
|
||||
DEFAULT_VOLUME ), midiTime() );
|
||||
DefaultVolume ), midiTime() );
|
||||
m_pressedKeys[_key] = TRUE;
|
||||
}
|
||||
|
||||
@@ -141,8 +141,7 @@ pianoView::pianoView( QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
modelView( NULL ),
|
||||
m_piano( NULL ),
|
||||
m_startTone( C ),
|
||||
m_startOctave( OCTAVE_3 ),
|
||||
m_startKey( Key_C + Octave_3*KeysPerOctave ),
|
||||
m_lastKey( -1 )
|
||||
{
|
||||
if( s_whiteKeyPm == NULL )
|
||||
@@ -169,11 +168,11 @@ pianoView::pianoView( QWidget * _parent ) :
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
|
||||
m_pianoScroll = new QScrollBar( Qt::Horizontal, this );
|
||||
m_pianoScroll->setRange( 0, WHITE_KEYS_PER_OCTAVE * ( OCTAVES - 3 ) -
|
||||
m_pianoScroll->setRange( 0, WhiteKeysPerOctave * ( NumOctaves - 3 ) -
|
||||
4 );
|
||||
m_pianoScroll->setSingleStep( 1 );
|
||||
m_pianoScroll->setPageStep( 20 );
|
||||
m_pianoScroll->setValue( OCTAVE_3 * WHITE_KEYS_PER_OCTAVE );
|
||||
m_pianoScroll->setValue( Octave_3 * WhiteKeysPerOctave );
|
||||
m_pianoScroll->setGeometry( 0, PIANO_BASE + PW_WHITE_KEY_HEIGHT, 250,
|
||||
16 );
|
||||
// ...and connect it to this widget...
|
||||
@@ -254,23 +253,20 @@ int pianoView::getKeyFromMouse( const QPoint & _p ) const
|
||||
|
||||
for( int i = 0; i <= key_num; ++i )
|
||||
{
|
||||
if( KEY_ORDER[( m_startOctave * NOTES_PER_OCTAVE +
|
||||
m_startTone +i ) % NOTES_PER_OCTAVE] ==
|
||||
BlackKey )
|
||||
if( KEY_ORDER[( m_startKey+i ) % KeysPerOctave] == BlackKey )
|
||||
{
|
||||
++key_num;
|
||||
}
|
||||
}
|
||||
|
||||
key_num += m_startOctave * NOTES_PER_OCTAVE + m_startTone;
|
||||
key_num += m_startKey;
|
||||
|
||||
// is it a black key?
|
||||
if( _p.y() < PIANO_BASE + PW_BLACK_KEY_HEIGHT )
|
||||
{
|
||||
// then do extra checking whether the mouse-cursor is over
|
||||
// a black key
|
||||
if( key_num > 0 &&
|
||||
KEY_ORDER[( key_num - 1 ) % NOTES_PER_OCTAVE] ==
|
||||
if( key_num > 0 && KEY_ORDER[( key_num - 1 ) % KeysPerOctave] ==
|
||||
BlackKey &&
|
||||
_p.x() % PW_WHITE_KEY_WIDTH <=
|
||||
( PW_WHITE_KEY_WIDTH / 2 ) -
|
||||
@@ -278,8 +274,8 @@ int pianoView::getKeyFromMouse( const QPoint & _p ) const
|
||||
{
|
||||
--key_num;
|
||||
}
|
||||
if( key_num < NOTES_PER_OCTAVE * OCTAVES - 1 &&
|
||||
KEY_ORDER[( key_num + 1 ) % NOTES_PER_OCTAVE] ==
|
||||
if( key_num < KeysPerOctave * NumOctaves - 1 &&
|
||||
KEY_ORDER[( key_num + 1 ) % KeysPerOctave] ==
|
||||
BlackKey &&
|
||||
_p.x() % PW_WHITE_KEY_WIDTH >=
|
||||
( PW_WHITE_KEY_WIDTH -
|
||||
@@ -290,7 +286,7 @@ int pianoView::getKeyFromMouse( const QPoint & _p ) const
|
||||
}
|
||||
|
||||
// some range-checking-stuff
|
||||
return( tLimit( key_num, 0, NOTES_PER_OCTAVE * OCTAVES - 1 ) );
|
||||
return( tLimit( key_num, 0, KeysPerOctave * NumOctaves - 1 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -299,8 +295,8 @@ int pianoView::getKeyFromMouse( const QPoint & _p ) const
|
||||
// handler for scrolling-event
|
||||
void pianoView::pianoScrolled( int _new_pos )
|
||||
{
|
||||
m_startTone = WhiteKeyS[_new_pos % WHITE_KEYS_PER_OCTAVE];
|
||||
m_startOctave = (octaves)( _new_pos / WHITE_KEYS_PER_OCTAVE );
|
||||
m_startKey = WhiteKeys[_new_pos % WhiteKeysPerOctave]+
|
||||
( _new_pos / WhiteKeysPerOctave ) * KeysPerOctave;
|
||||
|
||||
update();
|
||||
}
|
||||
@@ -339,20 +335,20 @@ void pianoView::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
int y_diff = _me->pos().y() - PIANO_BASE;
|
||||
volume vol = (volume)( ( float ) y_diff /
|
||||
( ( KEY_ORDER[key_num % NOTES_PER_OCTAVE] ==
|
||||
( ( KEY_ORDER[key_num % KeysPerOctave] ==
|
||||
WhiteKey ) ?
|
||||
PW_WHITE_KEY_HEIGHT : PW_BLACK_KEY_HEIGHT ) *
|
||||
(float) DEFAULT_VOLUME);
|
||||
(float) DefaultVolume );
|
||||
if( y_diff < 0 )
|
||||
{
|
||||
vol = 0;
|
||||
}
|
||||
else if( y_diff > ( ( KEY_ORDER[key_num %
|
||||
NOTES_PER_OCTAVE] ==
|
||||
KeysPerOctave] ==
|
||||
WhiteKey ) ?
|
||||
PW_WHITE_KEY_HEIGHT : PW_BLACK_KEY_HEIGHT ) )
|
||||
{
|
||||
vol = DEFAULT_VOLUME;
|
||||
vol = DefaultVolume;
|
||||
}
|
||||
// set note on
|
||||
m_piano->m_instrumentTrack->processInEvent(
|
||||
@@ -410,9 +406,9 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
int key_num = getKeyFromMouse( _me->pos() );
|
||||
int y_diff = _me->pos().y() - PIANO_BASE;
|
||||
volume vol = (volume)( (float) y_diff /
|
||||
( ( KEY_ORDER[key_num % NOTES_PER_OCTAVE] == WhiteKey ) ?
|
||||
( ( KEY_ORDER[key_num % KeysPerOctave] == WhiteKey ) ?
|
||||
PW_WHITE_KEY_HEIGHT : PW_BLACK_KEY_HEIGHT ) *
|
||||
(float)DEFAULT_VOLUME );
|
||||
(float)DefaultVolume );
|
||||
// maybe the user moved the mouse-cursor above or under the
|
||||
// piano-widget while holding left button so check that and
|
||||
// correct volume if necessary
|
||||
@@ -421,10 +417,10 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
vol = 0;
|
||||
}
|
||||
else if( y_diff >
|
||||
( ( KEY_ORDER[key_num % NOTES_PER_OCTAVE] == WhiteKey ) ?
|
||||
( ( KEY_ORDER[key_num % KeysPerOctave] == WhiteKey ) ?
|
||||
PW_WHITE_KEY_HEIGHT : PW_BLACK_KEY_HEIGHT ) )
|
||||
{
|
||||
vol = DEFAULT_VOLUME;
|
||||
vol = DefaultVolume;
|
||||
}
|
||||
|
||||
// is the calculated key different from current key? (could be the
|
||||
@@ -473,7 +469,7 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
void pianoView::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
int key_num = getKeyFromScancode( _ke->nativeScanCode() ) +
|
||||
( DEFAULT_OCTAVE - 1 ) * NOTES_PER_OCTAVE;
|
||||
( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
|
||||
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
|
||||
{
|
||||
@@ -495,7 +491,7 @@ void pianoView::keyPressEvent( QKeyEvent * _ke )
|
||||
void pianoView::keyReleaseEvent( QKeyEvent * _ke )
|
||||
{
|
||||
int key_num = getKeyFromScancode( _ke->nativeScanCode() ) +
|
||||
( DEFAULT_OCTAVE - 1 ) * NOTES_PER_OCTAVE;
|
||||
( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
|
||||
{
|
||||
if( m_piano != NULL )
|
||||
@@ -522,7 +518,7 @@ void pianoView::focusOutEvent( QFocusEvent * )
|
||||
// if we loose focus, we HAVE to note off all running notes because
|
||||
// we don't receive key-release-events anymore and so the notes would
|
||||
// hang otherwise
|
||||
for( int i = 0; i < NOTES_PER_OCTAVE * OCTAVES; ++i )
|
||||
for( int i = 0; i < KeysPerOctave * NumOctaves; ++i )
|
||||
{
|
||||
if( m_piano->m_pressedKeys[i] == TRUE )
|
||||
{
|
||||
@@ -540,8 +536,8 @@ void pianoView::focusOutEvent( QFocusEvent * )
|
||||
|
||||
int pianoView::getKeyX( int _key_num ) const
|
||||
{
|
||||
int k = m_startOctave*NOTES_PER_OCTAVE + m_startTone;
|
||||
if( _key_num < k )
|
||||
int k = m_startKey;
|
||||
if( _key_num < m_startKey )
|
||||
{
|
||||
return( ( _key_num - k ) * PW_WHITE_KEY_WIDTH / 2 );
|
||||
}
|
||||
@@ -551,7 +547,7 @@ int pianoView::getKeyX( int _key_num ) const
|
||||
|
||||
while( k <= _key_num )
|
||||
{
|
||||
if( KEY_ORDER[k % NOTES_PER_OCTAVE] == WhiteKey )
|
||||
if( KEY_ORDER[k % KeysPerOctave] == WhiteKey )
|
||||
{
|
||||
++white_cnt;
|
||||
if( white_cnt > 1 )
|
||||
@@ -602,7 +598,7 @@ void pianoView::paintEvent( QPaintEvent * )
|
||||
|
||||
const int base_key = ( m_piano != NULL ) ?
|
||||
m_piano->m_instrumentTrack->baseNoteModel()->value() : 0;
|
||||
if( KEY_ORDER[base_key % NOTES_PER_OCTAVE] == WhiteKey )
|
||||
if( KEY_ORDER[base_key % KeysPerOctave] == WhiteKey )
|
||||
{
|
||||
p.fillRect( QRect( getKeyX( base_key ), 1, PW_WHITE_KEY_WIDTH-1,
|
||||
PIANO_BASE-2 ),
|
||||
@@ -616,12 +612,12 @@ void pianoView::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
|
||||
int cur_key = m_startOctave*NOTES_PER_OCTAVE + m_startTone;
|
||||
int cur_key = m_startKey;
|
||||
|
||||
// draw all white keys...
|
||||
for( int x = 0; x < width(); )
|
||||
{
|
||||
while( KEY_ORDER[cur_key%NOTES_PER_OCTAVE] != WhiteKey )
|
||||
while( KEY_ORDER[cur_key%KeysPerOctave] != WhiteKey )
|
||||
{
|
||||
++cur_key;
|
||||
}
|
||||
@@ -639,25 +635,25 @@ void pianoView::paintEvent( QPaintEvent * )
|
||||
|
||||
x += PW_WHITE_KEY_WIDTH;
|
||||
|
||||
if( (tones) (cur_key%NOTES_PER_OCTAVE) == C )
|
||||
if( (Keys) (cur_key%KeysPerOctave) == Key_C )
|
||||
{
|
||||
// label key of note C with "C" and number of current
|
||||
// octave
|
||||
p.drawText( x - PW_WHITE_KEY_WIDTH, LABEL_TEXT_SIZE + 2,
|
||||
QString( "C" ) + QString::number(
|
||||
cur_key / NOTES_PER_OCTAVE, 10 ) );
|
||||
cur_key / KeysPerOctave, 10 ) );
|
||||
}
|
||||
++cur_key;
|
||||
}
|
||||
|
||||
|
||||
// reset all values, because now we're going to draw all black keys
|
||||
cur_key = m_startOctave*NOTES_PER_OCTAVE + m_startTone;
|
||||
cur_key = m_startKey;
|
||||
int white_cnt = 0;
|
||||
|
||||
int s_key = m_startOctave*NOTES_PER_OCTAVE+m_startTone;
|
||||
int s_key = m_startKey;
|
||||
if( s_key > 0 &&
|
||||
KEY_ORDER[(tones)( --s_key ) % NOTES_PER_OCTAVE] == BlackKey )
|
||||
KEY_ORDER[(Keys)( --s_key ) % KeysPerOctave] == BlackKey )
|
||||
{
|
||||
if( m_piano && m_piano->m_pressedKeys[s_key] == TRUE )
|
||||
{
|
||||
@@ -674,7 +670,7 @@ void pianoView::paintEvent( QPaintEvent * )
|
||||
// now draw all black keys...
|
||||
for( int x = 0; x < width(); )
|
||||
{
|
||||
if( KEY_ORDER[cur_key%NOTES_PER_OCTAVE] == BlackKey )
|
||||
if( KEY_ORDER[cur_key%KeysPerOctave] == BlackKey )
|
||||
{
|
||||
// draw pressed or not pressed key, depending on
|
||||
// state of current key
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
typedef automationPattern::timeMap timeMap;
|
||||
|
||||
|
||||
extern tones whiteKeys[]; // defined in piano_widget.cpp
|
||||
extern Keys whiteKeys[]; // defined in piano_widget.cpp
|
||||
|
||||
|
||||
// some constants...
|
||||
@@ -91,7 +91,7 @@ const int WHITE_KEY_BIG_HEIGHT = 24;
|
||||
const int BLACK_KEY_HEIGHT = 16;
|
||||
const int C_KEY_LABEL_X = WHITE_KEY_WIDTH - 19;
|
||||
const int KEY_LINE_HEIGHT = 12;
|
||||
const int OCTAVE_HEIGHT = KEY_LINE_HEIGHT * NOTES_PER_OCTAVE; // = 12 * 12;
|
||||
const int OCTAVE_HEIGHT = KEY_LINE_HEIGHT * KeysPerOctave; // = 12 * 12;
|
||||
|
||||
const int PR_BOTTOM_MARGIN = SCROLLBAR_SIZE;
|
||||
const int PR_TOP_MARGIN = 48;
|
||||
@@ -103,7 +103,7 @@ const int RESIZE_AREA_WIDTH = 4;
|
||||
const int NE_LINE_WIDTH = 3;
|
||||
|
||||
// key where to start
|
||||
const int INITIAL_START_KEY = C + OCTAVE_3 * NOTES_PER_OCTAVE;
|
||||
const int INITIAL_START_KEY = Key_C + Octave_3 * KeysPerOctave;
|
||||
|
||||
|
||||
QPixmap * pianoRoll::s_whiteKeySmallPm = NULL;
|
||||
@@ -492,10 +492,10 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
if( total_notes > 0 )
|
||||
{
|
||||
central_key = central_key / total_notes -
|
||||
( NOTES_PER_OCTAVE * OCTAVES -
|
||||
( KeysPerOctave * NumOctaves -
|
||||
m_totalKeysToScroll ) / 2;
|
||||
m_startKey = tLimit( central_key, 0,
|
||||
OCTAVES * NOTES_PER_OCTAVE );
|
||||
NumOctaves * KeysPerOctave );
|
||||
}
|
||||
}
|
||||
// resizeEvent() does the rest for us (scrolling, range-checking
|
||||
@@ -647,7 +647,7 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
int key_num = pianoView::getKeyFromScancode(
|
||||
_ke->nativeScanCode() ) +
|
||||
( DEFAULT_OCTAVE - 1 ) * NOTES_PER_OCTAVE;
|
||||
( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
|
||||
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
|
||||
{
|
||||
@@ -819,7 +819,7 @@ void pianoRoll::keyReleaseEvent( QKeyEvent * _ke )
|
||||
{
|
||||
int key_num = pianoView::getKeyFromScancode(
|
||||
_ke->nativeScanCode() ) +
|
||||
( DEFAULT_OCTAVE - 1 ) * NOTES_PER_OCTAVE;
|
||||
( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
|
||||
if( _ke->isAutoRepeat() == FALSE && key_num > -1 )
|
||||
{
|
||||
@@ -871,7 +871,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
if( _me->y() > PR_TOP_MARGIN )
|
||||
{
|
||||
bool play_note = TRUE;
|
||||
volume vol = DEFAULT_VOLUME;
|
||||
volume vol = DefaultVolume;
|
||||
|
||||
bool edit_note = ( _me->y() > height() -
|
||||
PR_BOTTOM_MARGIN - m_notesEditHeight );
|
||||
@@ -962,11 +962,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
midiTime note_pos( pos_tact_64th - (quantization() / 2) );
|
||||
midiTime note_len( newNoteLen() );
|
||||
|
||||
note new_note( note_len, note_pos,
|
||||
(tones)( key_num %
|
||||
NOTES_PER_OCTAVE ),
|
||||
(octaves)( key_num /
|
||||
NOTES_PER_OCTAVE) );
|
||||
note new_note( note_len, note_pos, key_num );
|
||||
|
||||
note * created_new_note =
|
||||
m_pattern->addNote( new_note );
|
||||
@@ -1171,7 +1167,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
m_lastKey = key_num;
|
||||
m_pattern->getInstrumentTrack()->processInEvent(
|
||||
midiEvent( NOTE_ON, 0, key_num,
|
||||
DEFAULT_VOLUME * 127 / 100 ),
|
||||
DefaultVolume * 127 / 100 ),
|
||||
midiTime() );
|
||||
}
|
||||
}
|
||||
@@ -1190,8 +1186,8 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
volume vol = tLimit<int>( 2 * ( -_me->y() +
|
||||
height() -
|
||||
PR_BOTTOM_MARGIN ),
|
||||
MIN_VOLUME,
|
||||
MAX_VOLUME );
|
||||
MinVolume,
|
||||
MaxVolume );
|
||||
m_currentNote->setVolume( vol );
|
||||
m_pattern->dataChanged();
|
||||
m_pattern->getInstrumentTrack()->processInEvent(
|
||||
@@ -1443,10 +1439,10 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
key_diff = -m_selectStartKey - 1;
|
||||
}
|
||||
else if( m_selectStartKey + m_selectedKeys +
|
||||
key_diff >= NOTES_PER_OCTAVE *
|
||||
OCTAVES )
|
||||
key_diff >= KeysPerOctave *
|
||||
NumOctaves )
|
||||
{
|
||||
key_diff = NOTES_PER_OCTAVE * OCTAVES -
|
||||
key_diff = KeysPerOctave * NumOctaves -
|
||||
( m_selectStartKey +
|
||||
m_selectedKeys ) - 1;
|
||||
}
|
||||
@@ -1460,9 +1456,9 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
m_selectedKeys ) - 1;
|
||||
}
|
||||
else if( m_selectStartKey + key_diff >=
|
||||
NOTES_PER_OCTAVE * OCTAVES )
|
||||
KeysPerOctave * NumOctaves )
|
||||
{
|
||||
key_diff = NOTES_PER_OCTAVE * OCTAVES -
|
||||
key_diff = KeysPerOctave * NumOctaves -
|
||||
m_selectStartKey - 1;
|
||||
}
|
||||
}
|
||||
@@ -1602,13 +1598,13 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
int y_offset = 0;
|
||||
|
||||
// calculate y_offset according to first key
|
||||
switch( prKeyOrder[m_startKey % NOTES_PER_OCTAVE] )
|
||||
switch( prKeyOrder[m_startKey % KeysPerOctave] )
|
||||
{
|
||||
case PR_BLACK_KEY: y_offset = KEY_LINE_HEIGHT/4; break;
|
||||
case PR_WHITE_KEY_BIG: y_offset = KEY_LINE_HEIGHT/2; break;
|
||||
case PR_WHITE_KEY_SMALL:
|
||||
if( prKeyOrder[( ( m_startKey + 1 ) %
|
||||
NOTES_PER_OCTAVE)] != PR_BLACK_KEY )
|
||||
KeysPerOctave)] != PR_BLACK_KEY )
|
||||
{
|
||||
y_offset = KEY_LINE_HEIGHT / 2;
|
||||
}
|
||||
@@ -1632,7 +1628,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// check for white key that is only half visible on the
|
||||
// bottom of piano-roll
|
||||
if( keys_processed == 0 &&
|
||||
prKeyOrder[m_startKey % NOTES_PER_OCTAVE] ==
|
||||
prKeyOrder[m_startKey % KeysPerOctave] ==
|
||||
PR_BLACK_KEY )
|
||||
{
|
||||
// draw it!
|
||||
@@ -1648,7 +1644,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
first_white_key_height = WHITE_KEY_SMALL_HEIGHT / 2;
|
||||
}
|
||||
// check whether to draw a big or a small white key
|
||||
if( prKeyOrder[key % NOTES_PER_OCTAVE] == PR_WHITE_KEY_SMALL )
|
||||
if( prKeyOrder[key % KeysPerOctave] == PR_WHITE_KEY_SMALL )
|
||||
{
|
||||
// draw a small one...
|
||||
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT,
|
||||
@@ -1657,7 +1653,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
y -= WHITE_KEY_SMALL_HEIGHT;
|
||||
|
||||
}
|
||||
else if( prKeyOrder[key % NOTES_PER_OCTAVE] ==
|
||||
else if( prKeyOrder[key % KeysPerOctave] ==
|
||||
PR_WHITE_KEY_BIG )
|
||||
{
|
||||
// draw a big one...
|
||||
@@ -1673,16 +1669,16 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
y -= WHITE_KEY_BIG_HEIGHT;
|
||||
}
|
||||
// label C-keys...
|
||||
if( static_cast<tones>( key % NOTES_PER_OCTAVE ) == C )
|
||||
if( static_cast<Keys>( key % KeysPerOctave ) == Key_C )
|
||||
{
|
||||
p.setPen( QColor( 240, 240, 240 ) );
|
||||
p.drawText( C_KEY_LABEL_X + 1, y+14, "C" +
|
||||
QString::number( static_cast<int>( key /
|
||||
NOTES_PER_OCTAVE ) ) );
|
||||
KeysPerOctave ) ) );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawText( C_KEY_LABEL_X, y + 13, "C" +
|
||||
QString::number( static_cast<int>( key /
|
||||
NOTES_PER_OCTAVE ) ) );
|
||||
KeysPerOctave ) ) );
|
||||
p.setPen( QColor( 0x4F, 0x4F, 0x4F ) );
|
||||
}
|
||||
else
|
||||
@@ -1707,17 +1703,17 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// of piano-roll
|
||||
if( keys_processed == 0
|
||||
// current key may not be a black one
|
||||
&& prKeyOrder[key % NOTES_PER_OCTAVE] != PR_BLACK_KEY
|
||||
&& prKeyOrder[key % KeysPerOctave] != PR_BLACK_KEY
|
||||
// but the previous one must be black (we must check this
|
||||
// because there might be two white keys (E-F)
|
||||
&& prKeyOrder[( key - 1 ) % NOTES_PER_OCTAVE] ==
|
||||
&& prKeyOrder[( key - 1 ) % KeysPerOctave] ==
|
||||
PR_BLACK_KEY )
|
||||
{
|
||||
// draw the black key!
|
||||
p.drawPixmap( PIANO_X, y - BLACK_KEY_HEIGHT / 2,
|
||||
*s_blackKeyPm );
|
||||
// is the one after the start-note a black key??
|
||||
if( prKeyOrder[( key + 1 ) % NOTES_PER_OCTAVE] !=
|
||||
if( prKeyOrder[( key + 1 ) % KeysPerOctave] !=
|
||||
PR_BLACK_KEY )
|
||||
{
|
||||
// no, then move it up!
|
||||
@@ -1725,7 +1721,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
}
|
||||
}
|
||||
// current key black?
|
||||
if( prKeyOrder[key % NOTES_PER_OCTAVE] == PR_BLACK_KEY )
|
||||
if( prKeyOrder[key % KeysPerOctave] == PR_BLACK_KEY )
|
||||
{
|
||||
// then draw it (calculation of y very complicated,
|
||||
// but that's the only working solution, sorry...)
|
||||
@@ -1987,10 +1983,10 @@ void pianoRoll::resizeEvent( QResizeEvent * )
|
||||
height() - PR_TOP_MARGIN -
|
||||
SCROLLBAR_SIZE );
|
||||
|
||||
int total_pixels = OCTAVE_HEIGHT * OCTAVES - ( height() -
|
||||
int total_pixels = OCTAVE_HEIGHT * NumOctaves - ( height() -
|
||||
PR_TOP_MARGIN - PR_BOTTOM_MARGIN -
|
||||
m_notesEditHeight );
|
||||
m_totalKeysToScroll = total_pixels * NOTES_PER_OCTAVE / OCTAVE_HEIGHT;
|
||||
m_totalKeysToScroll = total_pixels * KeysPerOctave / OCTAVE_HEIGHT;
|
||||
|
||||
m_topBottomScroll->setRange( 0, m_totalKeysToScroll );
|
||||
|
||||
@@ -2060,9 +2056,9 @@ int pianoRoll::getKey( int _y ) const
|
||||
key_num = 0;
|
||||
}
|
||||
|
||||
if( key_num >= NOTES_PER_OCTAVE * OCTAVES )
|
||||
if( key_num >= KeysPerOctave * NumOctaves )
|
||||
{
|
||||
key_num = NOTES_PER_OCTAVE * OCTAVES - 1;
|
||||
key_num = KeysPerOctave * NumOctaves - 1;
|
||||
}
|
||||
|
||||
return( key_num );
|
||||
@@ -2144,8 +2140,7 @@ void pianoRoll::recordNote( const note & _n )
|
||||
{
|
||||
note n( _n.length(), engine::getSong()->getPlayPos(
|
||||
song::Mode_PlayPattern ) - _n.length(),
|
||||
_n.tone(), _n.octave(),
|
||||
_n.getVolume(), _n.getPanning() );
|
||||
_n.key(), _n.getVolume(), _n.getPanning() );
|
||||
n.quantizeLength( quantization() );
|
||||
m_pattern->addNote( n );
|
||||
update();
|
||||
|
||||
@@ -130,21 +130,17 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
|
||||
multimediaProject mmp( _preset_file );
|
||||
s_previewTC->previewInstrumentTrack()->loadTrackSpecificSettings(
|
||||
mmp.content().firstChild().toElement() );
|
||||
// preset also contains information about window-states etc. that's why
|
||||
// here we have to make sure that the instrument-track-window is hidden
|
||||
// s_previewTC->previewInstrumentTrack()->hide();
|
||||
|
||||
// make sure, our preset-preview-track does not appear in any MIDI-
|
||||
// devices list, so just disable receiving/sending MIDI-events at all
|
||||
s_previewTC->previewInstrumentTrack()->m_midiPort->setMode(
|
||||
midiPort::DUMMY );
|
||||
midiPort::Disabled );
|
||||
|
||||
// create note-play-handle for it
|
||||
m_previewNote = new notePlayHandle(
|
||||
s_previewTC->previewInstrumentTrack(), 0,
|
||||
valueRanges<f_cnt_t>::max() / 2,
|
||||
note( 0, 0, static_cast<tones>( A ),
|
||||
static_cast<octaves>( DEFAULT_OCTAVE - 1 ), 100 ) );
|
||||
note( 0, 0, DefaultKey, 100 ) );
|
||||
|
||||
|
||||
s_previewTC->setPreviewNote( m_previewNote );
|
||||
|
||||
@@ -87,7 +87,7 @@ sampleBuffer::sampleBuffer( const QString & _audio_file,
|
||||
m_loop_endFrame( 0 ),
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BASE_FREQ ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
{
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
@@ -116,7 +116,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) :
|
||||
m_loop_endFrame( 0 ),
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BASE_FREQ ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
{
|
||||
if( _frames > 0 )
|
||||
@@ -147,7 +147,7 @@ sampleBuffer::sampleBuffer( const f_cnt_t _frames ) :
|
||||
m_loop_endFrame( 0 ),
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_frequency( BASE_FREQ ),
|
||||
m_frequency( BaseFreq ),
|
||||
m_sampleRate( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
{
|
||||
if( _frames > 0 )
|
||||
|
||||
@@ -149,21 +149,21 @@ void midiALSASeq::processOutEvent( const midiEvent & _me,
|
||||
case NOTE_ON:
|
||||
snd_seq_ev_set_noteon( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.key() + NOTES_PER_OCTAVE,
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case NOTE_OFF:
|
||||
snd_seq_ev_set_noteoff( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.key() + NOTES_PER_OCTAVE,
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case KEY_PRESSURE:
|
||||
snd_seq_ev_set_keypress( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.key() + NOTES_PER_OCTAVE,
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
@@ -213,16 +213,16 @@ void midiALSASeq::applyPortMode( midiPort * _port )
|
||||
|
||||
switch( _port->mode() )
|
||||
{
|
||||
case midiPort::DUPLEX:
|
||||
case midiPort::Duplex:
|
||||
caps[1] |= SND_SEQ_PORT_CAP_READ |
|
||||
SND_SEQ_PORT_CAP_SUBS_READ;
|
||||
|
||||
case midiPort::INPUT:
|
||||
case midiPort::Input:
|
||||
caps[0] |= SND_SEQ_PORT_CAP_WRITE |
|
||||
SND_SEQ_PORT_CAP_SUBS_WRITE;
|
||||
break;
|
||||
|
||||
case midiPort::OUTPUT:
|
||||
case midiPort::Output:
|
||||
caps[0] |= SND_SEQ_PORT_CAP_READ |
|
||||
SND_SEQ_PORT_CAP_SUBS_READ;
|
||||
break;
|
||||
@@ -326,8 +326,8 @@ void midiALSASeq::subscribeReadablePort( midiPort * _port,
|
||||
bool _unsubscribe )
|
||||
{
|
||||
if( m_portIDs.contains( _port ) == FALSE ||
|
||||
( _port->mode() != midiPort::INPUT &&
|
||||
_port->mode() != midiPort::DUPLEX ) )
|
||||
( _port->mode() != midiPort::Input &&
|
||||
_port->mode() != midiPort::Duplex ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -366,8 +366,8 @@ void midiALSASeq::subscribeWriteablePort( midiPort * _port,
|
||||
bool _unsubscribe )
|
||||
{
|
||||
if( m_portIDs.contains( _port ) == FALSE ||
|
||||
( _port->mode() != midiPort::OUTPUT &&
|
||||
_port->mode() != midiPort::DUPLEX ) )
|
||||
( _port->mode() != midiPort::Output &&
|
||||
_port->mode() != midiPort::Duplex ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ void midiALSASeq::run( void )
|
||||
dest->processInEvent( midiEvent( NOTE_ON,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
NOTES_PER_OCTAVE,
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity
|
||||
),
|
||||
midiTime( ev->time.tick ) );
|
||||
@@ -466,7 +466,7 @@ void midiALSASeq::run( void )
|
||||
dest->processInEvent( midiEvent( NOTE_OFF,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
NOTES_PER_OCTAVE,
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity
|
||||
),
|
||||
midiTime( ev->time.tick) );
|
||||
@@ -476,7 +476,7 @@ void midiALSASeq::run( void )
|
||||
dest->processInEvent( midiEvent( KEY_PRESSURE,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
NOTES_PER_OCTAVE,
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity
|
||||
), midiTime() );
|
||||
break;
|
||||
|
||||
@@ -249,7 +249,7 @@ void midiClientRaw::parseData( const Uint8 _c )
|
||||
case PROGRAM_CHANGE:
|
||||
case CHANNEL_PRESSURE:
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[0] =
|
||||
m_midiParseData.m_buffer[0] - NOTES_PER_OCTAVE;
|
||||
m_midiParseData.m_buffer[0] - KeysPerOctave;
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[1] =
|
||||
m_midiParseData.m_buffer[1];
|
||||
break;
|
||||
@@ -300,7 +300,7 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
|
||||
{
|
||||
sendByte( _me.m_type | _port->outputChannel() );
|
||||
sendByte( _me.m_data.m_param[0] +
|
||||
NOTES_PER_OCTAVE );
|
||||
KeysPerOctave );
|
||||
sendByte( tLimit( (int) _me.m_data.m_param[1],
|
||||
0, 127 ) );
|
||||
}
|
||||
@@ -310,7 +310,7 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
|
||||
{
|
||||
sendByte( _me.m_type | i );
|
||||
sendByte( _me.m_data.m_param[0] +
|
||||
NOTES_PER_OCTAVE );
|
||||
KeysPerOctave );
|
||||
sendByte( tLimit( (int)
|
||||
_me.m_data.m_param[1],
|
||||
0, 127 ) );
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* midi_port.cpp - abstraction of MIDI-ports which are part of LMMS's MIDI-
|
||||
* sequencing system
|
||||
*
|
||||
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
|
||||
midiPort::midiPort( midiClient * _mc, midiEventProcessor * _mep,
|
||||
const QString & _name, modes _mode ) :
|
||||
const QString & _name, Modes _mode ) :
|
||||
m_midiClient( _mc ),
|
||||
m_midiEventProcessor( _mep ),
|
||||
m_name( _name ),
|
||||
@@ -64,7 +64,7 @@ void midiPort::setName( const QString & _name )
|
||||
|
||||
|
||||
|
||||
void midiPort::setMode( modes _mode )
|
||||
void midiPort::setMode( Modes _mode )
|
||||
{
|
||||
m_mode = _mode;
|
||||
m_midiClient->applyPortMode( this );
|
||||
@@ -76,14 +76,14 @@ void midiPort::setMode( modes _mode )
|
||||
void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
|
||||
{
|
||||
// mask event
|
||||
if( ( mode() == INPUT || mode() == DUPLEX ) &&
|
||||
if( ( mode() == Input || mode() == Duplex ) &&
|
||||
( inputChannel() == _me.m_channel || inputChannel() == -1 ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
if( m_defaultVelocityForInEventsEnabled == TRUE &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DEFAULT_VOLUME;
|
||||
ev.velocity() = DefaultVolume;
|
||||
}
|
||||
m_midiEventProcessor->processInEvent( ev, _time );
|
||||
}
|
||||
@@ -95,14 +95,14 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
|
||||
void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
|
||||
{
|
||||
// mask event
|
||||
if( ( mode() == OUTPUT || mode() == DUPLEX ) &&
|
||||
if( ( mode() == Output || mode() == Duplex ) &&
|
||||
( outputChannel() == _me.m_channel && outputChannel() != -1 ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
if( m_defaultVelocityForOutEventsEnabled == TRUE &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DEFAULT_VOLUME;
|
||||
ev.velocity() = DefaultVolume;
|
||||
}
|
||||
m_midiClient->processOutEvent( ev, _time, this );
|
||||
}
|
||||
|
||||
@@ -106,11 +106,10 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
tr( "unnamed_channel" ) ) ),
|
||||
m_audioPort( tr( "unnamed_channel" ), this ),
|
||||
m_notes(),
|
||||
m_baseNoteModel( 0, 0, NOTES_PER_OCTAVE * OCTAVES - 1, 1, this ),
|
||||
m_volumeModel( DEFAULT_VOLUME, MIN_VOLUME, MAX_VOLUME,
|
||||
1.0f, this ),
|
||||
m_surroundAreaModel( this, this ),
|
||||
m_effectChannelModel( 0, 0, NUM_FX_CHANNELS, 1, this ),
|
||||
m_baseNoteModel( 0, 0, KeysPerOctave * NumOctaves - 1, 1, this ),
|
||||
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 1.0f, this ),
|
||||
m_surroundAreaModel( this, this ),
|
||||
m_effectChannelModel( 0, 0, NumFxChannels, 1, this ),
|
||||
m_instrument( NULL ),
|
||||
m_soundShaping( this ),
|
||||
m_arpeggiator( this ),
|
||||
@@ -119,7 +118,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
m_piano( this )
|
||||
{
|
||||
m_baseNoteModel.setTrack( this );
|
||||
m_baseNoteModel.setInitValue( DEFAULT_OCTAVE * NOTES_PER_OCTAVE + A );
|
||||
m_baseNoteModel.setInitValue( DefaultKey );
|
||||
connect( &m_baseNoteModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateBaseNote() ) );
|
||||
|
||||
@@ -127,7 +126,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
m_effectChannelModel.setTrack( this );
|
||||
|
||||
|
||||
for( int i = 0; i < NOTES; ++i )
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_notes[i] = NULL;
|
||||
}
|
||||
@@ -177,7 +176,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
|
||||
{
|
||||
return;
|
||||
}
|
||||
float v_scale = (float) getVolume() / DEFAULT_VOLUME;
|
||||
float v_scale = (float) getVolume() / DefaultVolume;
|
||||
|
||||
m_audioPort.getEffects()->startRunning();
|
||||
|
||||
@@ -187,7 +186,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
|
||||
if( _n != NULL )
|
||||
{
|
||||
m_soundShaping.processAudioBuffer( _buf, _frames, _n );
|
||||
v_scale *= ( (float) _n->getVolume() / DEFAULT_VOLUME );
|
||||
v_scale *= ( (float) _n->getVolume() / DefaultVolume );
|
||||
}
|
||||
volumeVector v = m_surroundAreaModel.getVolumeVector( v_scale );
|
||||
|
||||
@@ -254,7 +253,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
midiTime( static_cast<f_cnt_t>(
|
||||
n->totalFramesPlayed() /
|
||||
engine::framesPerTact64th() ) ),
|
||||
0, n->tone(), n->octave(),
|
||||
0, n->key(),
|
||||
n->getVolume(), n->getPanning() );
|
||||
if( _lock )
|
||||
{
|
||||
@@ -285,19 +284,6 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
m_instrument->handleMidiEvent( _me, _time );
|
||||
break;
|
||||
|
||||
/* case PITCH_BEND:
|
||||
if( m_pitchBendKnob != NULL )
|
||||
{
|
||||
float range = tAbs(
|
||||
m_pitchBendKnob->maxValue() -
|
||||
m_pitchBendKnob->minValue() );
|
||||
m_pitchBendKnob->setValue(
|
||||
m_pitchBendKnob->minValue() +
|
||||
_me.m_data.m_param[0] *
|
||||
range / 16384 );
|
||||
}
|
||||
break;*/
|
||||
|
||||
default:
|
||||
printf( "instrument-track: unhandled MIDI-event %d\n",
|
||||
_me.m_type );
|
||||
@@ -442,7 +428,7 @@ void instrumentTrack::deleteNotePluginData( notePlayHandle * _n )
|
||||
note done_note( midiTime( static_cast<f_cnt_t>(
|
||||
_n->totalFramesPlayed() /
|
||||
engine::framesPerTact64th() ) ),
|
||||
0, _n->tone(), _n->octave(),
|
||||
0, _n->key(),
|
||||
_n->getVolume(), _n->getPanning() );
|
||||
_n->noteOff();
|
||||
m_notes[_n->key()] = NULL;
|
||||
@@ -478,7 +464,7 @@ void instrumentTrack::setName( const QString & _new_name )
|
||||
|
||||
|
||||
|
||||
void instrumentTrack::updateBaseNote( /* bool _modified*/ void )
|
||||
void instrumentTrack::updateBaseNote( void )
|
||||
{
|
||||
engine::getMixer()->lock();
|
||||
for( QList<notePlayHandle *>::iterator it = m_processHandles.begin();
|
||||
@@ -487,11 +473,6 @@ void instrumentTrack::updateBaseNote( /* bool _modified*/ void )
|
||||
( *it )->updateFrequency();
|
||||
}
|
||||
engine::getMixer()->unlock();
|
||||
/*
|
||||
if( _modified )
|
||||
{
|
||||
engine::getSongEditor()->setModified();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@@ -501,7 +482,7 @@ int instrumentTrack::masterKey( notePlayHandle * _n ) const
|
||||
{
|
||||
int key = m_baseNoteModel.value() + engine::getSong()->masterPitch();
|
||||
return( tLimit<int>( _n->key() -
|
||||
( key - A - DEFAULT_OCTAVE * NOTES_PER_OCTAVE ), 0, NOTES ) );
|
||||
( key - Key_A - DefaultOctave * KeysPerOctave ), 0, NumKeys ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -721,7 +702,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
// TODO: move this compat code to mmp.cpp -> upgrade()
|
||||
m_baseNoteModel.setInitValue( _this.
|
||||
attribute( "baseoct" ).toInt()
|
||||
* NOTES_PER_OCTAVE
|
||||
* KeysPerOctave
|
||||
+ _this.attribute( "basetone" ).toInt() );
|
||||
}
|
||||
else
|
||||
@@ -811,7 +792,7 @@ instrument * instrumentTrack::loadInstrument( const QString & _plugin_name )
|
||||
void instrumentTrack::invalidateAllMyNPH( void )
|
||||
{
|
||||
engine::getMixer()->lock();
|
||||
for( int i = 0; i < NOTES; ++i )
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_notes[i] = NULL;
|
||||
}
|
||||
@@ -993,9 +974,8 @@ void instrumentTrackView::toggledInstrumentTrackButton( bool _on )
|
||||
|
||||
void instrumentTrackView::activityIndicatorPressed( void )
|
||||
{
|
||||
model()->processInEvent( midiEvent( NOTE_ON, 0,
|
||||
DEFAULT_OCTAVE * NOTES_PER_OCTAVE + A,
|
||||
127 ), midiTime() );
|
||||
model()->processInEvent( midiEvent( NOTE_ON, 0, DefaultKey, 127 ),
|
||||
midiTime() );
|
||||
}
|
||||
|
||||
|
||||
@@ -1003,9 +983,8 @@ void instrumentTrackView::activityIndicatorPressed( void )
|
||||
|
||||
void instrumentTrackView::activityIndicatorReleased( void )
|
||||
{
|
||||
model()->processInEvent( midiEvent( NOTE_OFF, 0,
|
||||
DEFAULT_OCTAVE * NOTES_PER_OCTAVE + A,
|
||||
0 ), midiTime() );
|
||||
model()->processInEvent( midiEvent( NOTE_OFF, 0, DefaultKey, 0 ),
|
||||
midiTime() );
|
||||
}
|
||||
|
||||
|
||||
@@ -1062,7 +1041,7 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
|
||||
tr( "Channel volume" ) );
|
||||
m_volumeKnob->move( 10, 44 );
|
||||
m_volumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" );
|
||||
m_volumeKnob->setLabel( tr( "VOLUME" ) );
|
||||
m_volumeKnob->setLabel( tr( "VOL" ) );
|
||||
|
||||
m_volumeKnob->setWhatsThis( tr( volume_help ) );
|
||||
|
||||
|
||||
@@ -174,8 +174,8 @@ void instrumentMidiIOView::activatedReadablePort( QAction * _item )
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _item->isChecked() == TRUE &&
|
||||
mio->m_midiPort->mode() != midiPort::INPUT &&
|
||||
mio->m_midiPort->mode() != midiPort::DUPLEX )
|
||||
mio->m_midiPort->mode() != midiPort::Input &&
|
||||
mio->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
mio->m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
@@ -191,8 +191,8 @@ void instrumentMidiIOView::activatedWriteablePort( QAction * _item )
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _item->isChecked() == TRUE &&
|
||||
mio->m_midiPort->mode() != midiPort::OUTPUT &&
|
||||
mio->m_midiPort->mode() != midiPort::DUPLEX )
|
||||
mio->m_midiPort->mode() != midiPort::Output &&
|
||||
mio->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
mio->m_sendEnabledModel.setValue( TRUE );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user