made MidiEventTypes-enum conform coding-style, i.e. MidiNoteOn instead of NOTE_ON etc.

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1091 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-07 22:14:25 +00:00
parent 15794c095d
commit 280d9bdcc0
15 changed files with 133 additions and 120 deletions

View File

@@ -146,47 +146,47 @@ void midiALSASeq::processOutEvent( const midiEvent & _me,
ev.queue = m_queueID;
switch( _me.m_type )
{
case NOTE_ON:
case MidiNoteOn:
snd_seq_ev_set_noteon( &ev,
_port->outputChannel(),
_me.key() + KeysPerOctave,
_me.velocity() );
break;
case NOTE_OFF:
case MidiNoteOff:
snd_seq_ev_set_noteoff( &ev,
_port->outputChannel(),
_me.key() + KeysPerOctave,
_me.velocity() );
break;
case KEY_PRESSURE:
case MidiKeyPressure:
snd_seq_ev_set_keypress( &ev,
_port->outputChannel(),
_me.key() + KeysPerOctave,
_me.velocity() );
break;
case CONTROL_CHANGE:
case MidiControlChange:
snd_seq_ev_set_controller( &ev,
_port->outputChannel(),
_me.m_data.m_param[0],
_me.m_data.m_param[1] );
break;
case PROGRAM_CHANGE:
case MidiProgramChange:
snd_seq_ev_set_pgmchange( &ev,
_port->outputChannel(),
_me.m_data.m_param[0] );
break;
case CHANNEL_PRESSURE:
case MidiChannelPressure:
snd_seq_ev_set_chanpress( &ev,
_port->outputChannel(),
_me.m_data.m_param[0] );
break;
case PITCH_BEND:
case MidiPitchBend:
snd_seq_ev_set_pitchbend( &ev,
_port->outputChannel(),
_me.m_data.m_param[0] - 8192 );
@@ -453,7 +453,7 @@ void midiALSASeq::run( void )
switch( ev->type )
{
case SND_SEQ_EVENT_NOTEON:
dest->processInEvent( midiEvent( NOTE_ON,
dest->processInEvent( midiEvent( MidiNoteOn,
ev->data.note.channel,
ev->data.note.note -
KeysPerOctave,
@@ -463,7 +463,7 @@ void midiALSASeq::run( void )
break;
case SND_SEQ_EVENT_NOTEOFF:
dest->processInEvent( midiEvent( NOTE_OFF,
dest->processInEvent( midiEvent( MidiNoteOff,
ev->data.note.channel,
ev->data.note.note -
KeysPerOctave,
@@ -473,7 +473,8 @@ void midiALSASeq::run( void )
break;
case SND_SEQ_EVENT_KEYPRESS:
dest->processInEvent( midiEvent( KEY_PRESSURE,
dest->processInEvent( midiEvent(
MidiKeyPressure,
ev->data.note.channel,
ev->data.note.note -
KeysPerOctave,
@@ -482,7 +483,7 @@ void midiALSASeq::run( void )
break;
case SND_SEQ_EVENT_CONTROLLER:
dest->processInEvent( midiEvent( CONTROL_CHANGE,
dest->processInEvent( midiEvent( MidiControlChange,
ev->data.control.channel,
ev->data.control.param,
ev->data.control.value ),
@@ -490,7 +491,8 @@ void midiALSASeq::run( void )
break;
case SND_SEQ_EVENT_PGMCHANGE:
dest->processInEvent( midiEvent( PROGRAM_CHANGE,
dest->processInEvent( midiEvent(
MidiProgramChange,
ev->data.control.channel,
ev->data.control.param,
ev->data.control.value ),
@@ -499,7 +501,7 @@ void midiALSASeq::run( void )
case SND_SEQ_EVENT_CHANPRESS:
dest->processInEvent( midiEvent(
CHANNEL_PRESSURE,
MidiChannelPressure,
ev->data.control.channel,
ev->data.control.param,
ev->data.control.value ),
@@ -507,7 +509,7 @@ void midiALSASeq::run( void )
break;
case SND_SEQ_EVENT_PITCHBEND:
dest->processInEvent( midiEvent( PITCH_BEND,
dest->processInEvent( midiEvent( MidiPitchBend,
ev->data.control.channel,
ev->data.control.value + 8192,
0 ), midiTime() );

View File

@@ -147,9 +147,9 @@ void midiClientRaw::parseData( const Uint8 _c )
*/
if( _c >= 0xF8 )
{
if( _c == MIDI_SYSTEM_RESET )
if( _c == MidiSystemReset )
{
m_midiParseData.m_midiEvent.m_type = MIDI_SYSTEM_RESET;
m_midiParseData.m_midiEvent.m_type = MidiSystemReset;
m_midiParseData.m_status = 0;
processParsedEvent();
}
@@ -232,29 +232,29 @@ void midiClientRaw::parseData( const Uint8 _c )
* We simply keep the status as it is, just reset the parameter counter.
* If another status byte comes in, it will overwrite the status.
*/
m_midiParseData.m_midiEvent.m_type = static_cast<midiEventTypes>(
m_midiParseData.m_midiEvent.m_type = static_cast<MidiEventTypes>(
m_midiParseData.m_status );
m_midiParseData.m_midiEvent.m_channel = m_midiParseData.m_channel;
m_midiParseData.m_bytes = 0; /* Related to running status! */
switch( m_midiParseData.m_midiEvent.m_type )
{
case NOTE_OFF:
case NOTE_ON:
case KEY_PRESSURE:
case PROGRAM_CHANGE:
case CHANNEL_PRESSURE:
case MidiNoteOff:
case MidiNoteOn:
case MidiKeyPressure:
case MidiProgramChange:
case MidiChannelPressure:
m_midiParseData.m_midiEvent.m_data.m_param[0] =
m_midiParseData.m_buffer[0] - KeysPerOctave;
m_midiParseData.m_midiEvent.m_data.m_param[1] =
m_midiParseData.m_buffer[1];
case CONTROL_CHANGE:
case MidiControlChange:
m_midiParseData.m_midiEvent.m_data.m_param[0] =
m_midiParseData.m_buffer[0] - KeysPerOctave;
m_midiParseData.m_midiEvent.m_data.m_param[1] =
m_midiParseData.m_buffer[1];
break;
case PITCH_BEND:
case MidiPitchBend:
// Pitch-bend is transmitted with 14-bit precision.
// Note: '|' does here the same as '+' (no common bits),
// but might be faster
@@ -293,9 +293,9 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
// TODO: also evaluate _time and queue event if neccessary
switch( _me.m_type )
{
case NOTE_ON:
case NOTE_OFF:
case KEY_PRESSURE:
case MidiNoteOn:
case MidiNoteOff:
case MidiKeyPressure:
if( _port->outputChannel() >= 0 )
{
sendByte( _me.m_type | _port->outputChannel() );
@@ -306,7 +306,7 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
}
else
{
for( Sint8 i = 0; i < MIDI_CHANNEL_COUNT; ++i )
for( Sint8 i = 0; i < MidiChannelCount; ++i )
{
sendByte( _me.m_type | i );
sendByte( _me.m_data.m_param[0] +

View File

@@ -84,7 +84,7 @@ void midiController::processInEvent( const midiEvent & _me,
const Uint8 * bytes;
switch( _me.m_type )
{
case CONTROL_CHANGE:
case MidiControlChange:
bytes = _me.m_data.m_bytes;
controllerNum = _me.m_data.m_bytes[0] & 0x7F;

View File

@@ -42,10 +42,10 @@ midiPort::midiPort( const QString & _name, midiClient * _mc,
m_midiEventProcessor( _mep ),
m_name( _name ),
m_mode( _mode ),
m_inputChannelModel( 0, 0, MIDI_CHANNEL_COUNT, this ),
m_outputChannelModel( 1, 1, MIDI_CHANNEL_COUNT, this ),
m_inputControllerModel( 0, 0, MIDI_CONTROLLER_COUNT, this ),
m_outputControllerModel( 0, 0, MIDI_CONTROLLER_COUNT, this ),
m_inputChannelModel( 0, 0, MidiChannelCount, this ),
m_outputChannelModel( 1, 1, MidiChannelCount, this ),
m_inputControllerModel( 0, 0, MidiControllerCount, this ),
m_outputControllerModel( 0, 0, MidiControllerCount, this ),
m_readableModel( FALSE, this ),
m_writableModel( FALSE, this ),
m_defaultVelocityInEnabledModel( FALSE, this ),

View File

@@ -47,11 +47,6 @@ inline notePlayHandle::baseDetuning::baseDetuning(
notePlayHandle::notePlayHandle( instrumentTrack * _it,
const f_cnt_t _offset,
const f_cnt_t _frames,
@@ -104,7 +99,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
setFrames( _frames );
// send MIDI-note-on-event
m_instrumentTrack->processOutEvent( midiEvent( NOTE_ON,
m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOn,
m_instrumentTrack->m_midiPort.outputChannel(),
key(),
tLimit<Uint16>(
@@ -302,7 +297,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
m_releaseFramesToDo = tMax<f_cnt_t>( 0, // 10,
m_instrumentTrack->m_soundShaping.releaseFrames() );
// send MIDI-note-off-event
m_instrumentTrack->processOutEvent( midiEvent( NOTE_OFF,
m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOff,
m_instrumentTrack->m_midiPort.outputChannel(),
key(), 0 ),
midiTime::fromFrames( m_framesBeforeRelease,

View File

@@ -114,7 +114,7 @@ void piano::setKeyState( int _key, bool _on )
void piano::handleKeyPress( int _key )
{
m_instrumentTrack->processInEvent( midiEvent( NOTE_ON, 0, _key,
m_instrumentTrack->processInEvent( midiEvent( MidiNoteOn, 0, _key,
DefaultVolume ), midiTime() );
m_pressedKeys[_key] = TRUE;
}
@@ -125,7 +125,7 @@ void piano::handleKeyPress( int _key )
void piano::handleKeyRelease( int _key )
{
m_instrumentTrack->processInEvent( midiEvent( NOTE_OFF, 0, _key, 0 ),
m_instrumentTrack->processInEvent( midiEvent( MidiNoteOff, 0, _key, 0 ),
midiTime() );
m_pressedKeys[_key] = FALSE;
}
@@ -351,7 +351,7 @@ void pianoView::mousePressEvent( QMouseEvent * _me )
}
// set note on
m_piano->m_instrumentTrack->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
midiEvent( MidiNoteOn, 0, key_num,
vol * 127 / 100 ),
midiTime() );
m_piano->m_pressedKeys[key_num] = TRUE;
@@ -379,7 +379,7 @@ void pianoView::mouseReleaseEvent( QMouseEvent * _me )
if( m_piano != NULL )
{
m_piano->m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ),
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_piano->m_pressedKeys[m_lastKey] = FALSE;
}
@@ -429,7 +429,7 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
if( m_lastKey != -1 )
{
m_piano->m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ),
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_piano->m_pressedKeys[m_lastKey] = FALSE;
m_lastKey = -1;
@@ -439,7 +439,7 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
if( _me->pos().y() > PIANO_BASE )
{
m_piano->m_instrumentTrack->processInEvent(
midiEvent( NOTE_ON, 0, key_num, vol ),
midiEvent( MidiNoteOn, 0, key_num, vol ),
midiTime() );
m_piano->m_pressedKeys[key_num] = TRUE;
m_lastKey = key_num;
@@ -456,7 +456,7 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me )
else if( m_piano->m_pressedKeys[key_num] == TRUE )
{
m_piano->m_instrumentTrack->processInEvent(
midiEvent( KEY_PRESSURE, 0, key_num, vol ),
midiEvent( MidiKeyPressure, 0, key_num, vol ),
midiTime() );
}
@@ -522,7 +522,7 @@ void pianoView::focusOutEvent( QFocusEvent * )
if( m_piano->m_pressedKeys[i] == TRUE )
{
m_piano->m_instrumentTrack->processInEvent(
midiEvent( NOTE_OFF, 0, i, 0 ),
midiEvent( MidiNoteOff, 0, i, 0 ),
midiTime() );
m_piano->m_pressedKeys[i] = FALSE;
}

View File

@@ -67,7 +67,7 @@ public:
virtual void processInEvent( const midiEvent & _me,
const midiTime & _time, bool _lock )
{
if( _me.m_type == CONTROL_CHANGE &&
if( _me.m_type == MidiControlChange &&
( m_midiPort.inputChannel() == _me.m_channel + 1 ||
m_midiPort.inputChannel() == 0 ) )
{

View File

@@ -1118,7 +1118,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
{
m_lastKey = key_num;
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
midiEvent( MidiNoteOn, 0, key_num,
vol * 127 / 100 ),
midiTime() );
}
@@ -1135,13 +1135,13 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me )
if( m_action == CHANGE_NOTE_VOLUME && m_currentNote != NULL )
{
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0,
midiEvent( MidiNoteOff, 0,
m_currentNote->key(), 0 ), midiTime() );
}
else
{
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ),
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
}
}
@@ -1185,7 +1185,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
_me->buttons() & Qt::LeftButton )
{
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ),
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
if( _me->buttons() & Qt::LeftButton &&
m_action != RESIZE_NOTE &&
@@ -1196,7 +1196,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
{
m_lastKey = key_num;
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_ON, 0, key_num,
midiEvent( MidiNoteOn, 0, key_num,
DefaultVolume * 127 / 100 ),
midiTime() );
}
@@ -1281,7 +1281,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
{
if( m_currentNote != NULL ) {
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_OFF, 0,
midiEvent( MidiNoteOff, 0,
m_currentNote->key(), 0 ), midiTime() );
}
@@ -1289,7 +1289,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
m_lastKey = shortNote->key();
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( NOTE_ON, 0,
midiEvent( MidiNoteOn, 0,
shortNote->key(), shortNote->getVolume() ), midiTime() );
}
}
@@ -1299,7 +1299,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
m_currentNote->setVolume( vol );
m_pattern->dataChanged();
m_pattern->getInstrumentTrack()->processInEvent(
midiEvent( KEY_PRESSURE, 0, m_lastKey,
midiEvent( MidiKeyPressure, 0, m_lastKey,
vol * 127 / 100 ),
midiTime() );
}