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 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 |
***************************************************************************/ |
***************************************************************************/ |
29 |
#include "engines/EngineChannelFactory.h" |
#include "engines/EngineChannelFactory.h" |
30 |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
31 |
#include "drivers/midi/MidiInputDeviceFactory.h" |
#include "drivers/midi/MidiInputDeviceFactory.h" |
32 |
|
#include "drivers/midi/MidiInstrumentMapper.h" |
33 |
#include "network/lscpserver.h" |
#include "network/lscpserver.h" |
34 |
|
|
35 |
namespace LinuxSampler { |
namespace LinuxSampler { |
109 |
} |
} |
110 |
|
|
111 |
void SamplerChannel::SetAudioOutputDevice(AudioOutputDevice* pDevice) { |
void SamplerChannel::SetAudioOutputDevice(AudioOutputDevice* pDevice) { |
112 |
|
if(pAudioOutputDevice == pDevice) return; |
113 |
|
|
114 |
// disconnect old device |
// disconnect old device |
115 |
if (pAudioOutputDevice && pEngineChannel) { |
if (pAudioOutputDevice && pEngineChannel) { |
116 |
Engine* engine = pEngineChannel->GetEngine(); |
Engine* engine = pEngineChannel->GetEngine(); |
312 |
} |
} |
313 |
} |
} |
314 |
|
|
315 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_audio_device_count, AudioOutputDevices())); |
316 |
return pDevice; |
return pDevice; |
317 |
} |
} |
318 |
|
|
349 |
// destroy and free device from memory |
// destroy and free device from memory |
350 |
delete pDevice; |
delete pDevice; |
351 |
|
|
352 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_audio_device_count, AudioOutputDevices())); |
353 |
break; |
break; |
354 |
} |
} |
355 |
} |
} |
372 |
// destroy and free device from memory |
// destroy and free device from memory |
373 |
delete pDevice; |
delete pDevice; |
374 |
|
|
375 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_device_count, MidiInputDevices())); |
376 |
break; |
break; |
377 |
} |
} |
378 |
} |
} |
390 |
} |
} |
391 |
} |
} |
392 |
|
|
393 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_midi_device_count, MidiInputDevices())); |
394 |
return pDevice; |
return pDevice; |
395 |
} |
} |
396 |
|
|
444 |
std::cerr << "Sampler::Reset(): Exception occured while trying to delete all audio output devices, exiting.\n" << std::flush; |
std::cerr << "Sampler::Reset(): Exception occured while trying to delete all audio output devices, exiting.\n" << std::flush; |
445 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
446 |
} |
} |
447 |
|
|
448 |
|
// delete MIDI instrument maps |
449 |
|
try { |
450 |
|
MidiInstrumentMapper::RemoveAllMaps(); |
451 |
|
} |
452 |
|
catch(...) { |
453 |
|
std::cerr << "Sampler::Reset(): Exception occured while trying to delete all MIDI instrument maps, exiting.\n" << std::flush; |
454 |
|
exit(EXIT_FAILURE); |
455 |
|
} |
456 |
} |
} |
457 |
|
|
458 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |