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, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 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 * |
23 |
|
|
24 |
#include "MidiInputDevice.h" |
#include "MidiInputDevice.h" |
25 |
|
|
26 |
|
#include "../../common/global_private.h" |
27 |
|
#include "../../Sampler.h" |
28 |
|
|
29 |
namespace LinuxSampler { |
namespace LinuxSampler { |
30 |
|
|
31 |
// *************** ParameterActive *************** |
// *************** ParameterActive *************** |
100 |
} |
} |
101 |
|
|
102 |
optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) { |
optional<int> MidiInputDevice::ParameterPorts::RangeMinAsInt(std::map<String,String> Parameters) { |
103 |
return optional<int>::nothing; |
return 1; |
104 |
} |
} |
105 |
|
|
106 |
optional<int> MidiInputDevice::ParameterPorts::RangeMaxAsInt(std::map<String,String> Parameters) { |
optional<int> MidiInputDevice::ParameterPorts::RangeMaxAsInt(std::map<String,String> Parameters) { |
107 |
return optional<int>::nothing; |
return 100; |
108 |
} |
} |
109 |
|
|
110 |
std::vector<int> MidiInputDevice::ParameterPorts::PossibilitiesAsInt(std::map<String,String> Parameters) { |
std::vector<int> MidiInputDevice::ParameterPorts::PossibilitiesAsInt(std::map<String,String> Parameters) { |
112 |
} |
} |
113 |
|
|
114 |
void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) { |
void MidiInputDevice::ParameterPorts::OnSetValue(int i) throw (Exception) { |
115 |
|
MidiInputDevice* dev = static_cast<MidiInputDevice*> (pDevice); |
116 |
|
Sampler* s = static_cast<Sampler*> (dev->pSampler); |
117 |
|
std::map<uint, SamplerChannel*> channels = s->GetSamplerChannels(); |
118 |
|
std::map<uint, SamplerChannel*>::iterator iter = channels.begin(); |
119 |
|
for (; iter != channels.end(); iter++) { |
120 |
|
SamplerChannel* chn = iter->second; |
121 |
|
if (chn->GetMidiInputDevice() == NULL || chn->GetMidiInputDevice() != pDevice) { |
122 |
|
continue; |
123 |
|
} |
124 |
|
|
125 |
|
int port = chn->GetMidiInputPort(); |
126 |
|
if (port >= i) { |
127 |
|
String err = "Sampler channel " + ToString(iter->first); |
128 |
|
err += " is still connected to MIDI port " + ToString(port); |
129 |
|
throw Exception(err); |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
((MidiInputDevice*)pDevice)->AcquirePorts(i); |
((MidiInputDevice*)pDevice)->AcquirePorts(i); |
134 |
} |
} |
135 |
|
|