953 |
* |
* |
954 |
* @param pData - pointer to sysex data |
* @param pData - pointer to sysex data |
955 |
* @param Size - lenght of sysex data (in bytes) |
* @param Size - lenght of sysex data (in bytes) |
956 |
|
* @param pSender - the MIDI input port on which the SysEx message was |
957 |
|
* received |
958 |
*/ |
*/ |
959 |
void Engine::SendSysex(void* pData, uint Size) { |
void Engine::SendSysex(void* pData, uint Size, MidiInputPort* pSender) { |
960 |
Event event = pEventGenerator->CreateEvent(); |
Event event = pEventGenerator->CreateEvent(); |
961 |
event.Type = Event::type_sysex; |
event.Type = Event::type_sysex; |
962 |
event.Param.Sysex.Size = Size; |
event.Param.Sysex.Size = Size; |
963 |
event.pEngineChannel = NULL; // as Engine global event |
event.pEngineChannel = NULL; // as Engine global event |
964 |
|
event.pMidiInputPort = pSender; |
965 |
if (pEventQueue->write_space() > 0) { |
if (pEventQueue->write_space() > 0) { |
966 |
if (pSysexBuffer->write_space() >= Size) { |
if (pSysexBuffer->write_space() >= Size) { |
967 |
// copy sysex data to input buffer |
// copy sysex data to input buffer |
1904 |
switch (sub_id1) { |
switch (sub_id1) { |
1905 |
case 0x04: // Device Control |
case 0x04: // Device Control |
1906 |
switch (sub_id2) { |
switch (sub_id2) { |
1907 |
case 0x01: // Master Volume |
case 0x01: { // Master Volume |
1908 |
GLOBAL_VOLUME = |
const double volume = |
1909 |
double((uint(val_msb)<<7) | uint(val_lsb)) / 16383.0; |
double((uint(val_msb)<<7) | uint(val_lsb)) / 16383.0; |
1910 |
|
#if CONFIG_MASTER_VOLUME_SYSEX_BY_PORT |
1911 |
|
// apply volume to all sampler channels that |
1912 |
|
// are connected to the same MIDI input port |
1913 |
|
// this sysex message arrived on |
1914 |
|
for (int i = 0; i < engineChannels.size(); ++i) { |
1915 |
|
EngineChannel* pEngineChannel = engineChannels[i]; |
1916 |
|
if (pEngineChannel->GetMidiInputPort() == |
1917 |
|
itSysexEvent->pMidiInputPort) |
1918 |
|
{ |
1919 |
|
pEngineChannel->Volume(volume); |
1920 |
|
} |
1921 |
|
} |
1922 |
|
#else |
1923 |
|
// apply volume globally to the whole sampler |
1924 |
|
GLOBAL_VOLUME = volume; |
1925 |
|
#endif // CONFIG_MASTER_VOLUME_SYSEX_BY_PORT |
1926 |
break; |
break; |
1927 |
|
} |
1928 |
} |
} |
1929 |
break; |
break; |
1930 |
} |
} |
1973 |
if (!reader.pop(&map)) goto free_sysex_data; |
if (!reader.pop(&map)) goto free_sysex_data; |
1974 |
for (int i = 0; i < engineChannels.size(); ++i) { |
for (int i = 0; i < engineChannels.size(); ++i) { |
1975 |
EngineChannel* pEngineChannel = engineChannels[i]; |
EngineChannel* pEngineChannel = engineChannels[i]; |
1976 |
if (pEngineChannel->midiChannel == part || |
if ( |
1977 |
pEngineChannel->midiChannel == midi_chan_all |
(pEngineChannel->midiChannel == part || |
1978 |
|
pEngineChannel->midiChannel == midi_chan_all) && |
1979 |
|
pEngineChannel->GetMidiInputPort() == itSysexEvent->pMidiInputPort |
1980 |
) { |
) { |
1981 |
try { |
try { |
1982 |
pEngineChannel->SetMidiInstrumentMap(map); |
pEngineChannel->SetMidiInstrumentMap(map); |
2134 |
} |
} |
2135 |
|
|
2136 |
String Engine::Version() { |
String Engine::Version() { |
2137 |
String s = "$Revision: 1.94 $"; |
String s = "$Revision: 1.96 $"; |
2138 |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
2139 |
} |
} |
2140 |
|
|