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 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program 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 * |
10 |
* the Free Software Foundation; either version 2 of the License, or * |
* the Free Software Foundation; either version 2 of the License, or * |
11 |
* (at your option) any later version. * |
* (at your option) any later version. * |
12 |
* * |
* * |
13 |
* This program is distributed in the hope that it will be useful, * |
* This library is distributed in the hope that it will be useful, * |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
* GNU General Public License for more details. * |
* GNU General Public License for more details. * |
17 |
* * |
* * |
18 |
* You should have received a copy of the GNU General Public License * |
* You should have received a copy of the GNU General Public License * |
19 |
* along with this program; if not, write to the Free Software * |
* along with this library; if not, write to the Free Software * |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
* MA 02111-1307 USA * |
* MA 02111-1307 USA * |
22 |
***************************************************************************/ |
***************************************************************************/ |
452 |
if (!pSamplerChannel->GetAudioOutputDevice()) |
if (!pSamplerChannel->GetAudioOutputDevice()) |
453 |
throw LinuxSamplerException("No audio output device connected to sampler channel"); |
throw LinuxSamplerException("No audio output device connected to sampler channel"); |
454 |
if (bBackground) { |
if (bBackground) { |
455 |
LSCPLoadInstrument *pLoadInstrument = new LSCPLoadInstrument(pEngine, Filename.c_str(), uiInstrument); |
InstrumentLoader.StartNewLoad(Filename, uiInstrument, pEngine); |
|
pLoadInstrument->StartThread(); |
|
456 |
} |
} |
457 |
else pEngine->LoadInstrument(Filename.c_str(), uiInstrument); |
else pEngine->LoadInstrument(Filename.c_str(), uiInstrument); |
458 |
} |
} |
579 |
String EngineName = "NONE"; |
String EngineName = "NONE"; |
580 |
float Volume = 0.0f; |
float Volume = 0.0f; |
581 |
String InstrumentFileName = "NONE"; |
String InstrumentFileName = "NONE"; |
582 |
|
String InstrumentName = "NONE"; |
583 |
int InstrumentIndex = -1; |
int InstrumentIndex = -1; |
584 |
int InstrumentStatus = -1; |
int InstrumentStatus = -1; |
585 |
int AudioOutputChannels = 0; |
int AudioOutputChannels = 0; |
592 |
InstrumentStatus = pEngine->InstrumentStatus(); |
InstrumentStatus = pEngine->InstrumentStatus(); |
593 |
InstrumentIndex = pEngine->InstrumentIndex(); |
InstrumentIndex = pEngine->InstrumentIndex(); |
594 |
if (InstrumentIndex != -1) |
if (InstrumentIndex != -1) |
595 |
|
{ |
596 |
InstrumentFileName = pEngine->InstrumentFileName(); |
InstrumentFileName = pEngine->InstrumentFileName(); |
597 |
|
InstrumentName = pEngine->InstrumentName(); |
598 |
|
} |
599 |
for (int chan = 0; chan < pEngine->Channels(); chan++) { |
for (int chan = 0; chan < pEngine->Channels(); chan++) { |
600 |
if (AudioRouting != "") AudioRouting += ","; |
if (AudioRouting != "") AudioRouting += ","; |
601 |
AudioRouting += ToString(pEngine->OutputChannel(chan)); |
AudioRouting += ToString(pEngine->OutputChannel(chan)); |
617 |
|
|
618 |
result.Add("INSTRUMENT_FILE", InstrumentFileName); |
result.Add("INSTRUMENT_FILE", InstrumentFileName); |
619 |
result.Add("INSTRUMENT_NR", InstrumentIndex); |
result.Add("INSTRUMENT_NR", InstrumentIndex); |
620 |
|
result.Add("INSTRUMENT_NAME", InstrumentName); |
621 |
result.Add("INSTRUMENT_STATUS", InstrumentStatus); |
result.Add("INSTRUMENT_STATUS", InstrumentStatus); |
622 |
} |
} |
623 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
1406 |
} |
} |
1407 |
return result.Produce(); |
return result.Produce(); |
1408 |
} |
} |
|
|
|
|
// Instrument loader constructor. |
|
|
LSCPLoadInstrument::LSCPLoadInstrument(Engine* pEngine, String Filename, uint uiInstrument) |
|
|
: Thread(false, 0, -4) |
|
|
{ |
|
|
this->pEngine = pEngine; |
|
|
this->Filename = Filename; |
|
|
this->uiInstrument = uiInstrument; |
|
|
} |
|
|
|
|
|
// Instrument loader process. |
|
|
int LSCPLoadInstrument::Main() |
|
|
{ |
|
|
try { |
|
|
pEngine->LoadInstrument(Filename.c_str(), uiInstrument); |
|
|
} |
|
|
|
|
|
catch (LinuxSamplerException e) { |
|
|
e.PrintMessage(); |
|
|
} |
|
|
|
|
|
// Always re-enable the engine. |
|
|
pEngine->Enable(); |
|
|
|
|
|
// FIXME: Shoot ourselves on the foot? |
|
|
delete this; |
|
|
} |
|