ofxThreadedMidiPlayer
ofxThreadedMidiPlayer copied to clipboard
playback speed
great addon! works great under linux/oF0.9.8. stop is not working so well, could not start after stop. any ideas how to implement playback speed? i had a look at jdksmidi::MIDISequencer.setState, but was not obvious how to implement a changeTempo(float bpm); thanks
this seems to be working nice;)
float getBpm(){
float bpm = -1.0f;
if(sequencer){
MIDISequencerState *state = sequencer->GetState();
if(state)
for(size_t i=0; i<state->num_tracks; i++){
if(state->track_state[i]){
bpm = state->track_state[i]->tempobpm;
cout << " tempo " << i << " "<< bpm << endl;
}
}
}
return bpm;
}
bool setBpm(float bpm){
if(!sequencer){
return false;
}
MIDISequencerState *state = sequencer->GetState();
if(state)
for(size_t i=0; i<state->num_tracks; i++){
if(state->track_state[i]){
state->track_state[i]->tempobpm = bpm;
cout << " tempo " << i << " "<< bpm << endl;
}
}
return true;
}