24 |
|
|
25 |
#include "Sampler.h" |
#include "Sampler.h" |
26 |
|
|
27 |
#include "audiodriver/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
28 |
#include "mididriver/MidiInputDeviceFactory.h" |
#include "drivers/midi/MidiInputDeviceFactory.h" |
29 |
#include "engines/gig/Engine.h" |
#include "engines/gig/Engine.h" |
30 |
|
|
31 |
namespace LinuxSampler { |
namespace LinuxSampler { |
92 |
void SamplerChannel::SetMidiInputDevice(MidiInputDevice* pDevice) { |
void SamplerChannel::SetMidiInputDevice(MidiInputDevice* pDevice) { |
93 |
SetMidiInput(pDevice, this->midiPort, this->midiChannel); |
SetMidiInput(pDevice, this->midiPort, this->midiChannel); |
94 |
} |
} |
95 |
|
|
96 |
void SamplerChannel::SetMidiInputPort(int MidiPort) { |
void SamplerChannel::SetMidiInputPort(int MidiPort) { |
97 |
SetMidiInput(pMidiInputDevice, MidiPort, this->midiChannel); |
SetMidiInput(pMidiInputDevice, MidiPort, this->midiChannel); |
98 |
} |
} |
99 |
|
|
100 |
void SamplerChannel::SetMidiInputChannel(MidiInputDevice::MidiInputPort::midi_chan_t MidiChannel) { |
void SamplerChannel::SetMidiInputChannel(MidiInputDevice::MidiInputPort::midi_chan_t MidiChannel) { |
101 |
SetMidiInput(pMidiInputDevice, this->midiPort, MidiChannel); |
SetMidiInput(pMidiInputDevice, this->midiPort, MidiChannel); |
102 |
} |
} |
103 |
|
|
104 |
void SamplerChannel::SetMidiInput(MidiInputDevice* pDevice, int MidiPort, MidiInputDevice::MidiInputPort::midi_chan_t MidiChannel) { |
void SamplerChannel::SetMidiInput(MidiInputDevice* pDevice, int MidiPort, MidiInputDevice::MidiInputPort::midi_chan_t MidiChannel) { |
105 |
// dereference old midi input port. |
// dereference old midi input port. |
106 |
MidiInputDevice::MidiInputPort *pMidiInputPort = GetMidiInputDevicePort(this->midiPort); |
MidiInputDevice::MidiInputPort *pMidiInputPort = GetMidiInputDevicePort(this->midiPort); |
234 |
// create new device |
// create new device |
235 |
AudioOutputDevice* pDevice = AudioOutputDeviceFactory::Create(AudioDriver, Parameters); |
AudioOutputDevice* pDevice = AudioOutputDeviceFactory::Create(AudioDriver, Parameters); |
236 |
|
|
|
// activate device |
|
|
pDevice->Play(); |
|
|
|
|
237 |
// add new audio device to the audio device list |
// add new audio device to the audio device list |
238 |
for (uint i = 0; ; i++) { // seek for a free place starting from the beginning |
for (uint i = 0; ; i++) { // seek for a free place starting from the beginning |
239 |
if (!mAudioOutputDevices[i]) { |
if (!mAudioOutputDevices[i]) { |
305 |
// create new device |
// create new device |
306 |
MidiInputDevice* pDevice = MidiInputDeviceFactory::Create(MidiDriver, Parameters); |
MidiInputDevice* pDevice = MidiInputDeviceFactory::Create(MidiDriver, Parameters); |
307 |
|
|
|
// activate device |
|
|
pDevice->Listen(); |
|
|
|
|
308 |
// add new device to the midi device list |
// add new device to the midi device list |
309 |
for (uint i = 0; ; i++) { // seek for a free place starting from the beginning |
for (uint i = 0; ; i++) { // seek for a free place starting from the beginning |
310 |
if (!mMidiInputDevices[i]) { |
if (!mMidiInputDevices[i]) { |