• 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: MusicSequenceFileCreate fails to save tracks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MusicSequenceFileCreate fails to save tracks


  • Subject: Re: MusicSequenceFileCreate fails to save tracks
  • From: Valentin Radu <email@hidden>
  • Date: Mon, 15 Dec 2014 01:35:11 +0200

Following up with more information. I found that the culprit is MusicSequenceNewTrack. What happens is, the code below is not an accurate representation of what I’m actually doing, I tried to simplify the example and end up oversimplifying. 

The problem seems to be that MusicSequenceNewTrack returns immediately and if you try to call MusicSequenceFileCreate right after it, the track will not be added to the file. If, instead you wait, let’s say 1 second and then call it, the track will be added to the file. Now, what’s strange is that calling CAShow on the sequence actually shows the track, even if you do it right after adding it. So, the track is there and it’s accessible, I can’t see why, MusicSequenceFileCreate doesn’t work.

Does anybody have any idea on how I can handle this, except for waiting for a certain amount of time before calling the create file function?


On 12 Dec 2014, at 03:07, Valentin Radu <email@hidden> wrote:

Hi everybody,


I’m trying to save a sequence to disk but it seems MusicSequenceFileCreate doesn’t work for some reason. In the code below, there is no error thrown, however, when doing a CAShow on the testSequence, I can see it's not the same as the old sequence,  all the tracks are missing. The only, let’s say odd, thing about the tracks is that they have a user event with some data at timestamp 0. Did anyone encountered issue this before? Any pointers on why this is happening? Is is a bug? 

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                             NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *midiPath = [documentsDirectory
                              stringByAppendingPathComponent:@"test.mid"];
        NSURL* url = "" style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">NSURL alloc] initFileURLWithPath:midiPath];
        
        VRC(MusicSequenceFileCreate(sequence, (__bridge CFURLRef)url, kMusicSequenceFile_MIDIType, kMusicSequenceFileFlags_EraseFile, 0));
        
        MusicSequence testSequence;
        VRC(NewMusicSequence(&testSequence));
        VRC(MusicSequenceFileLoad(testSequence, (__bridge CFURLRef)url, kMusicSequenceFile_MIDIType, 0));


Valentin Radu
codewisesystems.com
cocoaexposed.com
Valentin Radu
codewisesystems.com
cocoaexposed.com

 _______________________________________________
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

  • Follow-Ups:
    • Re: MusicSequenceFileCreate fails to save tracks
      • From: Valentin Radu <email@hidden>
References: 
 >MusicSequenceFileCreate fails to save tracks (From: Valentin Radu <email@hidden>)

  • Prev by Date: AUFilePlayer how to calculate start sampleTime from seconds?
  • Next by Date: Re: MusicSequenceFileCreate fails to save tracks
  • Previous by thread: MusicSequenceFileCreate fails to save tracks
  • Next by thread: Re: MusicSequenceFileCreate fails to save tracks
  • Index(es):
    • Date
    • Thread