3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
1502 |
|
|
1503 |
bool oldSolo = pEngineChannel->GetSolo(); |
bool oldSolo = pEngineChannel->GetSolo(); |
1504 |
bool hadSoloChannel = HasSoloChannel(); |
bool hadSoloChannel = HasSoloChannel(); |
1505 |
|
|
1506 |
pEngineChannel->SetSolo(bSolo); |
pEngineChannel->SetSolo(bSolo); |
1507 |
|
|
1508 |
if(!oldSolo && bSolo) { |
if(!oldSolo && bSolo) { |
1509 |
if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0); |
if(pEngineChannel->GetMute() == -1) pEngineChannel->SetMute(0); |
1510 |
if(!hadSoloChannel) MuteNonSoloChannels(); |
if(!hadSoloChannel) MuteNonSoloChannels(); |
1511 |
} |
} |
1512 |
|
|
1513 |
if(oldSolo && !bSolo) { |
if(oldSolo && !bSolo) { |
1514 |
if(!HasSoloChannel()) UnmuteChannels(); |
if(!HasSoloChannel()) UnmuteChannels(); |
1515 |
else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1); |
else if(!pEngineChannel->GetMute()) pEngineChannel->SetMute(-1); |
1567 |
} |
} |
1568 |
} |
} |
1569 |
|
|
1570 |
String LSCPServer::AddOrReplaceMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name) { |
String LSCPServer::AddOrReplaceMIDIInstrumentMapping(uint MidiMapID, uint MidiBank, uint MidiProg, String EngineType, String InstrumentFile, uint InstrumentIndex, float Volume, MidiInstrumentMapper::mode_t LoadMode, String Name, bool bModal) { |
1571 |
dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n")); |
dmsg(2,("LSCPServer: AddOrReplaceMIDIInstrumentMapping()\n")); |
1572 |
|
|
1573 |
midi_prog_index_t idx; |
midi_prog_index_t idx; |
1585 |
|
|
1586 |
LSCPResultSet result; |
LSCPResultSet result; |
1587 |
try { |
try { |
1588 |
// PERSISTENT mapping commands might bloock for a long time, so in |
// PERSISTENT mapping commands might block for a long time, so in |
1589 |
// that case we add/replace the mapping in another thread |
// that case we add/replace the mapping in another thread in case |
1590 |
bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT); |
// the NON_MODAL argument was supplied, non persistent mappings |
1591 |
|
// should return immediately, so we don't need to do that for them |
1592 |
|
bool bInBackground = (entry.LoadMode == MidiInstrumentMapper::PERSISTENT && !bModal); |
1593 |
MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground); |
MidiInstrumentMapper::AddOrReplaceEntry(MidiMapID, idx, entry, bInBackground); |
1594 |
} catch (Exception e) { |
} catch (Exception e) { |
1595 |
result.Error(e); |
result.Error(e); |
1722 |
for (; iter != mappings.end(); iter++) { |
for (; iter != mappings.end(); iter++) { |
1723 |
if (s.size()) s += ","; |
if (s.size()) s += ","; |
1724 |
s += "{" + ToString(maps[i]) + "," |
s += "{" + ToString(maps[i]) + "," |
1725 |
+ ToString((int(iter->first.midi_bank_msb) << 7) & int(iter->first.midi_bank_lsb)) + "," |
+ ToString((int(iter->first.midi_bank_msb) << 7) | int(iter->first.midi_bank_lsb)) + "," |
1726 |
+ ToString(int(iter->first.midi_prog)) + "}"; |
+ ToString(int(iter->first.midi_prog)) + "}"; |
1727 |
} |
} |
1728 |
} |
} |
1981 |
|
|
1982 |
// success |
// success |
1983 |
result.Add("NAME", pFxSend->Name()); |
result.Add("NAME", pFxSend->Name()); |
1984 |
|
result.Add("MIDI_CONTROLLER", pFxSend->MidiController()); |
1985 |
|
result.Add("LEVEL", ToString(pFxSend->Level())); |
1986 |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
1987 |
} catch (Exception e) { |
} catch (Exception e) { |
1988 |
result.Error(e); |
result.Error(e); |
2013 |
} catch (Exception e) { |
} catch (Exception e) { |
2014 |
result.Error(e); |
result.Error(e); |
2015 |
} |
} |
2016 |
|
return result.Produce(); |
2017 |
|
} |
2018 |
|
|
2019 |
|
String LSCPServer::SetFxSendMidiController(uint uiSamplerChannel, uint FxSendID, uint MidiController) { |
2020 |
|
dmsg(2,("LSCPServer: SetFxSendMidiController()\n")); |
2021 |
|
LSCPResultSet result; |
2022 |
|
try { |
2023 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
2024 |
|
if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
2025 |
|
|
2026 |
|
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
2027 |
|
if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet"); |
2028 |
|
|
2029 |
|
FxSend* pFxSend = NULL; |
2030 |
|
for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) { |
2031 |
|
if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) { |
2032 |
|
pFxSend = pEngineChannel->GetFxSend(i); |
2033 |
|
break; |
2034 |
|
} |
2035 |
|
} |
2036 |
|
if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel"); |
2037 |
|
|
2038 |
|
pFxSend->SetMidiController(MidiController); |
2039 |
|
} catch (Exception e) { |
2040 |
|
result.Error(e); |
2041 |
|
} |
2042 |
|
return result.Produce(); |
2043 |
|
} |
2044 |
|
|
2045 |
|
String LSCPServer::SetFxSendLevel(uint uiSamplerChannel, uint FxSendID, double dLevel) { |
2046 |
|
dmsg(2,("LSCPServer: SetFxSendLevel()\n")); |
2047 |
|
LSCPResultSet result; |
2048 |
|
try { |
2049 |
|
SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); |
2050 |
|
if (!pSamplerChannel) throw Exception("Invalid sampler channel number " + ToString(uiSamplerChannel)); |
2051 |
|
|
2052 |
|
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
2053 |
|
if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet"); |
2054 |
|
|
2055 |
|
FxSend* pFxSend = NULL; |
2056 |
|
for (int i = 0; i < pEngineChannel->GetFxSendCount(); i++) { |
2057 |
|
if (pEngineChannel->GetFxSend(i)->Id() == FxSendID) { |
2058 |
|
pFxSend = pEngineChannel->GetFxSend(i); |
2059 |
|
break; |
2060 |
|
} |
2061 |
|
} |
2062 |
|
if (!pFxSend) throw Exception("There is no FxSend with that ID on the given sampler channel"); |
2063 |
|
|
2064 |
|
pFxSend->SetLevel((float)dLevel); |
2065 |
|
} catch (Exception e) { |
2066 |
|
result.Error(e); |
2067 |
|
} |
2068 |
return result.Produce(); |
return result.Produce(); |
2069 |
} |
} |
2070 |
|
|