#include <sequencer.h>
Inheritance diagram for jdkmidi::MIDISequencerTrackState:
Public Member Functions | |
MIDISequencerTrackState (MIDISequencer *seq_, int trk, MIDISequencerGUIEventNotifier *n) | |
virtual | ~MIDISequencerTrackState () |
virtual void | GoToZero () |
virtual void | Reset () |
virtual bool | Process (MIDITimedBigMessage *msg) |
Public Attributes | |
float | tempobpm |
int | pg |
int | volume |
int | timesig_numerator |
int | timesig_denominator |
int | bender_value |
char | track_name [256] |
bool | got_good_track_name |
bool | notes_are_on |
MIDIMatrix | note_matrix |
|
Definition at line 307 of file jdkmidi_sequencer.cpp. References track_name.
00312 : 00313 MIDISequencerTrackNotifier( seq_, trk, n ), 00314 tempobpm( 120.0 ), 00315 volume(100), 00316 timesig_numerator(4), 00317 timesig_denominator(4), 00318 bender_value(0), 00319 got_good_track_name(false), 00320 notes_are_on(false), 00321 note_matrix() 00322 { 00323 *track_name = 0; 00324 } |
|
Definition at line 327 of file jdkmidi_sequencer.cpp.
00328 { 00329 } |
|
Definition at line 331 of file jdkmidi_sequencer.cpp. References bender_value, jdkmidi::MIDIMatrix::Clear(), note_matrix, tempobpm, timesig_denominator, and timesig_numerator.
00332 { 00333 tempobpm = 120.0; 00334 timesig_numerator=4; 00335 timesig_denominator=4; 00336 bender_value=0; 00337 note_matrix.Clear(); 00338 } |
|
Implements jdkmidi::MIDIProcessor. Definition at line 354 of file jdkmidi_sequencer.cpp. References bender_value, jdkmidi::C_MAIN_VOLUME, jdkmidi::FixQuotes(), jdkmidi::MIDIMessage::GetBenderValue(), jdkmidi::MIDISystemExclusive::GetBuf(), jdkmidi::MIDIMessage::GetController(), jdkmidi::MIDIMessage::GetControllerValue(), jdkmidi::MIDISystemExclusive::GetLength(), jdkmidi::MIDIMessage::GetMetaType(), jdkmidi::MIDIMessage::GetPGValue(), jdkmidi::MIDIBigMessage::GetSysEx(), jdkmidi::MIDIMessage::GetTempo32(), jdkmidi::MIDITimedBigMessage::GetTime(), jdkmidi::MIDIMessage::GetTimeSigDenominator(), jdkmidi::MIDIMessage::GetTimeSigNumerator(), jdkmidi::MIDIMatrix::GetTotalCount(), jdkmidi::MIDIMessage::GetType(), got_good_track_name, jdkmidi::MIDIMessage::IsChannelMsg(), jdkmidi::MIDIMessage::IsControlChange(), jdkmidi::MIDIMessage::IsMetaEvent(), jdkmidi::MIDIMessage::IsNoOp(), jdkmidi::MIDIMessage::IsProgramChange(), jdkmidi::MIDIMessage::IsTempo(), jdkmidi::META_GENERIC_TEXT, jdkmidi::META_INSTRUMENT_NAME, jdkmidi::META_TIMESIG, jdkmidi::META_TRACK_NAME, note_matrix, notes_are_on, jdkmidi::MIDISequencerTrackNotifier::Notify(), jdkmidi::MIDISequencerTrackNotifier::NotifyConductor(), pg, jdkmidi::PITCH_BEND, jdkmidi::MIDIMatrix::Process(), tempobpm, timesig_denominator, timesig_numerator, track_name, and volume.
00355 { 00356 // is the event a NoOp? 00357 00358 if( msg->IsNoOp() ) 00359 { 00360 // yes, ignore event. 00361 00362 return false; 00363 } 00364 00365 // is it a normal MIDI channel message? 00366 if( msg->IsChannelMsg() ) 00367 { 00368 00369 if( msg->GetType()==PITCH_BEND ) // is it a bender event? 00370 { 00371 // yes 00372 // remember the bender wheel value 00373 00374 bender_value = msg->GetBenderValue(); 00375 } 00376 else if( msg->IsControlChange() ) // is it a control change event? 00377 { 00378 // yes 00379 00380 // is it a volume change event? 00381 00382 if( msg->GetController()==C_MAIN_VOLUME ) 00383 { 00384 // yes, store the current volume level 00385 volume = msg->GetControllerValue(); 00386 00387 Notify( 00388 MIDISequencerGUIEvent::GROUP_TRACK_VOLUME 00389 ); 00390 } 00391 } 00392 else if( msg->IsProgramChange() ) // is it a program change event? 00393 { 00394 // yes 00395 00396 // update the current program change value 00397 pg = msg->GetPGValue(); 00398 00399 Notify( 00400 MIDISequencerGUIEvent::GROUP_TRACK_PG 00401 ); 00402 } 00403 00404 } 00405 else 00406 { 00407 // event is not a channel message. is it a meta-event? 00408 if( msg->IsMetaEvent() ) 00409 { 00410 // yes, is it a tempo event 00411 if( msg->IsTempo() ) 00412 { 00413 // yes get the current tempo 00414 00415 tempobpm = ((float)msg->GetTempo32())*(1.0f/32.0f); 00416 if(tempobpm<1 ) 00417 { 00418 tempobpm=120.0; 00419 } 00420 00421 NotifyConductor( 00422 MIDISequencerGUIEvent::GROUP_CONDUCTOR_TEMPO 00423 ); 00424 } 00425 else // is it a time signature event? 00426 if( msg->GetMetaType()==META_TIMESIG ) 00427 { 00428 // yes, extract the current numerator and denominator 00429 00430 timesig_numerator = msg->GetTimeSigNumerator(); 00431 timesig_denominator = msg->GetTimeSigDenominator(); 00432 00433 NotifyConductor( 00434 MIDISequencerGUIEvent::GROUP_CONDUCTOR_TIMESIG 00435 ); 00436 00437 } 00438 else // is it a track name event? 00439 if( ( msg->GetMetaType()==META_TRACK_NAME 00440 || msg->GetMetaType()==META_INSTRUMENT_NAME 00441 || (!got_good_track_name && msg->GetMetaType()==META_GENERIC_TEXT && msg->GetTime()==0) 00442 ) 00443 && 00444 msg->GetSysEx() ) 00445 { 00446 got_good_track_name = true; 00447 00448 // yes, copy the track name 00449 int len = msg->GetSysEx()->GetLength(); 00450 00451 if( len>(int)sizeof(track_name)-1 ) 00452 len=(int)sizeof(track_name)-1; 00453 00454 memcpy(track_name, msg->GetSysEx()->GetBuf(), len ); 00455 00456 track_name[len]='\0'; 00457 00458 FixQuotes( track_name ); 00459 00460 Notify( 00461 MIDISequencerGUIEvent::GROUP_TRACK_NAME 00462 ); 00463 00464 } 00465 00466 } 00467 00468 } 00469 00470 // pass the message to our note matrix to keep track of all notes on 00471 // on this track 00472 00473 if( note_matrix.Process( *msg ) ) 00474 { 00475 // did the "any notes on" status change? 00476 00477 if( ( notes_are_on && note_matrix.GetTotalCount()==0) 00478 || (!notes_are_on && note_matrix.GetTotalCount()>0 ) ) 00479 { 00480 // yes, toggle our notes_are_on flag 00481 notes_are_on = !notes_are_on; 00482 00483 // and notify the gui about the activity on this track 00484 Notify( 00485 MIDISequencerGUIEvent::GROUP_TRACK_NOTE 00486 ); 00487 } 00488 } 00489 00490 00491 return true; 00492 } |
|
Definition at line 340 of file jdkmidi_sequencer.cpp. References bender_value, jdkmidi::MIDIMatrix::Clear(), got_good_track_name, note_matrix, notes_are_on, tempobpm, timesig_denominator, timesig_numerator, track_name, and volume.
00341 { 00342 tempobpm = 120.0; 00343 volume=100; 00344 notes_are_on=false; 00345 timesig_numerator=4; 00346 timesig_denominator=4; 00347 bender_value=0; 00348 *track_name=0; 00349 note_matrix.Clear(); 00350 got_good_track_name=false; 00351 } |
|
Definition at line 236 of file sequencer.h. |
|
Definition at line 238 of file sequencer.h. |
|
Definition at line 241 of file sequencer.h. |
|
Definition at line 240 of file sequencer.h. |
|
Definition at line 232 of file sequencer.h. |
|
Definition at line 231 of file sequencer.h. |
|
Definition at line 235 of file sequencer.h. |
|
Definition at line 234 of file sequencer.h. |
|
Definition at line 237 of file sequencer.h. |
|
Definition at line 233 of file sequencer.h. |