• 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: MusicEventIteratorSetEventTime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MusicEventIteratorSetEventTime


  • Subject: Re: MusicEventIteratorSetEventTime
  • From: Craig Bakalian <email@hidden>
  • Date: Thu, 13 Nov 2003 04:33:36 -0500

Hi,
I got it! I had a dangling reference, and needed to re-seek the
MusicEventIterator to get the changed time stamp. One other thing,
must I dispose the MusicEventIterator at the end of this function call?

-(void)moveEventsTime: (Float64)amount
{
MusicEventIterator iter;
NewMusicEventIterator([self musicTrack], &iter);
int i;
for(i=0; i< [selectedEvents count]; i++)
{
MidiEvent *me = [selectedEvents objectAtIndex: i];
MidiEventInfo mei = [me info];
MusicTimeStamp mts = mei.stamp;
MusicEventIteratorSeek(iter, mts);
MusicEventIteratorSetEventTime(iter, mts + amount);

MidiEventInfo info;
MusicEventIteratorSeek(iter, mts + amount);
MusicEventIteratorGetEventInfo(iter, &info.stamp, &info.type,
(const void **) &info.data, &info.size);
MidiEvent *changed = [[MidiEvent alloc] initWithMidiEvent:
info];
[selectedEvents replaceObjectAtIndex: i withObject: changed];
[changed release];
}
}

On Wednesday, November 12, 2003, at 07:24 PM,
email@hidden wrote:

> Hi,
> I can't think of another way to edit a music events time stamp. The
> below code is not working. How does one get a music event out of an
> MusicEventIterator and set it to a new time?
>
> -(void)moveEventsTime: (Float64)amount
> {
> MusicEventIterator iter;
> NewMusicEventIterator([self musicTrack], &iter);
> int i;
> for(i=0; i< [selectedEvents count]; i++)
> {
> MidiEvent *me = [selectedEvents objectAtIndex: i];
> MidiEventInfo mei = [me info];
> MusicTimeStamp mts = mei.stamp;
> MusicEventIteratorSeek(iter, mts);
> MusicEventIteratorSetEventTime(iter, mts + amount);
> MidiEventInfo info;
> MusicEventIteratorGetEventInfo(iter, &info.stamp, &info.type,
> (const void **) &info.data, &info.size);
> }
_______________________________________________
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: MusicEventIteratorSetEventTime
      • From: Art Gillespie <email@hidden>
  • Prev by Date: Re: AudioUnit/MusicDevice example without the SDK
  • Next by Date: Re: MusicEventIteratorSetEventTime
  • Previous by thread: Re: MusicEventIteratorSetEventTime
  • Next by thread: Re: MusicEventIteratorSetEventTime
  • Index(es):
    • Date
    • Thread