FWIW, if you want the whole sequence to loop, you can set a user event at
the end of the sequence and use the callback to trigger a reset of the time
to the start of the sequence.
-(void)handleUserEvent:(NSValue *)theEventValue{
UserEvent theEvent;
[theEventValue getValue:&theEvent];
switch(theEvent.type){
case UserExitEvent:
if (self.looping){
[self skipToTime:0];
} else {
[self stop];
}
break;
default:
break;
}
if (self.userEventBlock != nil){
self.userEventBlock(theEvent);
}
}
-(void)skipToTime:(NSTimeInterval)time{
MusicPlayerStop(self.player);
MusicPlayerSetTime(self.player, time);
MusicPlayerStart(self.player);
}
void MidiUserCallback (
void *inClientData,
MusicSequence inSequence,
MusicTrack inTrack,
MusicTimeStamp inEventTime,
const MusicEventUserData *inEventData,
MusicTimeStamp inStartSliceBeat,
MusicTimeStamp inEndSliceBeat
){
UserEvent *theEvent = (UserEvent *)inEventData;
MidiFilePlayer *player = (__bridge MidiFilePlayer *)inClientData;
NSValue *eventValue = [NSValue valueWithBytes:theEvent objCType:@encode(
UserEvent )];
dispatch_async(dispatch_get_main_queue(), ^(){
[player handleUserEvent:eventValue ];
});
}
On Fri, Oct 2, 2015 at 7:52 AM, Jack Nutting <[email protected]> wrote:
> Ugh, that's really unfortunate. Thanks for the update.
>
> // Jack Nutting
> // [email protected]
> // http://nuthole.com
> // http://learncocoa.org
>
> On Oct 2, 2015, at 3:40 PM, Nikolozi Meladze <[email protected]> wrote:
>
> It's still happening on both 9.0.3 and 9.1b3
>
> On 2 Oct 2015, at 10:23 PM, Jack Nutting <[email protected]> wrote:
>
> Has anyone tried this in 9.0.2 yet? I may have an upcoming need for this
> to work, and it would be interesting to know if it's been fixed.
>
> //jack
>
> On Sun, Sep 27, 2015 at 3:21 AM, Nikolozi Meladze <[email protected]>
> wrote:
>
>> Just wondering if there’s an update when we might see a fix for this
>> issue. My App Store app is not working for iOS 9 users :(
>>
>> It’s still happening on iOS 9.0.1 and iOS 9.1 beta 2. I can reproduce it
>> on all my devices, iPhone 6, iPad Air 2 and iPod Touch 5th gen.
>>
>> Cheers
>> Niko
>>
>> ------------------------------
>>
>> - *Subject*: *Re: MusicPlayer in iOS9*
>> - From: Douglas Scott <email@hidden>
>> - Date: Tue, 25 Aug 2015 10:32:45 -0700
>>
>> ------------------------------
>> This is a known issue that will be fixed in an upcoming release. It was
>> not reported in time to be fixed in 9.0.
>>
>> -DS
>>
>> On Aug 24, 2015, at 4:39 PM, Sam Tarakajian <email@hidden> wrote:
>>
>> Hi,
>>
>> I'm working on an app that uses MusicPlayer to play a looping MIDI track.
>> However, I've found that in the iOS 9 beta looping no longer seems to work.
>>
>> I start by creating a very simple AUGraph, with just an AUSampler and a
>> remoteIO node in the graph. Then I create a MusicPlayer, a MusicSequence
>> and a MusicTrack. I set the length of the track to be 4, the loop length to
>> 4 and the number of loops to 0 (infinite looping). I add four midi note
>> messages to this track, all of duration 0.5, with timestamps 0, 1, 2 and 3.
>>
>> When I start the music player, I hear the first three notes play
>> correctly. However, audio processing stalls before the final note, and
>> calling MusicPlayerGetTime on the music player returns a timestamp just
>> before the last note in the track.
>>
>> Any idea what I might be doing wrong? The code works as expected (playing
>> an infinite loop) in iOS 8.4
>>
>> https://gist.github.com/starakaj/cc1a68c9b13c08d98dd4 is basically what
>> I'm trying to do.
>>
>> Thanks,
>> -Sam
>>
>>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Coreaudio-api mailing list ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/coreaudio-api/jnutting%40gmail.com
>>
>> This email sent to [email protected]
>>
>
>
>
> --
> // Jack Nutting
> // [email protected]
> // http://nuthole.com
> // http://learncocoa.org
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/coreaudio-api/apps%40nikolozi.com
>
> This email sent to [email protected]
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
> https://lists.apple.com/mailman/options/coreaudio-api/wil.macaulay%40gmail.com
>
> This email sent to [email protected]
>
--
The Craic app: http://thecraic.co abc tunes on the iPad and iPhone
Sideband app: http://sideband.co slow down, loop and change the key. Learn
by ear.
Products and services: http://flagpig.com
Twitter: @tom_frog
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]