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

Re: MidiReadProc to Text Field


  • Subject: Re: MidiReadProc to Text Field
  • From: Michael Ellis <email@hidden>
  • Date: Wed, 06 Mar 2013 11:13:46 -0500

Offhand (and I do mean offhand -- I'm not an Xcode/ObjC expert),  I'd suggest looking for a way to give the GUI side of your app a reference to your echo struct and write some code on the GUI side that causes your text field to detect changes in the velocity member and self-update.  This has the advantage that the GUI will be doing the work in its idle loop between piano key events.   

Hopefully someone with more experience can provide the details you need or suggest a different approach altogether.

Cheers,
Mike


On Wed, Mar 6, 2013 at 10:54 AM, Haynes Electronics <email@hidden> wrote:
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


 _______________________________________________
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

References: 
 >MidiReadProc to Text Field (From: Haynes Electronics <email@hidden>)

  • Prev by Date: MidiReadProc to Text Field
  • Next by Date: Re: MidiReadProc to Text Field
  • Previous by thread: MidiReadProc to Text Field
  • Next by thread: Re: MidiReadProc to Text Field
  • Index(es):
    • Date
    • Thread