121 |
if (pAudioDevice) { |
if (pAudioDevice) { |
122 |
oldState = GetState(); |
oldState = GetState(); |
123 |
RemoveChannels(); |
RemoveChannels(); |
124 |
global->pSampler->DestroyAudioOutputDevice(pAudioDevice); |
AudioOutputDeviceFactory::DestroyPrivate(pAudioDevice); |
125 |
} |
} |
126 |
std::map<String, String> params; |
std::map<String, String> params; |
127 |
params["SAMPLERATE"] = ToString(SampleRate); |
params["SAMPLERATE"] = ToString(SampleRate); |
128 |
params["FRAGMENTSIZE"] = ToString(FragmentSize); |
params["FRAGMENTSIZE"] = ToString(FragmentSize); |
129 |
if (Channels > 0) params["CHANNELS"] = ToString(Channels); |
if (Channels > 0) params["CHANNELS"] = ToString(Channels); |
130 |
pAudioDevice = dynamic_cast<AudioOutputDevicePlugin*>( |
pAudioDevice = dynamic_cast<AudioOutputDevicePlugin*>( |
131 |
global->pSampler->CreateAudioOutputDevice(AudioOutputDevicePlugin::Name(), params)); |
AudioOutputDeviceFactory::CreatePrivate( |
132 |
|
AudioOutputDevicePlugin::Name(), params |
133 |
|
) |
134 |
|
); |
135 |
|
|
136 |
if (!pMidiDevice) { |
if (!pMidiDevice) { |
137 |
pMidiDevice = dynamic_cast<MidiInputDevicePlugin*>( |
pMidiDevice = dynamic_cast<MidiInputDevicePlugin*>( |
138 |
global->pSampler->CreateMidiInputDevice(MidiInputDevicePlugin::Name(), |
MidiInputDeviceFactory::CreatePrivate( |
139 |
std::map<String,String>())); |
MidiInputDevicePlugin::Name(), std::map<String,String>(), |
140 |
|
global->pSampler |
141 |
|
) |
142 |
|
); |
143 |
} |
} |
144 |
|
|
145 |
if (!oldState.empty()) { |
if (!oldState.empty()) { |
149 |
|
|
150 |
Plugin::~Plugin() { |
Plugin::~Plugin() { |
151 |
RemoveChannels(); |
RemoveChannels(); |
152 |
if (pAudioDevice) global->pSampler->DestroyAudioOutputDevice(pAudioDevice); |
if (pAudioDevice) AudioOutputDeviceFactory::DestroyPrivate(pAudioDevice); |
153 |
if (pMidiDevice) global->pSampler->DestroyMidiInputDevice(pMidiDevice); |
if (pMidiDevice) MidiInputDeviceFactory::DestroyPrivate(pMidiDevice); |
154 |
if (bPreInitDone) { |
if (bPreInitDone) { |
155 |
if (--global->RefCount == 0) { |
if (--global->RefCount == 0) { |
156 |
delete global; |
delete global; |