How to correctly allocating CFStrings in an AudioFileRegionList?
How to correctly allocating CFStrings in an AudioFileRegionList?
- Subject: How to correctly allocating CFStrings in an AudioFileRegionList?
- From: Charles Constant <email@hidden>
- Date: Wed, 14 Sep 2016 20:53:31 -0700
I'm having a rather bad time getting AudioFileSetProperty to write an AudioFileRegionList to a CAF file. I suspect the problem is the way that I'm allocating CFStrings.
Is this an appropriate way to allocate CFStrings when setting a marker.mName or region.mName?
rgn->mName = CFStringCreateWithFormat( kCFAllocatorDefault, NULL, CFSTR("Region-%d"), r );
My problem is that if I try to create a List that contains more than one Region, as soon as I call AudioFileSetProperty, I get "EXC_BAD_ACCESS." This happens unless I use a very small quantity of regions and markers. The debugger shows the exact place where AudioFileSetProperty falls over as either "CFStringGetLength" or "CAFRegion_NtoB(CAFRegion*)".
If I create only a single Region, and then use afinfo to view my file, I get this type of thing:
MacBook-Pro:~ username$ afinfo /Users/username/UnitTest_CAF_ANSI_C.caf
File: /Users/username/UnitTest_CAF_ANSI_C.caf
Data format: 1 ch, 44100 Hz, 'lpcm' (0x0000000E) 16-bit big-endian signed integer
estimated duration: 5.001315 sec
bit rate: 705600 bits per second
packet size upper bound: 2
audio data file offset: 4096
audio 220558 valid frames + 0 priming + 0 remainder = 220558
1 regions; SMPTE time type 0 (none)
region 1, "Region-0", flags 00000000
marker 990, "Marker-990": frame 100 SMPTE time 0:00:00:00/0 type 1935828327 ('sbeg') channel 0
marker 991, "<unnnamed>": frame 200 SMPTE time 0:00:00:00/0 type 1936027236 ('send') channel 0
marker 992, "<unnnamed>": frame 300 SMPTE time 0:00:00:00/0 type 1935828327 ('sbeg') channel 0
The names should be "Marker-990" "Marker-991" "Marker-992" and so on.
Anyone have any ideas? I'm stumped, and after three days working on this, I can't find much outside information.
Thanks,
Charles
_______________________________________________
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