• 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
MidiReadProc to Text Field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MidiReadProc to Text Field


  • Subject: MidiReadProc to Text Field
  • From: Haynes Electronics <email@hidden>
  • Date: Wed, 06 Mar 2013 10:54:35 -0500

I've put together a Midi application that takes input from my source (electronic) piano, modifies the velocity per a pre-defined curve, and echoes the midi packet back to the same piano. I thought this would be hard, but the Core Audio book showed me what to do. Now for the "easy" part - I would simply like to write the velocity values to a text field as the notes are played. I haven't been able to figure out how to do it !  The midiReadProc must be in another world - it apparently doesn't know anything about my world except what it gets from my midiInfo refCon :

typedef struct MIDIEchoStruct {
MIDIClientRef client;
MIDIEndpointRef dest;
MIDIPortRef inPort;
MIDIPortRef outPort;
MIDIPacketList outList;
int mNote;
int mVelIn;  // from source
int mVelOut; // to destination
int mCommand;
NSMutableArray *velocityCurve;
} MIDIEchoStruct;
MIDIEchoStruct midiInfo;
(I may have more stuff in the struct than necessary, but I like having it all together)

The program closely follows the CABook - here's the callback part :
MIDIInputPortCreate(
midiInfo.client,
CFSTR("Input port"),
MIDIEchoReadProc,
&midiInfo,
&midiInfo.inPort),
and the read proc :
void MIDIEchoReadProc(const MIDIPacketList *pktlist,
                           void *refCon,
                           void *connRefCon) {
MIDIEchoStruct *midiInfo = (MIDIEchoStruct*) refCon;
---  do midi processing --- works
--- echo to destination --- works
--- printf to console ---   works
[myTextField setIntValue:midiInfo->mVelIn];doesn't work
- or -
[self myWriteToTextfieldMethod];doesn't work - self is undefined
}

(I can manually read out the values in my text field by pressing an IBAction button, so
 the values are available)
How can I get the midiReadProc to communicate with the rest of my program ?

Thanks !
- William
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: MidiReadProc to Text Field
      • From: Kevin Dixon <email@hidden>
    • Re: MidiReadProc to Text Field
      • From: Kyle Sluder <email@hidden>
    • Re: MidiReadProc to Text Field
      • From: Michael Ellis <email@hidden>
  • Prev by Date: Audio Unit to capture sound from mic, add reverb , then send to speaker
  • Next by Date: Re: MidiReadProc to Text Field
  • Previous by thread: Audio Unit to capture sound from mic, add reverb , then send to speaker
  • Next by thread: Re: MidiReadProc to Text Field
  • Index(es):
    • Date
    • Thread