• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
MIDIPacketList behaviour problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MIDIPacketList behaviour problem


  • Subject: MIDIPacketList behaviour problem
  • From: Michael Harbour <email@hidden>
  • Date: Tue, 20 Jan 2004 19:20:14 +0000

Hi folks. hope you are all well.

I've got Panther, and a MIDISport 2x2 and the M-Audio USB
Support.plugin driver version 3.1

I was writing a librarian app and i was seeing packetlists not arriving
from a one-way sysex dump from a keyboard. So I tried to write a
program to look at MIDIPacketlist delivery, thinking I needed to learn
something about baud rate or something. I thought I would simulate lots
of packets coming in, by sending them out from the computer around a
loop. Connecting the MIDISport Out A to the In A ports (this is not a
silly thing to do, right?)., i tried to send out 100 midipacketlists
with various time intervals to see if all 100 return. I actually got
hundreds back - actually 127 for each one i sent out. I have pruned the
code down to the absolute minimum that replicates this bug with a
single packet squirt. 127 come back. Could somebody please tell me what
is happening here ?

Not every invocation of the program produces any result, which i also
find odd, and using InA and OutB also produces the same behaviour.

If you have a MIDISport could you please try to replicate this problem
by hooking out A to In A, compiling this code, and telling me what you
see?

Thanks,

Mike Harbour


here's the code:



public class Problem implements com.apple.audio.midi.MIDIReadProc,
com.apple.audio.midi.MIDINotifyProc
{
public static void main(String[] args)
{
Problem p = new Problem();
try{ Thread.sleep(2000);}catch(Exception e){}
p.demonstrate();
try{ Thread.sleep(2000);}catch(Exception e){}
}

protected com.apple.audio.midi.MIDIOutputPort opA = null;
protected com.apple.audio.midi.MIDIClient mc = null;
protected com.apple.audio.midi.MIDIDevice midisport = null;
protected com.apple.audio.midi.MIDIEntity portA = null;
protected com.apple.audio.midi.MIDIEndpoint INA = null;
protected com.apple.audio.midi.MIDIEndpoint OUTA = null;
protected com.apple.audio.midi.MIDIInputPort ipA = null;

public Problem()
{
try
{
mc = new com.apple.audio.midi.MIDIClient(new
com.apple.audio.util.CAFString("duh!"),this);
opA = mc.outputPortCreate(new
com.apple.audio.util.CAFString("out"));
for( int
i=0;i<com.apple.audio.midi.MIDIDevice.getNumberOfDevices();i++)
{
com.apple.audio.midi.MIDIDevice temp =
com.apple.audio.midi.MIDIDevice.getDevice(i);
if (
temp.getStringProperty(com.apple.audio.midi.MIDIConstants.kMIDIPropertyN
ame).toString().equals("2x2")){ midisport=temp; }
}
for( int i=0;i<midisport.getNumberOfEntities();i++)
{
com.apple.audio.midi.MIDIEntity temp =
midisport.getEntity(i);
if
(temp.getStringProperty(com.apple.audio.midi.MIDIConstants.kMIDIProperty
Name).toString().equals("Port A")){ portA = temp;}
}
INA = portA.getSource(0);
OUTA = portA.getDestination(0);
ipA = mc.inputPortCreate(new
com.apple.audio.util.CAFString("whatever"),this);
ipA.connectSource(INA);
}catch(Exception e) { System.out.println(e); }
}

public void demonstrate()
{
try
{
com.apple.audio.midi.MIDIPacketList list = null;
com.apple.audio.util.MIDIData md =
com.apple.audio.util.MIDIData.newMIDIPacketData(256);
md.addRawData( new byte[] { -112, 38, 67 });
list = new com.apple.audio.midi.MIDIPacketList(0, md);
opA.send(OUTA,list);
}
catch(Exception e){e.printStackTrace();}
}

protected int count = 1;
public void execute(com.apple.audio.midi.MIDIInputPort port,
com.apple.audio.midi.MIDIEndpoint srcEndPoint,
com.apple.audio.midi.MIDIPacketList list)
{ System.out.println(String.valueOf(count) + ": " +list); count++;
}
public void execute(com.apple.audio.midi.MIDIClient mc,
com.apple.audio.midi.MIDINotification mn){}
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: MIDIPacketList behaviour problem
      • From: Pete Gontier <email@hidden>
  • Prev by Date: Re: reading audiofile into floatbuffer
  • Next by Date: Re: MIDIPacketList behaviour problem
  • Previous by thread: Re: QuickTime to CoreAudio
  • Next by thread: Re: MIDIPacketList behaviour problem
  • Index(es):
    • Date
    • Thread