Re: PlayFile-based code crashes on multichannel wav
Re: PlayFile-based code crashes on multichannel wav
- Subject: Re: PlayFile-based code crashes on multichannel wav
- From: William Stewart <email@hidden>
- Date: Mon, 16 Jan 2006 18:26:38 -0800
it looks like you are crashing because you aren't catching the
exception...
Just put a try-catch block around this (the problematic file doesn't
have a channel layout I guess)
Bill
On 16/01/2006, at 5:02 PM, Michael Hanna wrote:
I have a simple app that is based on the PlayFile example. It crashes
on a particular multichannel wav file. The file WILL play in AU Lab
and QuickTime Player 7.
strangely, a different multichannel wav file plays properly.
crashing file:
http://siddha.ca/mymusic/samples/multichannel/qwave.wav
non-crashing file:
http://siddha.ca/mymusic/samples/multichannel/drmapan.wav
code section:
// if we have a surround file, then we should try to tell the output
AU what the order of the channels will be
if (fFileFormat.NumberChannels() > 2) {
UInt32 layoutSize = 0;
OSStatus err;
NSLog(@"before AudioFileGetPropertyInfo");
XThrowIfError (err = AudioFileGetPropertyInfo (fAudioFile,
kAudioFilePropertyChannelLayout, &layoutSize, NULL),
"kAudioFilePropertyChannelLayout");
NSLog(@"after AudioFileGetPropertyInfo");
if (!err && layoutSize) {
char* layout = new char[layoutSize];
err = AudioFileGetProperty(fAudioFile,
kAudioFilePropertyChannelLayout, &layoutSize, layout);
XThrowIfError (err, "Get Layout From AudioFile");
// ok, now get the output AU and set its layout
XThrowIfError (AUGraphGetNodeInfo(fGraph, outputNode, NULL, NULL,
NULL, &fileAU), "AUGraphGetNodeInfo");
err = AudioUnitSetProperty (fileAU,
kAudioUnitProperty_AudioChannelLayout,
kAudioUnitScope_Input, 0, layout, layoutSize);
XThrowIfError (err, "kAudioUnitProperty_AudioChannelLayout");
delete [] layout;
}
}
"after AudioFileGetPropertyInfo" never gets printed, so I assume that
the crash occurs at AudioFileGetPropertyInfo().
any suggestions on what the issue may be? How do I catch this sort of
exception, or better yet, how do I diagnose the problem? I tried
NSLogging the contents of the various parameters of the
AudioFileGetPropertyInfo() call, but I could not inspect them at
compile-time(some sort of 'anonymous struct' error).
entire method source:
http://rafb.net/paste/results/uE1OmC96.html
o/p of the error:
[Session started at 2006-01-16 16:32:14 -0800.]
playing file: /Users/mhanna/mydev/audio/samples/multichannel/qwave.wav
format: AudioStreamBasicDescription: 4 ch, 22050 Hz, 'lpcm'
(0x0000000C) 16-bit little-endian signed integer
2006-01-16 16:32:29.150 SimplePlayFile[1962] before
AudioFileGetPropertyInfo
terminate called after throwing an instance of 'CAXException'
regards,
Michael
_______________________________________________
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
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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