use of blue.orchestra.GenericInstrument in project blue by kunstmusik.
the class Mixer method getMixerInstrument.
public GenericInstrument getMixerInstrument(CompileData data, OpcodeList udos, int nchnls) {
GenericInstrument instr = new GenericInstrument();
instr.setName("Blue Mixer Instrument");
StrBuilder buffer = new StrBuilder();
MixerNode node = MixerNode.getMixerGraph(this);
EffectManager manager = new EffectManager();
buffer.append(MixerNode.getMixerCode(data, this, udos, manager, node, nchnls));
buffer.append("outc ");
for (int i = 0; i < nchnls; i++) {
if (i > 0) {
buffer.append(", ");
}
buffer.append(getVar(data, master, i));
}
buffer.append("\n").append(getClearStatements(data, nchnls));
instr.setText(buffer.toString());
return instr;
}
use of blue.orchestra.GenericInstrument in project blue by kunstmusik.
the class OrchestraUtilities method parseInstruments.
public static ArrayList parseInstruments(File csoundTextFile) {
ArrayList foundInstruments = null;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(csoundTextFile));
String line = "";
String iName = "";
StringBuffer iBody = new StringBuffer();
foundInstruments = new ArrayList();
int state = 1;
while ((line = in.readLine()) != null) {
switch(state) {
case 1:
if (line.trim().startsWith("instr")) {
int index = line.indexOf(';');
if (index != -1) {
iName = line.substring(index + 1);
}
state = 2;
}
break;
case 2:
if (line.trim().startsWith("endin")) {
GenericInstrument temp = new GenericInstrument();
temp.setName(iName);
temp.setText(iBody.toString());
foundInstruments.add(temp);
iName = "";
iBody = new StringBuffer();
state = 1;
} else {
iBody.append(line).append("\n");
}
break;
}
}
} catch (Exception e) {
System.out.println(blue.BlueSystem.getString("orchestraGUI.error.instrumentParse"));
System.out.println(e);
foundInstruments = null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
System.err.println("Could not close file");
e.printStackTrace();
}
}
}
return foundInstruments;
}
use of blue.orchestra.GenericInstrument in project blue by kunstmusik.
the class FrozenSoundObject method generateInstruments.
public void generateInstruments(CompileData compileData) {
Object obj = compileData.getCompilationVariable(FSO_HAS_BEEN_COMPILED);
if (obj == null || obj != Boolean.TRUE) {
compileData.setCompilationVariable(FSO_HAS_BEEN_COMPILED, Boolean.TRUE);
String instrumentText = generateInstrumentText();
if (instrumentText == null) {
throw new RuntimeException(new SoundObjectException(this, BlueSystem.getString("audioFile.couldNotGenerate") + " " + getName()));
}
GenericInstrument temp = new GenericInstrument();
temp.setName(FSO_INSTR_NAME);
temp.setText(instrumentText);
int iNum = compileData.addInstrument(temp);
instrumentNumber = iNum;
}
}
use of blue.orchestra.GenericInstrument in project blue by kunstmusik.
the class AudioFile method generateInstrument.
public Instrument generateInstrument() {
String instrumentText = generateInstrumentText();
if (instrumentText == null) {
return null;
}
GenericInstrument temp = new GenericInstrument();
temp.setName(this.name);
temp.setText(instrumentText);
return temp;
}
use of blue.orchestra.GenericInstrument in project blue by kunstmusik.
the class Arrangement method createAlwaysOnInstrument.
private Instrument createAlwaysOnInstrument(CompileData data, InstrumentAssignment ia, Mixer mixer, int nchnls) {
Instrument instr = ia.instr;
String alwaysOnInstrCode = instr.generateAlwaysOnInstrument();
if (alwaysOnInstrCode == null || alwaysOnInstrCode.trim().isEmpty()) {
return null;
}
String transformed = convertBlueMixerOut(data, mixer, ia.arrangementId, alwaysOnInstrCode, nchnls);
GenericInstrument retVal = new GenericInstrument();
retVal.setText(transformed);
return retVal;
}
Aggregations