1 |
/* |
/* |
2 |
Copyright (C) 2008 - 2012 Christian Schoenebeck |
Copyright (C) 2008 - 2014 Christian Schoenebeck |
3 |
*/ |
*/ |
4 |
|
|
5 |
#include "VirtualMidiDevice.h" |
#include "VirtualMidiDevice.h" |
80 |
if (p->events.write_space() <= 0) return false; |
if (p->events.write_space() <= 0) return false; |
81 |
p->events.push(&ev); |
p->events.push(&ev); |
82 |
return true; |
return true; |
83 |
|
} |
84 |
|
|
85 |
|
bool VirtualMidiDevice::SendPitchBendToSampler(int Pitch) { |
86 |
|
if (Pitch < -8192 || Pitch > 8191) return false; |
87 |
|
Pitch += 8192; |
88 |
|
// order: LSB, MSB like it would be in a regular pitch bend MIDI message |
89 |
|
event_t ev = { EVENT_TYPE_PITCHBEND, Pitch & 0x7f, (Pitch >> 7) & 0x7f }; |
90 |
|
if (p->events.write_space() <= 0) return false; |
91 |
|
p->events.push(&ev); |
92 |
|
return true; |
93 |
|
} |
94 |
|
|
95 |
|
bool VirtualMidiDevice::SendProgramChangeToSampler(int Program) { |
96 |
|
if (Program < 0 || Program > 127) return false; |
97 |
|
event_t ev = { EVENT_TYPE_PROGRAM, Program, 0 }; |
98 |
|
if (p->events.write_space() <= 0) return false; |
99 |
|
p->events.push(&ev); |
100 |
|
return true; |
101 |
} |
} |
102 |
|
|
103 |
bool VirtualMidiDevice::GetMidiEventFromDevice(event_t& Event) { |
bool VirtualMidiDevice::GetMidiEventFromDevice(event_t& Event) { |