41 |
|
|
42 |
/** |
/** |
43 |
* This class is the abstraction representing a client endpoint for communication with LinuxSampler |
* This class is the abstraction representing a client endpoint for communication with LinuxSampler |
44 |
* instance. Since it implements all commands specified in the LSCP protocol v1.2, for more |
* instance. Since it implements all commands specified in the LSCP protocol v1.3, for more |
45 |
* information look at the |
* information look at the |
46 |
* <a href=http://www.linuxsampler.org/api/lscp-1.2.html>LSCP</a> specification. |
* <a href=http://www.linuxsampler.org/api/lscp-1.3.html>LSCP</a> specification. |
47 |
* |
* |
48 |
* <p> The following code establishes connection to LinuxSampler instance and gets the |
* <p> The following code establishes connection to LinuxSampler instance and gets the |
49 |
* LinuxSampler version: |
* LinuxSampler version: |
589 |
private synchronized void |
private synchronized void |
590 |
fireDeviceMidiDataEvent(String s) { |
fireDeviceMidiDataEvent(String s) { |
591 |
try { |
try { |
592 |
String[] list = parseStringList(s, ' '); |
String[] list = parseList(s, ' '); |
593 |
if(list.length != 5) { |
if(list.length != 5) { |
594 |
getLogger().warning("Unknown DEVICE_MIDI format"); |
getLogger().warning("Unknown DEVICE_MIDI format"); |
595 |
return; |
return; |
618 |
private synchronized void |
private synchronized void |
619 |
fireChannelMidiDataEvent(String s) { |
fireChannelMidiDataEvent(String s) { |
620 |
try { |
try { |
621 |
String[] list = parseStringList(s, ' '); |
String[] list = parseList(s, ' '); |
622 |
if(list.length != 4) { |
if(list.length != 4) { |
623 |
getLogger().warning("Unknown CHANNEL_MIDI format"); |
getLogger().warning("Unknown CHANNEL_MIDI format"); |
624 |
return; |
return; |
4013 |
ResultSet rs = getEmptyResultSet(); |
ResultSet rs = getEmptyResultSet(); |
4014 |
} |
} |
4015 |
|
|
4016 |
|
/** |
4017 |
|
* Sends a MIDI event to this sampler channel. |
4018 |
|
* @param samplerChn The sampler channel number. |
4019 |
|
* @param type The type of MIDI message to send. |
4020 |
|
* @throws IOException If some I/O error occurs. |
4021 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4022 |
|
* @throws LSException If <code>samplerChn</code> is not a valid channel number or if |
4023 |
|
* there is no instrument loaded on the specified sampler channel. |
4024 |
|
* @see #getSamplerChannels |
4025 |
|
*/ |
4026 |
|
public synchronized void |
4027 |
|
sendChannelMidiData(int samplerChn, MidiDataEvent.Type type, int arg1, int arg2) |
4028 |
|
throws IOException, LscpException, LSException { |
4029 |
|
|
4030 |
|
verifyConnection(); |
4031 |
|
StringBuffer sb = new StringBuffer(); |
4032 |
|
sb.append("SEND CHANNEL MIDI_DATA "); |
4033 |
|
sb.append(type).append(" ").append(samplerChn).append(" "); |
4034 |
|
sb.append(arg1).append(" ").append(arg2); |
4035 |
|
|
4036 |
|
out.writeLine(sb.toString()); |
4037 |
|
if(getPrintOnlyMode()) return; |
4038 |
|
|
4039 |
|
ResultSet rs = getEmptyResultSet(); |
4040 |
|
} |
4041 |
|
|
4042 |
|
/** |
4043 |
|
* Resets the specified sampler channel. |
4044 |
|
* |
4045 |
|
* @param samplerChn The sampler channel number. |
4046 |
|
* |
4047 |
|
* @throws IOException If some I/O error occurs. |
4048 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4049 |
|
* @throws LSException If <code>samplerChn</code> is not a valid channel number or if |
4050 |
|
* there is no engine assigned yet to the specified sampler channel. |
4051 |
|
* @see #getSamplerChannels |
4052 |
|
*/ |
4053 |
|
public synchronized void |
4054 |
|
resetChannel(int samplerChn) throws IOException, LscpException, LSException { |
4055 |
|
verifyConnection(); |
4056 |
|
out.writeLine("RESET CHANNEL " + samplerChn); |
4057 |
|
if(getPrintOnlyMode()) return; |
4058 |
|
|
4059 |
|
ResultSet rs = getEmptyResultSet(); |
4060 |
|
} |
4061 |
|
|
4062 |
|
|
4063 |
|
|
4064 |
/** |
/** |
5163 |
if(getPrintOnlyMode()) return; |
if(getPrintOnlyMode()) return; |
5164 |
|
|
5165 |
ResultSet rs = getEmptyResultSet(); |
ResultSet rs = getEmptyResultSet(); |
|
} |
|
|
|
|
|
/** |
|
|
* Resets the specified sampler channel. |
|
|
* |
|
|
* @param samplerChn The sampler channel number. |
|
|
* |
|
|
* @throws IOException If some I/O error occurs. |
|
|
* @throws LscpException If LSCP protocol corruption occurs. |
|
|
* @throws LSException If <code>samplerChn</code> is not a valid channel number or if |
|
|
* there is no engine assigned yet to the specified sampler channel. |
|
|
* @see #getSamplerChannels |
|
|
*/ |
|
|
public synchronized void |
|
|
resetChannel(int samplerChn) throws IOException, LscpException, LSException { |
|
|
verifyConnection(); |
|
|
out.writeLine("RESET CHANNEL " + samplerChn); |
|
|
if(getPrintOnlyMode()) return; |
|
|
|
|
|
ResultSet rs = getEmptyResultSet(); |
|
5166 |
} |
} |
5167 |
|
|
5168 |
/** |
/** |