1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler; |
24 |
|
25 |
import org.jsampler.event.AudioDeviceListListener; |
26 |
import org.jsampler.event.MidiDeviceListListener; |
27 |
import org.jsampler.event.SamplerChannelListListener; |
28 |
import org.jsampler.event.SamplerListener; |
29 |
|
30 |
import org.linuxsampler.lscp.*; |
31 |
|
32 |
|
33 |
/** |
34 |
* |
35 |
* @author Grigor Iliev |
36 |
*/ |
37 |
public interface SamplerModel { |
38 |
/** |
39 |
* Registers the specified listener for receiving event messages. |
40 |
* @param l The <code>SamplerListener</code> to register. |
41 |
*/ |
42 |
public void addSamplerListener(SamplerListener l); |
43 |
|
44 |
/** |
45 |
* Removes the specified listener. |
46 |
* @param l The <code>SamplerListener</code> to remove. |
47 |
*/ |
48 |
public void removeSamplerListener(SamplerListener l); |
49 |
|
50 |
/** |
51 |
* Registers the specified listener for receiving event messages. |
52 |
* @param listener The <code>AudioDeviceListListener</code> to register. |
53 |
*/ |
54 |
public void addAudioDeviceListListener(AudioDeviceListListener listener); |
55 |
|
56 |
/** |
57 |
* Removes the specified listener. |
58 |
* @param listener The <code>AudioDeviceListListener</code> to remove. |
59 |
*/ |
60 |
public void removeAudioDeviceListListener(AudioDeviceListListener listener); |
61 |
|
62 |
/** |
63 |
* Registers the specified listener for receiving event messages. |
64 |
* @param listener The <code>MidiDeviceListListener</code> to register. |
65 |
*/ |
66 |
public void addMidiDeviceListListener(MidiDeviceListListener listener); |
67 |
|
68 |
/** |
69 |
* Removes the specified listener. |
70 |
* @param listener The <code>MidiDeviceListListener</code> to remove. |
71 |
*/ |
72 |
public void removeMidiDeviceListListener(MidiDeviceListListener listener); |
73 |
|
74 |
/** |
75 |
* Registers the specified listener for receiving event messages. |
76 |
* @param listener The <code>SamplerChannelListListener</code> to register. |
77 |
*/ |
78 |
public void addSamplerChannelListListener(SamplerChannelListListener listener); |
79 |
|
80 |
/** |
81 |
* Removes the specified listener. |
82 |
* @param listener The <code>SamplerChannelListListener</code> to remove. |
83 |
*/ |
84 |
public void removeSamplerChannelListListener(SamplerChannelListListener listener); |
85 |
|
86 |
/** |
87 |
* Gets information about the LinuxSampler instance the front-end is connected to. |
88 |
* |
89 |
* @return <code>ServerInfo</code> instance containing |
90 |
* information about the LinuxSampler instance the front-end is connected to. |
91 |
*/ |
92 |
public ServerInfo getServerInfo(); |
93 |
|
94 |
/** |
95 |
* Gets all audio output drivers currently available for the LinuxSampler instance. |
96 |
* |
97 |
* @return <code>AudioOutputDriver</code> array containing all audio output drivers |
98 |
* currently available for the LinuxSampler instance. |
99 |
*/ |
100 |
public AudioOutputDriver[] getAudioOutputDrivers(); |
101 |
|
102 |
/** |
103 |
* Gets the model of the audio device with ID <code>deviceID</code>. |
104 |
* @param deviceID The ID of the audio device whose model should be obtained. |
105 |
* @return The model of the specified audio device or <code>null</code> |
106 |
* if there is no audio device with ID <code>deviceID</code>. |
107 |
*/ |
108 |
public AudioDeviceModel getAudioDeviceModel(int deviceID); |
109 |
|
110 |
/** |
111 |
* Gets the current number of audio devices. |
112 |
* @return The current number of audio devices. |
113 |
*/ |
114 |
public int getAudioDeviceCount(); |
115 |
|
116 |
/** |
117 |
* Gets the current list of audio device models. |
118 |
* @return The current list of audio device models. |
119 |
*/ |
120 |
public AudioDeviceModel[] getAudioDeviceModels(); |
121 |
|
122 |
/** |
123 |
* Adds the specified audio device. |
124 |
* @param device The audio device to be added. |
125 |
*/ |
126 |
public void addAudioDevice(AudioOutputDevice device); |
127 |
|
128 |
/** |
129 |
* Removes the specified audio device. |
130 |
* @param deviceID The ID of the audio device to be removed. |
131 |
* @return <code>true</code> if the audio device is removed successfully, <code>false</code> |
132 |
* if the device list does not contain audio device with ID <code>deviceID</code>. |
133 |
*/ |
134 |
public boolean removeAudioDevice(int deviceID); |
135 |
|
136 |
/** |
137 |
* Gets all MIDI input drivers currently available for the LinuxSampler instance. |
138 |
* |
139 |
* @return <code>MidiInputDriver</code> array containing all MIDI input drivers currently |
140 |
* available for the LinuxSampler instance. |
141 |
*/ |
142 |
public MidiInputDriver[] getMidiInputDrivers(); |
143 |
|
144 |
/** |
145 |
* Gets the model of the MIDI device with ID <code>deviceID</code>. |
146 |
* @param deviceID The ID of the MIDI device whose model should be obtained. |
147 |
* @return The model of the specified MIDI device or <code>null</code> |
148 |
* if there is no MIDI device with ID <code>deviceID</code>. |
149 |
*/ |
150 |
public MidiDeviceModel getMidiDeviceModel(int deviceID); |
151 |
|
152 |
/** |
153 |
* Gets the current number of MIDI input devices. |
154 |
* @return The current number of MIDI input devices. |
155 |
*/ |
156 |
public int getMidiDeviceCount(); |
157 |
|
158 |
/** |
159 |
* Gets the current list of MIDI device models. |
160 |
* @return The current list of MIDI device models. |
161 |
*/ |
162 |
public MidiDeviceModel[] getMidiDeviceModels(); |
163 |
|
164 |
/** |
165 |
* Adds the specified MIDI device. |
166 |
* @param device The MIDI device to be added. |
167 |
*/ |
168 |
public void addMidiDevice(MidiInputDevice device); |
169 |
|
170 |
/** |
171 |
* Removes the specified MIDI device. |
172 |
* @param deviceID The ID of the MIDI device to be removed. |
173 |
* @return <code>true</code> if the MIDI device is removed successfully, <code>false</code> |
174 |
* if the device list does not contain MIDI device with ID <code>deviceID</code>. |
175 |
*/ |
176 |
public boolean removeMidiDevice(int deviceID); |
177 |
|
178 |
/** |
179 |
* Gets a list of all available engines. |
180 |
* @return A list of all available engines. |
181 |
*/ |
182 |
public SamplerEngine[] getEngines(); |
183 |
|
184 |
/** |
185 |
* Gets the current list of sampler channel models. |
186 |
* @return The current list of sampler channel models. |
187 |
*/ |
188 |
public SamplerChannelModel[] getChannelModels(); |
189 |
|
190 |
/** |
191 |
* Gets the model of the sampler channel with ID <code>channelID</code>. |
192 |
* @param channelID The ID of the sampler channel whose model should be obtained. |
193 |
* @return The model of the specified sampler channel or <code>null</code> |
194 |
* if there is no channel with ID <code>channelID</code>. |
195 |
*/ |
196 |
public SamplerChannelModel getChannelModel(int channelID); |
197 |
|
198 |
/** |
199 |
* Gets the current number of sampler channels. |
200 |
* @return The current number of sampler channels. |
201 |
*/ |
202 |
public int getChannelCount(); |
203 |
|
204 |
/** |
205 |
* Creates a new sampler channel. The channel will be actually added to this model |
206 |
* when the back-end notifies for its creation. |
207 |
* @see #addChannel |
208 |
*/ |
209 |
public void createChannel(); |
210 |
|
211 |
/** |
212 |
* Adds the specified sampler channel. |
213 |
* @param channel The channel to be added. |
214 |
*/ |
215 |
public void addChannel(SamplerChannel channel); |
216 |
|
217 |
/** |
218 |
* Removes the specified sampler channel. |
219 |
* @param channelID The ID of the channel to be removed. |
220 |
* @return <code>true</code> if the channel is removed successfully, <code>false</code> |
221 |
* if the channel's list does not contain channel with ID <code>channelID</code>. |
222 |
*/ |
223 |
public boolean removeChannel(int channelID); |
224 |
|
225 |
/** |
226 |
* Updates the settings of the specified channel. |
227 |
* @param channel A <code>SamplerChannel</code> instance containing the new settings |
228 |
* for the channel. |
229 |
*/ |
230 |
public void changeChannel(SamplerChannel channel); |
231 |
|
232 |
/** |
233 |
* Determines whether there is at least one solo channel in the current list |
234 |
* of sampler channels. |
235 |
* @return <code>true</code> if there is at least one solo channel in the current list of |
236 |
* sampler channels, <code>false</code> otherwise. |
237 |
*/ |
238 |
public boolean hasSoloChannel(); |
239 |
|
240 |
/** |
241 |
* Gets the number of solo channels in the current list of sampler channels. |
242 |
* @return The number of solo channels in the current list of sampler channels. |
243 |
*/ |
244 |
public int getSoloChannelCount(); |
245 |
|
246 |
/** |
247 |
* Gets the number of muted channels in the current list of sampler channels. |
248 |
* This number includes the channels muted because of the presence of a solo channel. |
249 |
* @return The number of muted channels in the current list of sampler channels. |
250 |
*/ |
251 |
public int getMutedChannelCount(); |
252 |
|
253 |
/** |
254 |
* Gets the number of channels muted because of the presence of a solo channel. |
255 |
* @return The number of channels muted because of the presence of a solo channel. |
256 |
*/ |
257 |
public int getMutedBySoloChannelCount(); |
258 |
|
259 |
/** |
260 |
* Gets the total number of active voices. |
261 |
* @return The total number of active voices. |
262 |
*/ |
263 |
public int getTotalVoiceCount(); |
264 |
|
265 |
/** |
266 |
* Gets the maximum number of active voices. |
267 |
* @return The maximum number of active voices. |
268 |
*/ |
269 |
public int getTotalVoiceCountMax(); |
270 |
|
271 |
/** |
272 |
* Updates the current and the maximum number of active voices in the sampler. |
273 |
* @param count The new number of active voices. |
274 |
* @param countMax The maximum number of active voices. |
275 |
*/ |
276 |
public void updateActiveVoiceInfo(int count, int countMax); |
277 |
} |