MusicEventIteratorGetEventInfo void **outEventData
MusicEventIteratorGetEventInfo void **outEventData
- Subject: MusicEventIteratorGetEventInfo void **outEventData
- From: Craig Bakalian <email@hidden>
- Date: Tue, 4 Nov 2003 15:27:26 -0500
Hi,
I am actually making a midi sequencer in objective C and Cocoa! There
is a problem, how does one get the data out of the pointer to a point
in the MusicEventIteratorGetEventInfo. Here is my objective C code. I
need to get at the data of the MidiEventInfo structure which is wrapped
in an objective C object called MidiEvent. I don't know how to
dereference the pointer to the pointer. I can access the info.stamp
and info.type and info.size.
#import <Foundation/Foundation.h>
#import <CoreMIDI/MIDIServices.h>
#import <AudioToolbox/AudioToolbox.h>
typedef struct
{
MusicTimeStamp stamp;
MusicEventType type;
UInt32 size;
void* data;
} MidiEventInfo;
@interface MidiEvent : NSObject
{
MidiEventInfo info;
}
-(id)initWithMidiEvent: (MidiEventInfo)val;
-(MidiEventInfo)info;
@end
-(NSArray *)getMidiEventsForTrack: (MusicTrack) track
{
MusicEventIterator events;
NewMusicEventIterator(track, &events);
Boolean b;
NSMutableArray *eventArray = [NSMutableArray array];
MusicEventIteratorHasNextEvent(events, &b);
while(b)
{
MidiEventInfo info;
MusicEventIteratorGetEventInfo(events, &info.stamp, &info.type,
(const void **) &info.data, &info.size);
MidiEvent *me = [[[MidiEvent alloc] initWithMidiEvent: info]
autorelease];
[eventArray addObject: me];
MusicEventIteratorHasNextEvent(events, &b);
MusicEventIteratorNextEvent(events);
}
return eventArray;
}
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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.