354 |
|
|
355 |
/** |
/** |
356 |
* Will be called by the MIDIIn Thread to let the audio thread trigger a new |
* Will be called by the MIDIIn Thread to let the audio thread trigger a new |
357 |
* voice for the given key. |
* voice for the given key. This method is meant for real time rendering, |
358 |
|
* that is an event will immediately be created with the current system |
359 |
|
* time as time stamp. |
360 |
* |
* |
361 |
* @param Key - MIDI key number of the triggered key |
* @param Key - MIDI key number of the triggered key |
362 |
* @param Velocity - MIDI velocity value of the triggered key |
* @param Velocity - MIDI velocity value of the triggered key |
374 |
} |
} |
375 |
|
|
376 |
/** |
/** |
377 |
|
* Will be called by the MIDIIn Thread to let the audio thread trigger a new |
378 |
|
* voice for the given key. This method is meant for offline rendering |
379 |
|
* and / or for cases where the exact position of the event in the current |
380 |
|
* audio fragment is already known. |
381 |
|
* |
382 |
|
* @param Key - MIDI key number of the triggered key |
383 |
|
* @param Velocity - MIDI velocity value of the triggered key |
384 |
|
* @param FragmentPos - sample point position in the current audio |
385 |
|
* fragment to which this event belongs to |
386 |
|
*/ |
387 |
|
void EngineChannel::SendNoteOn(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) { |
388 |
|
if (FragmentPos < 0) { |
389 |
|
dmsg(1,("EngineChannel::SendNoteOn(): negative FragmentPos! Seems MIDI driver is buggy!")); |
390 |
|
} |
391 |
|
else if (pEngine) { |
392 |
|
Event event = pEngine->pEventGenerator->CreateEvent(FragmentPos); |
393 |
|
event.Type = Event::type_note_on; |
394 |
|
event.Param.Note.Key = Key; |
395 |
|
event.Param.Note.Velocity = Velocity; |
396 |
|
event.pEngineChannel = this; |
397 |
|
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
398 |
|
else dmsg(1,("EngineChannel: Input event queue full!")); |
399 |
|
} |
400 |
|
} |
401 |
|
|
402 |
|
/** |
403 |
* Will be called by the MIDIIn Thread to signal the audio thread to release |
* Will be called by the MIDIIn Thread to signal the audio thread to release |
404 |
* voice(s) on the given key. |
* voice(s) on the given key. This method is meant for real time rendering, |
405 |
|
* that is an event will immediately be created with the current system |
406 |
|
* time as time stamp. |
407 |
* |
* |
408 |
* @param Key - MIDI key number of the released key |
* @param Key - MIDI key number of the released key |
409 |
* @param Velocity - MIDI release velocity value of the released key |
* @param Velocity - MIDI release velocity value of the released key |
421 |
} |
} |
422 |
|
|
423 |
/** |
/** |
424 |
|
* Will be called by the MIDIIn Thread to signal the audio thread to release |
425 |
|
* voice(s) on the given key. This method is meant for offline rendering |
426 |
|
* and / or for cases where the exact position of the event in the current |
427 |
|
* audio fragment is already known. |
428 |
|
* |
429 |
|
* @param Key - MIDI key number of the released key |
430 |
|
* @param Velocity - MIDI release velocity value of the released key |
431 |
|
* @param FragmentPos - sample point position in the current audio |
432 |
|
* fragment to which this event belongs to |
433 |
|
*/ |
434 |
|
void EngineChannel::SendNoteOff(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) { |
435 |
|
if (FragmentPos < 0) { |
436 |
|
dmsg(1,("EngineChannel::SendNoteOff(): negative FragmentPos! Seems MIDI driver is buggy!")); |
437 |
|
} |
438 |
|
else if (pEngine) { |
439 |
|
Event event = pEngine->pEventGenerator->CreateEvent(FragmentPos); |
440 |
|
event.Type = Event::type_note_off; |
441 |
|
event.Param.Note.Key = Key; |
442 |
|
event.Param.Note.Velocity = Velocity; |
443 |
|
event.pEngineChannel = this; |
444 |
|
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
445 |
|
else dmsg(1,("EngineChannel: Input event queue full!")); |
446 |
|
} |
447 |
|
} |
448 |
|
|
449 |
|
/** |
450 |
* Will be called by the MIDIIn Thread to signal the audio thread to change |
* Will be called by the MIDIIn Thread to signal the audio thread to change |
451 |
* the pitch value for all voices. |
* the pitch value for all voices. This method is meant for real time |
452 |
|
* rendering, that is an event will immediately be created with the |
453 |
|
* current system time as time stamp. |
454 |
* |
* |
455 |
* @param Pitch - MIDI pitch value (-8192 ... +8191) |
* @param Pitch - MIDI pitch value (-8192 ... +8191) |
456 |
*/ |
*/ |
466 |
} |
} |
467 |
|
|
468 |
/** |
/** |
469 |
|
* Will be called by the MIDIIn Thread to signal the audio thread to change |
470 |
|
* the pitch value for all voices. This method is meant for offline |
471 |
|
* rendering and / or for cases where the exact position of the event in |
472 |
|
* the current audio fragment is already known. |
473 |
|
* |
474 |
|
* @param Pitch - MIDI pitch value (-8192 ... +8191) |
475 |
|
* @param FragmentPos - sample point position in the current audio |
476 |
|
* fragment to which this event belongs to |
477 |
|
*/ |
478 |
|
void EngineChannel::SendPitchbend(int Pitch, int32_t FragmentPos) { |
479 |
|
if (FragmentPos < 0) { |
480 |
|
dmsg(1,("EngineChannel::SendPitchBend(): negative FragmentPos! Seems MIDI driver is buggy!")); |
481 |
|
} |
482 |
|
else if (pEngine) { |
483 |
|
Event event = pEngine->pEventGenerator->CreateEvent(FragmentPos); |
484 |
|
event.Type = Event::type_pitchbend; |
485 |
|
event.Param.Pitch.Pitch = Pitch; |
486 |
|
event.pEngineChannel = this; |
487 |
|
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
488 |
|
else dmsg(1,("EngineChannel: Input event queue full!")); |
489 |
|
} |
490 |
|
} |
491 |
|
|
492 |
|
/** |
493 |
* Will be called by the MIDIIn Thread to signal the audio thread that a |
* Will be called by the MIDIIn Thread to signal the audio thread that a |
494 |
* continuous controller value has changed. |
* continuous controller value has changed. This method is meant for real |
495 |
|
* time rendering, that is an event will immediately be created with the |
496 |
|
* current system time as time stamp. |
497 |
* |
* |
498 |
* @param Controller - MIDI controller number of the occured control change |
* @param Controller - MIDI controller number of the occured control change |
499 |
* @param Value - value of the control change |
* @param Value - value of the control change |
504 |
event.Type = Event::type_control_change; |
event.Type = Event::type_control_change; |
505 |
event.Param.CC.Controller = Controller; |
event.Param.CC.Controller = Controller; |
506 |
event.Param.CC.Value = Value; |
event.Param.CC.Value = Value; |
507 |
|
event.pEngineChannel = this; |
508 |
|
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
509 |
|
else dmsg(1,("EngineChannel: Input event queue full!")); |
510 |
|
} |
511 |
|
} |
512 |
|
|
513 |
|
/** |
514 |
|
* Will be called by the MIDIIn Thread to signal the audio thread that a |
515 |
|
* continuous controller value has changed. This method is meant for |
516 |
|
* offline rendering and / or for cases where the exact position of the |
517 |
|
* event in the current audio fragment is already known. |
518 |
|
* |
519 |
|
* @param Controller - MIDI controller number of the occured control change |
520 |
|
* @param Value - value of the control change |
521 |
|
* @param FragmentPos - sample point position in the current audio |
522 |
|
* fragment to which this event belongs to |
523 |
|
*/ |
524 |
|
void EngineChannel::SendControlChange(uint8_t Controller, uint8_t Value, int32_t FragmentPos) { |
525 |
|
if (FragmentPos < 0) { |
526 |
|
dmsg(1,("EngineChannel::SendControlChange(): negative FragmentPos! Seems MIDI driver is buggy!")); |
527 |
|
} |
528 |
|
else if (pEngine) { |
529 |
|
Event event = pEngine->pEventGenerator->CreateEvent(FragmentPos); |
530 |
|
event.Type = Event::type_control_change; |
531 |
|
event.Param.CC.Controller = Controller; |
532 |
|
event.Param.CC.Value = Value; |
533 |
event.pEngineChannel = this; |
event.pEngineChannel = this; |
534 |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
if (this->pEventQueue->write_space() > 0) this->pEventQueue->push(&event); |
535 |
else dmsg(1,("EngineChannel: Input event queue full!")); |
else dmsg(1,("EngineChannel: Input event queue full!")); |