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 * |
* Copyright (C) 2005, 2006 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 * |
61 |
REGISTER_MIDI_INPUT_DRIVER_PARAMETER(MidiInputDeviceMidiShare, ParameterPorts); |
REGISTER_MIDI_INPUT_DRIVER_PARAMETER(MidiInputDeviceMidiShare, ParameterPorts); |
62 |
#endif // HAVE_MIDISHARE |
#endif // HAVE_MIDISHARE |
63 |
|
|
64 |
MidiInputDevice* MidiInputDeviceFactory::Create(String DriverName, std::map<String,String> Parameters, Sampler* pSampler) throw (LinuxSamplerException) { |
MidiInputDevice* MidiInputDeviceFactory::Create(String DriverName, std::map<String,String> Parameters, Sampler* pSampler) throw (Exception) { |
65 |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no midi input driver '" + DriverName + "'."); |
if (!InnerFactories.count(DriverName)) throw Exception("There is no midi input driver '" + DriverName + "'."); |
66 |
//Let's see if we need to create parameters |
//Let's see if we need to create parameters |
67 |
std::map<String,DeviceCreationParameter*> thisDeviceParams; |
std::map<String,DeviceCreationParameter*> thisDeviceParams; |
68 |
DeviceParameterFactory* pParamFactory = ParameterFactories[DriverName]; |
DeviceParameterFactory* pParamFactory = ParameterFactories[DriverName]; |
70 |
thisDeviceParams = pParamFactory->CreateAllParams(Parameters); |
thisDeviceParams = pParamFactory->CreateAllParams(Parameters); |
71 |
} else { |
} else { |
72 |
//No parameters are registered by the driver. Throw if any parameters were specified. |
//No parameters are registered by the driver. Throw if any parameters were specified. |
73 |
if (Parameters.size() != 0) throw LinuxSamplerException("Driver '" + DriverName + "' does not have any parameters."); |
if (Parameters.size() != 0) throw Exception("Driver '" + DriverName + "' does not have any parameters."); |
74 |
} |
} |
75 |
//Now create the device using those parameters |
//Now create the device using those parameters |
76 |
MidiInputDevice* pDevice = InnerFactories[DriverName]->Create(thisDeviceParams, pSampler); |
MidiInputDevice* pDevice = InnerFactories[DriverName]->Create(thisDeviceParams, pSampler); |
102 |
return result; |
return result; |
103 |
} |
} |
104 |
|
|
105 |
std::map<String,DeviceCreationParameter*> MidiInputDeviceFactory::GetAvailableDriverParameters(String DriverName) throw (LinuxSamplerException) { |
std::map<String,DeviceCreationParameter*> MidiInputDeviceFactory::GetAvailableDriverParameters(String DriverName) throw (Exception) { |
106 |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no midi input driver '" + DriverName + "'."); |
if (!InnerFactories.count(DriverName)) throw Exception("There is no midi input driver '" + DriverName + "'."); |
107 |
std::map<String,DeviceCreationParameter*> thisDeviceParams; |
std::map<String,DeviceCreationParameter*> thisDeviceParams; |
108 |
DeviceParameterFactory* pParamFactory = ParameterFactories[DriverName]; |
DeviceParameterFactory* pParamFactory = ParameterFactories[DriverName]; |
109 |
if (pParamFactory) { |
if (pParamFactory) { |
112 |
return thisDeviceParams; |
return thisDeviceParams; |
113 |
} |
} |
114 |
|
|
115 |
DeviceCreationParameter* MidiInputDeviceFactory::GetDriverParameter(String DriverName, String ParameterName) throw (LinuxSamplerException) { |
DeviceCreationParameter* MidiInputDeviceFactory::GetDriverParameter(String DriverName, String ParameterName) throw (Exception) { |
116 |
std::map<String,DeviceCreationParameter*> parameters = GetAvailableDriverParameters(DriverName); |
std::map<String,DeviceCreationParameter*> parameters = GetAvailableDriverParameters(DriverName); |
117 |
if (!parameters.count(ParameterName)) throw LinuxSamplerException("Midi input driver '" + DriverName + "' does not have a parameter '" + ParameterName + "'."); |
if (!parameters.count(ParameterName)) throw Exception("Midi input driver '" + DriverName + "' does not have a parameter '" + ParameterName + "'."); |
118 |
return parameters[ParameterName]; |
return parameters[ParameterName]; |
119 |
} |
} |
120 |
|
|
121 |
String MidiInputDeviceFactory::GetDriverDescription(String DriverName) throw (LinuxSamplerException) { |
String MidiInputDeviceFactory::GetDriverDescription(String DriverName) throw (Exception) { |
122 |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no midi input driver '" + DriverName + "'."); |
if (!InnerFactories.count(DriverName)) throw Exception("There is no midi input driver '" + DriverName + "'."); |
123 |
return InnerFactories[DriverName]->Description(); |
return InnerFactories[DriverName]->Description(); |
124 |
} |
} |
125 |
|
|
126 |
String MidiInputDeviceFactory::GetDriverVersion(String DriverName) throw (LinuxSamplerException) { |
String MidiInputDeviceFactory::GetDriverVersion(String DriverName) throw (Exception) { |
127 |
if (!InnerFactories.count(DriverName)) throw LinuxSamplerException("There is no midi input driver '" + DriverName + "'."); |
if (!InnerFactories.count(DriverName)) throw Exception("There is no midi input driver '" + DriverName + "'."); |
128 |
return InnerFactories[DriverName]->Version(); |
return InnerFactories[DriverName]->Version(); |
129 |
} |
} |
130 |
|
|