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 program 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 * |
28 |
#include <map> |
#include <map> |
29 |
#include "common/global.h" |
#include "common/global.h" |
30 |
#include "common/LinuxSamplerException.h" |
#include "common/LinuxSamplerException.h" |
31 |
#include "engines/common/Engine.h" |
#include "engines/common/EngineChannel.h" |
32 |
#include "drivers/midi/MidiInputDevice.h" |
#include "drivers/midi/MidiInputDevice.h" |
33 |
#include "drivers/audio/AudioOutputDevice.h" |
#include "drivers/audio/AudioOutputDevice.h" |
34 |
|
|
37 |
// just symbol prototyping |
// just symbol prototyping |
38 |
class Sampler; |
class Sampler; |
39 |
|
|
40 |
/** LinuxSampler sampler channel |
/** @brief LinuxSampler sampler channel |
41 |
* |
* |
42 |
* Encapsulates one sampler engine, one connection to a MIDI input |
* Encapsulates a channel of a specific sampler engine typ, one |
43 |
* device and one connection to an audio output device. You cannot |
* connection to a MIDI input device and one connection to an audio |
44 |
* create an instance of this class on your own, you have to use the |
* output device. You cannot create an instance of this class on your |
45 |
* AddSamplerChannel() method of the Sampler object to create a new |
* own, you have to use the AddSamplerChannel() method of the Sampler |
46 |
* sampler channel. |
* object to create a new sampler channel. |
47 |
*/ |
*/ |
48 |
class SamplerChannel { |
class SamplerChannel { |
49 |
public: |
public: |
50 |
/** |
/** |
51 |
* Deploy a sampler engine of the given type for this sampler |
* Assign a sampler engine type to this sampler channel. |
|
* channnel. If there was already a sampler engine deployed on |
|
|
* this sampler channel, then the old engine will automatically |
|
|
* be destroyed. |
|
52 |
* |
* |
53 |
* @param EngineType - type of the engine to deploy |
* @param EngineType - type of the engine to use |
54 |
|
* @throws LinuxSamplerException - if \a EngineType is invalid |
55 |
*/ |
*/ |
56 |
void LoadEngine(Engine::type_t EngineType); // TODO: to be changed to 'void LoadEngine(String EngineType) throws (LinuxSamplerException);' |
void SetEngineType(String EngineType) throw (LinuxSamplerException); |
57 |
|
|
58 |
/** |
/** |
59 |
* Connect this sampler channel to an audio output device, that |
* Connect this sampler channel to an audio output device, that |
66 |
void SetAudioOutputDevice(AudioOutputDevice* pDevice); |
void SetAudioOutputDevice(AudioOutputDevice* pDevice); |
67 |
|
|
68 |
/** |
/** |
69 |
* Connect this sampler channel to and MIDI input device. |
* Connect this sampler channel to a MIDI input device. |
70 |
* |
* |
71 |
* @param pDevice - MIDI input device to connect to |
* @param pDevice - MIDI input device to connect to |
72 |
*/ |
*/ |
73 |
void SetMidiInputDevice(MidiInputDevice *pDevice); |
void SetMidiInputDevice(MidiInputDevice *pDevice); |
74 |
|
|
75 |
/** |
/** |
76 |
* Connect this sampler channel to and MIDI input port. |
* Connect this sampler channel to a MIDI input port. |
77 |
* |
* |
78 |
* @param MidiPort - MIDI port to connect to |
* @param MidiPort - MIDI port to connect to |
79 |
*/ |
*/ |
80 |
void SetMidiInputPort(int MidiPort); |
void SetMidiInputPort(int MidiPort); |
81 |
|
|
82 |
/** |
/** |
83 |
* Connect this sampler channel to and MIDI input channel. |
* Define on which MIDI channel(s) this sampler channel should |
84 |
|
* listen to. By default, that is after creation of a new |
85 |
|
* sampler channel, the sampler channel will listen to all MIDI |
86 |
|
* channels. |
87 |
* |
* |
88 |
* @param MidiChannel - MIDI channel to connect to |
* @param MidiChannel - MIDI channel to listen |
89 |
*/ |
*/ |
90 |
void SetMidiInputChannel(MidiInputPort::midi_chan_t MidiChannel); |
void SetMidiInputChannel(MidiInputPort::midi_chan_t MidiChannel); |
91 |
|
|
101 |
void SetMidiInput(MidiInputDevice* pDevice, int iMidiPort, MidiInputPort::midi_chan_t MidiChannel = MidiInputPort::midi_chan_all); |
void SetMidiInput(MidiInputDevice* pDevice, int iMidiPort, MidiInputPort::midi_chan_t MidiChannel = MidiInputPort::midi_chan_all); |
102 |
|
|
103 |
/** |
/** |
104 |
* Returns the engine that was deployed on this sampler channel. |
* Returns the EngineChannel object that was deployed on this |
105 |
|
* sampler channel appropriate to the given sampler engine type. |
106 |
* |
* |
107 |
* @returns pointer to engine or NULL if no engine deployed |
* @returns pointer to engine or NULL if no engine deployed |
108 |
*/ |
*/ |
109 |
Engine* GetEngine(); |
EngineChannel* GetEngineChannel(); |
110 |
|
|
111 |
/** |
/** |
112 |
* Returns the MIDI input channel to which this sampler |
* Returns the MIDI input channel to which this sampler |
157 |
MidiInputPort* GetMidiInputDevicePort(int iMidiPort); |
MidiInputPort* GetMidiInputDevicePort(int iMidiPort); |
158 |
|
|
159 |
Sampler* pSampler; |
Sampler* pSampler; |
160 |
Engine* pEngine; |
EngineChannel* pEngineChannel; |
161 |
AudioOutputDevice* pAudioOutputDevice; |
AudioOutputDevice* pAudioOutputDevice; |
162 |
MidiInputDevice* pMidiInputDevice; |
MidiInputDevice* pMidiInputDevice; |
163 |
int midiPort; |
int midiPort; |
167 |
friend class Sampler; |
friend class Sampler; |
168 |
}; |
}; |
169 |
|
|
170 |
/** LinuxSampler main class |
/** @brief LinuxSampler main class |
171 |
* |
* |
172 |
* This is the toplevel class for a LinuxSampler instance. |
* This is the toplevel class for a LinuxSampler instance. |
173 |
* |
* |