coreaudio - java - first note in sequence is dropped
coreaudio - java - first note in sequence is dropped
- Subject: coreaudio - java - first note in sequence is dropped
- From: Tom Pimienta <email@hidden>
- Date: Mon, 10 May 2004 14:06:11 -0700
I am trying ( in java ) to make a MusicPlayer object play a
MusicSequence I created to the MIDIEndpoint object that represents
PortA on my MIDISport 2x2 USB interface. It works but the first note
in the sequence is usually not heard!
If the same sequence is played using whatever the default internal
endpoint is, everything is OK. Unfortunately I don't have another MIDI
interface to test this with.
More details:
I have OS X 10.2.8, java version 1.4.1_01-69.1
I am making my own MIDIData and loading it into a track - a nice C
major scale
to send output to PortA on MidiSport 2x2 I call...
track.setDestMIDIEndpoint( MIDISetup.getDestination( 0 ) );
...
What vital tidbit am I missing?
Thanks,
-Tom.
Here is the code, snipped from my junit test.....
public void testMusicPlayer()
{
try
{
//ms is a MusicSequence object obtained via ms = new MusicSequence()
track = ms.newTrack();
//set endpoint destination
//if I leave this line out, sequence plays over computer's internal
spkrs and sounds OK!
track.setDestMIDIEndpoint( MIDISetup.getDestination( 0 ) );
//add some MIDIData...C major scale
data1 = MIDIData.newMIDINoteMessage( 0, 60, 90, 1f );
MIDIData data2 = MIDIData.newMIDINoteMessage( 0, 62, 90, 1f );
//etc...
//put data into track
track.newMIDINoteEvent( 0d, data1 );
track.newMIDINoteEvent( 1d, data2 );
//etc..
//try to play!
MusicPlayer mp = new MusicPlayer();
mp.setSequence( ms );
assertTrue( !mp.isPlaying() );
System.out.println( "starting" );
mp.start();
assertTrue( mp.isPlaying() );
try
{
//wait around so we can hear output, otherwise junit will exit
Thread.sleep( 8000 );
}
catch( InterruptedException x ){}
}
catch( Exception x )
{
x.printStackTrace( System.err );
assertTrue( false );
}
}
_______________________________________________
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.