Editing a looping MusicTrack as it plays
Editing a looping MusicTrack as it plays
- Subject: Editing a looping MusicTrack as it plays
- From: Neil Wallace <email@hidden>
- Date: Fri, 13 Jan 2012 10:16:00 +0000
- Thread-topic: Editing a looping MusicTrack as it plays
Hi,
I am just getting to grips with MusicPlayer, MusicSequence et al on iOS5 and as a first app I thought I’d write a little drum machine. I have loaded the drums into an AUSampler from a .aupreset file and then I create a MusicTrack for each
drum (so that I can mute/solo each) I set the tracks
kSequenceTrackProperty_LoopInfo and kSequenceTrackProperty_TrackLength
appropriately. So far so good – I now have my drum loop playing nicely.
The problem comes when I start to edit the track as it plays – occasionally when I add or remove a note from the track the entire track will stop playing. After quite a bit of testing to try and find a pattern the way that I can get this
to happen most regularly is to add or remove a note to start of the track just at it loops or slightly before it loops (it does not seem to occur if I do this just after the track has looped). There also seems to be a link between the length of the recorded
sample and size of the zone where toggling a note on/off will cause problems – the closed hi-hat which is short has a much smaller ‘problem zone’ than the longer kick drum (in all cases however the
duration of the
MidiNoteMessage added to the track is the same).
When adding a new note to the track I just use a call to
MusicTrackNewMIDINoteEvent. When removing a note I have tried both calling
MusicTrackClear and re-adding all the notes for that track as well as iterating over the events in the track and removing the specific one at the
correct time step. I also tried re-setting the loop info and track length after editing a track in case this was getting lost in the edit.
Am I doing something fundamentally wrong here? I have tried everything that I can think off to fix this problem but haven’t come up with anything that helps.
Thanks in advance,
Neil
|
_______________________________________________
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