355 |
subscribe("DB_INSTRUMENT_DIRECTORY_INFO"); |
subscribe("DB_INSTRUMENT_DIRECTORY_INFO"); |
356 |
subscribe("DB_INSTRUMENT_COUNT"); |
subscribe("DB_INSTRUMENT_COUNT"); |
357 |
subscribe("DB_INSTRUMENT_INFO"); |
subscribe("DB_INSTRUMENT_INFO"); |
358 |
|
subscribe("DB_INSTRUMENTS_JOB_INFO"); |
359 |
} |
} |
360 |
if(!llGI.isEmpty()) subscribe("GLOBAL_INFO"); |
if(!llGI.isEmpty()) subscribe("GLOBAL_INFO"); |
361 |
} |
} |
2804 |
} |
} |
2805 |
|
|
2806 |
/** |
/** |
2807 |
* Gets all MIDI instrument contained int the specified MIDI instrument map. |
* Gets all MIDI instrument entries contained int the specified MIDI instrument map. |
2808 |
|
* @param mapId The ID of the map, which instruments should be obtained. |
2809 |
|
* @return An int array providing all MIDI instrument entries |
2810 |
|
* in the specified MIDI instrument map. |
2811 |
|
* @throws IOException If some I/O error occurs. |
2812 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
2813 |
|
* @throws LSException If some other error occurs. |
2814 |
|
*/ |
2815 |
|
public synchronized int[][] |
2816 |
|
getMidiInstrumentEntries(int mapId) throws IOException, LscpException, LSException { |
2817 |
|
verifyConnection(); |
2818 |
|
out.writeLine("LIST MIDI_INSTRUMENTS " + String.valueOf(mapId)); |
2819 |
|
if(getPrintOnlyMode()) return null; |
2820 |
|
|
2821 |
|
String[] entries = parseArray(getSingleLineResultSet().getResult()); |
2822 |
|
int[][] e = new int[entries.length][3]; |
2823 |
|
|
2824 |
|
for(int i = 0; i < entries.length; i++) { |
2825 |
|
Integer[] vals = parseIntList(entries[i]); |
2826 |
|
if(vals.length != 3) { |
2827 |
|
throw new LscpException(LscpI18n.getLogMsg("CommandFailed!")); |
2828 |
|
} |
2829 |
|
|
2830 |
|
e[i][0] = vals[0]; |
2831 |
|
e[i][1] = vals[1]; |
2832 |
|
e[i][2] = vals[2]; |
2833 |
|
} |
2834 |
|
|
2835 |
|
return e; |
2836 |
|
} |
2837 |
|
|
2838 |
|
/** |
2839 |
|
* Gets all MIDI instruments contained int the specified MIDI instrument map. |
2840 |
* @param mapId The ID of the map, which instruments should be obtained. |
* @param mapId The ID of the map, which instruments should be obtained. |
2841 |
* @return A <code>MidiInstrumentInfo</code> array providing |
* @return A <code>MidiInstrumentInfo</code> array providing |
2842 |
* all MIDI instruments from all MIDI instrument maps. |
* all MIDI instruments in the specified MIDI instrument map. |
2843 |
* @throws IOException If some I/O error occurs. |
* @throws IOException If some I/O error occurs. |
2844 |
* @throws LscpException If LSCP protocol corruption occurs. |
* @throws LscpException If LSCP protocol corruption occurs. |
2845 |
* @throws LSException If some other error occurs. |
* @throws LSException If some other error occurs. |
2887 |
throws IOException, LscpException, LSException { |
throws IOException, LscpException, LSException { |
2888 |
|
|
2889 |
verifyConnection(); |
verifyConnection(); |
2890 |
|
requestMidiInstrumentInfo(mapId, bank, program); |
2891 |
|
return getMidiInstrumentInfoResponse(mapId, bank, program); |
2892 |
|
} |
2893 |
|
|
2894 |
|
private void |
2895 |
|
requestMidiInstrumentInfo(int mapId, int bank, int program) throws IOException { |
2896 |
StringBuffer cmd = new StringBuffer("GET MIDI_INSTRUMENT INFO "); |
StringBuffer cmd = new StringBuffer("GET MIDI_INSTRUMENT INFO "); |
2897 |
cmd.append(mapId).append(' '); |
cmd.append(mapId).append(' '); |
2898 |
cmd.append(bank).append(' '); |
cmd.append(bank).append(' '); |
2899 |
cmd.append(program); |
cmd.append(program); |
2900 |
|
|
2901 |
out.writeLine(cmd.toString()); |
out.writeLine(cmd.toString()); |
2902 |
if(getPrintOnlyMode()) return null; |
} |
2903 |
|
|
2904 |
|
private MidiInstrumentInfo |
2905 |
|
getMidiInstrumentInfoResponse(int mapId, int bank, int program) |
2906 |
|
throws IOException, LscpException, LSException { |
2907 |
|
|
2908 |
|
if(getPrintOnlyMode()) return null; |
2909 |
ResultSet rs = getMultiLineResultSet(); |
ResultSet rs = getMultiLineResultSet(); |
2910 |
MidiInstrumentEntry entry = new MidiInstrumentEntry(bank, program); |
MidiInstrumentEntry entry = new MidiInstrumentEntry(bank, program); |
2911 |
return new MidiInstrumentInfo(mapId, entry, rs.getMultiLineResult()); |
return new MidiInstrumentInfo(mapId, entry, rs.getMultiLineResult()); |