26 |
* Provides information about a MIDI instrument. |
* Provides information about a MIDI instrument. |
27 |
* @author Grigor Iliev |
* @author Grigor Iliev |
28 |
*/ |
*/ |
29 |
public class MidiInstrumentInfo implements Parseable { |
public class MidiInstrumentInfo extends AbstractInstrument implements Parseable { |
30 |
private int mapId = -1; |
private int mapId = -1; |
31 |
private MidiInstrumentEntry entry; |
private MidiInstrumentEntry entry; |
32 |
|
|
|
private String name = "Untitled"; |
|
33 |
private String engine; |
private String engine; |
34 |
private String instrName = "Untitled"; |
private String instrName = "Untitled"; |
|
private String path = null; |
|
|
private int instrumentIndex = 0; |
|
35 |
private double volume = 1.0; |
private double volume = 1.0; |
36 |
private LoadMode loadMode = LoadMode.DEFAULT; |
private LoadMode loadMode = LoadMode.DEFAULT; |
37 |
|
|
129 |
getMidiProgram() { return entry.getMidiProgram(); } |
getMidiProgram() { return entry.getMidiProgram(); } |
130 |
|
|
131 |
/** |
/** |
|
* Gets the name of this MIDI instrument. |
|
|
* @return The name of this MIDI instrument. |
|
|
*/ |
|
|
public String |
|
|
getName() { return name; } |
|
|
|
|
|
/** |
|
|
* Sets the name of this MIDI instrument. |
|
|
* @param name The new name of this MIDI instrument. |
|
|
*/ |
|
|
public void |
|
|
setName(String name) { this.name = name; } |
|
|
|
|
|
/** |
|
132 |
* Gets the name of the sampler engine to be used to load the instrument. |
* Gets the name of the sampler engine to be used to load the instrument. |
133 |
* @return The name of the sampler engine to be used to load the instrument. |
* @return The name of the sampler engine to be used to load the instrument. |
134 |
*/ |
*/ |
157 |
setInstrumentName(String name) { this.instrName = name; }*/ |
setInstrumentName(String name) { this.instrName = name; }*/ |
158 |
|
|
159 |
/** |
/** |
|
* Returns the absolute pathname of the instrument location. |
|
|
* @return The absolute pathname of the instrument location. |
|
|
*/ |
|
|
public String |
|
|
getFileName() { return path; } |
|
|
|
|
|
/** |
|
|
* Sets the absolute pathname of the instrument location. |
|
|
* @param path Specifies the absolute pathname of the instrument location. |
|
|
*/ |
|
|
public void |
|
|
setFileName(String path) { this.path = path; } |
|
|
|
|
|
/** |
|
|
* Returns the index of the instrument in the instrument file. |
|
|
* @return The index of the instrument in the instrument file. |
|
|
*/ |
|
|
public int |
|
|
getInstrumentIndex() { return instrumentIndex; } |
|
|
|
|
|
/** |
|
|
* Sets the index of the instrument in the instrument file. |
|
|
* @param idx The index of the instrument in the instrument file. |
|
|
*/ |
|
|
public void |
|
|
setInstrumentIndex(int idx) { instrumentIndex = idx; } |
|
|
|
|
|
/** |
|
160 |
* Returns the volume, specified for this instrument, where a |
* Returns the volume, specified for this instrument, where a |
161 |
* value < 1.0 means attenuation and a value > 1.0 means amplification. |
* value < 1.0 means attenuation and a value > 1.0 means amplification. |
162 |
*/ |
*/ |
192 |
*/ |
*/ |
193 |
public boolean |
public boolean |
194 |
parse(String s) throws LscpException { |
parse(String s) throws LscpException { |
195 |
|
if (super.parse(s)) return true; |
196 |
|
|
197 |
if(s.startsWith("NAME: ")) { |
if(s.startsWith("NAME: ")) { |
198 |
setName(s.substring("NAME: ".length())); |
setName(s.substring("NAME: ".length())); |
199 |
} else if(s.startsWith("ENGINE_NAME: ")) { |
} else if(s.startsWith("ENGINE_NAME: ")) { |
200 |
setEngine(s.substring("ENGINE_NAME: ".length())); |
setEngine(s.substring("ENGINE_NAME: ".length())); |
|
} else if(s.startsWith("INSTRUMENT_FILE: ")) { |
|
|
setFileName(s.substring("INSTRUMENT_FILE: ".length())); |
|
|
} else if(s.startsWith("INSTRUMENT_NR: ")) { |
|
|
s = s.substring("INSTRUMENT_NR: ".length()); |
|
|
setInstrumentIndex(Parser.parseInt(s)); |
|
201 |
} else if(s.startsWith("INSTRUMENT_NAME: ")) { |
} else if(s.startsWith("INSTRUMENT_NAME: ")) { |
202 |
instrName = s.substring("INSTRUMENT_NAME: ".length()); |
instrName = s.substring("INSTRUMENT_NAME: ".length()); |
203 |
} else if(s.startsWith("LOAD_MODE: ")) { |
} else if(s.startsWith("LOAD_MODE: ")) { |