Java, DLSSynth, DefaultOutput, Midi event playing.
Java, DLSSynth, DefaultOutput, Midi event playing.
- Subject: Java, DLSSynth, DefaultOutput, Midi event playing.
- From: email@hidden
- Date: Mon, 2 Sep 2002 08:32:52 +0200
Hi I think the following code should make some sort of noise when run.
Any suggestions on why it doesn't?
public class BasicMidi {
public static void main (String args[]) {
// insert code here...
try {
AUGraph graph = new AUGraph();
// Open the DLS Synth
ComponentDescription description = new
ComponentDescription();
description.setType(AUConstants.kAudioUnitComponentType);
description.setSubType(AUConstants.kAudioUnitSubType_MusicDevice);
description.setManufacturer(AUConstants.kAudioUnitID_DLSSynth);
AUNode synthNode = graph.newNode(description);;
// Open the output device
description.setType(AUConstants.kAudioUnitComponentType);
description.setSubType(AUConstants.kAudioUnitSubType_Output);
description.setManufacturer(AUConstants.kAudioUnitID_DefaultOutput);
AUNode outputNode = graph.newNode(description);;
// Connect the devices up
graph.connectNodeInput(synthNode, 1, outputNode, 0);
graph.update(true);
// Open and initialize the audio units
graph.open();
graph.initialize();
// Start playing
graph.start();
// send the event to the synth
// use the MusicDeviceMIDIEvent() call.
MusicDevice synthUnit = (MusicDevice)
graph.getNodeInfo_AudioUnit(synthNode);
ExtendedNoteParams noteParameters = new
ExtendedNoteParams(new float[] {0f, 60f, 127f, 0f});
synthUnit.startNote(10, 0, 0, noteParameters);
synthUnit.stopNote(10, 0, 0);
} catch (CAException exception) {
exception.printStackTrace();
System.exit(1);
}
// end of story.
System.out.println("Hello World!");
}
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.