47 |
* occured. The dispatch* methods here will automatically forward the |
* occured. The dispatch* methods here will automatically forward the |
48 |
* MIDI event to the appropriate, connected sampler engines. |
* MIDI event to the appropriate, connected sampler engines. |
49 |
*/ |
*/ |
50 |
class MidiInputDevice { |
class MidiInputDevice : public InputOutputDevice { |
51 |
public: |
public: |
52 |
|
|
53 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
55 |
|
|
56 |
class ParameterActive : public DeviceCreationParameterBool { |
class ParameterActive : public DeviceCreationParameterBool { |
57 |
public: |
public: |
58 |
ParameterActive(MidiInputDevice *pDevice) {this->pDevice = pDevice; InitWithDefault(); } |
ParameterActive( void ) : DeviceCreationParameterBool() { InitWithDefault(); } |
59 |
ParameterActive(MidiInputDevice* pDevice, String active) throw (LinuxSamplerException) : DeviceCreationParameterBool(active) { this->pDevice = pDevice; } |
ParameterActive( String active ) : DeviceCreationParameterBool(active) { } |
60 |
virtual String Description() { return "Enable / disable device"; } |
virtual String Description() { return "Enable / disable device"; } |
61 |
virtual bool Fix() { return false; } |
virtual bool Fix() { return false; } |
62 |
virtual bool Mandatory() { return false; } |
virtual bool Mandatory() { return false; } |
63 |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() { return std::map<String,DeviceCreationParameter*>(); } |
64 |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters) { return true; } |
virtual optional<bool> DefaultAsBool(std::map<String,String> Parameters) { return true; } |
65 |
virtual void OnSetValue(bool b) throw (LinuxSamplerException) { if (b) pDevice->Listen(); else pDevice->StopListen(); } |
virtual void OnSetValue(bool b) throw (LinuxSamplerException) { if (b) ((MidiInputDevice*)pDevice)->Listen(); else ((MidiInputDevice*)pDevice)->StopListen(); } |
66 |
protected: |
static String Name( void ) { return "active"; } |
|
MidiInputDevice* pDevice; |
|
67 |
}; |
}; |
68 |
|
|
69 |
class ParameterPorts : public DeviceCreationParameterInt { |
class ParameterPorts : public DeviceCreationParameterInt { |
70 |
public: |
public: |
71 |
ParameterPorts(MidiInputDevice* pDevice) { this->pDevice = pDevice; InitWithDefault();} |
ParameterPorts( void ) : DeviceCreationParameterInt() { InitWithDefault(); } |
72 |
ParameterPorts(MidiInputDevice* pDevice, String val) throw (LinuxSamplerException) : DeviceCreationParameterInt(val) { this->pDevice = pDevice; } |
ParameterPorts( String val ) : DeviceCreationParameterInt(val) { } |
73 |
virtual String Description() { return "Number of ports"; } |
virtual String Description() { return "Number of ports"; } |
74 |
virtual bool Fix() { return false; } |
virtual bool Fix() { return false; } |
75 |
virtual bool Mandatory() { return false; } |
virtual bool Mandatory() { return false; } |
78 |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
79 |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) { return optional<int>::nothing; } |
80 |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) { return std::vector<int>(); } |
81 |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { pDevice->AcquirePorts(i); } |
virtual void OnSetValue(int i) throw (LinuxSamplerException) { ((MidiInputDevice*)pDevice)->AcquirePorts(i); } |
82 |
protected: |
static String Name( void ) { return "ports"; } |
|
MidiInputDevice* pDevice; |
|
83 |
}; |
}; |
84 |
|
|
85 |
class MidiInputPort { |
class MidiInputPort { |
225 |
*/ |
*/ |
226 |
virtual MidiInputPort* CreateMidiPort( void ) = 0; |
virtual MidiInputPort* CreateMidiPort( void ) = 0; |
227 |
|
|
|
template <class Parameter_T> |
|
|
class OptionalParameter { |
|
|
public: |
|
|
static Parameter_T* New(MidiInputDevice* pDevice, String val) { if (val == "") return (new Parameter_T(pDevice)); return (new Parameter_T(pDevice, val)); } |
|
|
}; |
|
|
|
|
|
static std::map<String,DeviceCreationParameter*> AvailableParameters(); |
|
228 |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
std::map<String,DeviceCreationParameter*> DeviceParameters(); |
229 |
|
|
230 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
262 |
|
|
263 |
friend class Sampler; // allow Sampler class to destroy midi devices |
friend class Sampler; // allow Sampler class to destroy midi devices |
264 |
|
|
|
private: |
|
|
static std::map<String,DeviceCreationParameter*> CreateAvailableParameters(); |
|
|
|
|
265 |
/** |
/** |
266 |
* Set number of MIDI ports required by the engine |
* Set number of MIDI ports required by the engine |
267 |
* This can either do nothing, create more ports |
* This can either do nothing, create more ports |