#include <sequencer.h>
Inheritance diagram for jdkmidi::MIDISequencerTrackProcessor:
Public Member Functions | |
MIDISequencerTrackProcessor () | |
virtual | ~MIDISequencerTrackProcessor () |
virtual void | Reset () |
virtual bool | Process (MIDITimedBigMessage *msg) |
Public Attributes | |
bool | mute |
bool | solo |
int | velocity_scale |
int | rechannel |
int | transpose |
MIDIProcessor * | extra_proc |
|
Definition at line 194 of file jdkmidi_sequencer.cpp.
00195 : 00196 mute(false), 00197 solo(false), 00198 velocity_scale(100), 00199 rechannel(-1), 00200 transpose(0), 00201 extra_proc(0) 00202 { 00203 } |
|
Definition at line 206 of file jdkmidi_sequencer.cpp.
00207 { 00208 } |
|
Implements jdkmidi::MIDIProcessor. Definition at line 221 of file jdkmidi_sequencer.cpp. References extra_proc, jdkmidi::MIDIMessage::GetNote(), jdkmidi::MIDIMessage::GetVelocity(), jdkmidi::MIDIMessage::IsChannelMsg(), jdkmidi::MIDIMessage::IsNoOp(), jdkmidi::MIDIMessage::IsNoteOff(), jdkmidi::MIDIMessage::IsNoteOn(), jdkmidi::MIDIMessage::IsPolyPressure(), mute, jdkmidi::MIDIProcessor::Process(), rechannel, jdkmidi::MIDIMessage::SetChannel(), jdkmidi::MIDIMessage::SetNote(), jdkmidi::MIDIMessage::SetVelocity(), transpose, and velocity_scale.
00222 { 00223 00224 // are we muted? 00225 00226 if( mute ) 00227 { 00228 // yes, ignore event. 00229 return false; 00230 } 00231 00232 // is the event a NoOp? 00233 00234 if( msg->IsNoOp() ) 00235 { 00236 // yes, ignore event. 00237 00238 return false; 00239 } 00240 00241 // pass the event to our extra_proc if we have one 00242 00243 if( extra_proc && extra_proc->Process(msg)==false ) 00244 { 00245 // extra_proc wanted to ignore this event 00246 return false; 00247 } 00248 00249 // is it a normal MIDI channel message? 00250 if( msg->IsChannelMsg() ) 00251 { 00252 // yes, are we to re-channel it? 00253 if( rechannel!=-1 ) 00254 { 00255 msg->SetChannel( (unsigned char)rechannel ); 00256 } 00257 00258 // is it a note on message? 00259 if( msg->IsNoteOn() && msg->GetVelocity()>0 ) 00260 { 00261 // yes, scale the velocity value as required 00262 00263 int vel = (int)msg->GetVelocity(); 00264 00265 vel = vel*velocity_scale / 100; 00266 00267 // make sure velocity is never less than 0 00268 00269 if( vel<0 ) 00270 { 00271 vel=0; 00272 } 00273 00274 // rewrite the velocity 00275 00276 msg->SetVelocity( (unsigned char)vel ); 00277 00278 } 00279 00280 // is it a type of event that needs to be transposed? 00281 00282 if( msg->IsNoteOn() || msg->IsNoteOff() || msg->IsPolyPressure() ) 00283 { 00284 int new_note = ((int)msg->GetNote())+transpose; 00285 00286 if( new_note>=0 && new_note<=127 ) 00287 { 00288 // set new note number 00289 msg->SetNote( (unsigned char)new_note ); 00290 } 00291 else 00292 { 00293 // otherwise delete this note - transposed value is out of range 00294 return false; 00295 } 00296 00297 } 00298 00299 } 00300 00301 return true; 00302 } |
|
Definition at line 211 of file jdkmidi_sequencer.cpp. References mute, rechannel, solo, transpose, and velocity_scale.
00212 { 00213 mute=false; 00214 solo=false; 00215 velocity_scale=100; 00216 rechannel=-1; 00217 transpose=0; 00218 } |
|
Definition at line 213 of file sequencer.h. |
|
Definition at line 207 of file sequencer.h. |
|
Definition at line 210 of file sequencer.h. |
|
Definition at line 208 of file sequencer.h. |
|
Definition at line 211 of file sequencer.h. |
|
Definition at line 209 of file sequencer.h. |