• 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
PlayFile-based code crashes on multichannel wav
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PlayFile-based code crashes on multichannel wav


  • Subject: PlayFile-based code crashes on multichannel wav
  • From: Michael Hanna <email@hidden>
  • Date: Mon, 16 Jan 2006 16:35:05 -0800

my simple app is based on PlayFile example code.. in this 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, &anAU), "AUGraphGetNodeInfo");

			err = AudioUnitSetProperty (anAU, kAudioUnitProperty_AudioChannelLayout,
										kAudioUnitScope_Input, 0, layout, layoutSize);
			XThrowIfError (err, "kAudioUnitProperty_AudioChannelLayout");

			delete [] layout;
		}
	}

an exception is thrown and "after AudioFileGetPropertyInfo" never gets
printed, so I assume AudioFileGetPropertyInfo is throwing it. AU Lab
plays this sound file 'just fine' as does QuickTime 7.0. The code
*does* however successfully plays a different wav file.

the exception-throwing multichannel file:
http://siddha.ca/mymusic/samples/multichannel/qwave.wav

the successfully-playing multichannel file:
http://siddha.ca/mymusic/samples/multichannel/drmapan.wav

What could it be that's causing the error? How do I catch this type of
exception so that I can somehow recover.. better yet, when I'm
troubleshooting something like this, any advice on how to diagnose? I
tried to inspect the various data structures, like
AudioFileGetPropertyInfo, but I couldn't inspect it directly. I
believe the compile-time error was that I couldn't peer into an
'anonymous struct' or something similar.

regards,
Michael

o/p
---

[Session started at 2006-01-16 16:22:31 -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:22:40.608 SimplePlayFile[1914] before AudioFileGetPropertyInfo
terminate called after throwing an instance of 'CAXException'

SimplePlayFile has exited due to signal 6 (SIGABRT).

o/p
---

playing file: /Users/mhanna/mydev/audio/samples/multichannel/drmapan.wav
format: AudioStreamBasicDescription:  4 ch,  22050 Hz, 'lpcm'
(0x0000000C) 16-bit little-endian signed integer
2006-01-16 16:23:59.084 SimplePlayFile[1924] before AudioFileGetPropertyInfo
2006-01-16 16:23:59.084 SimplePlayFile[1924] after AudioFileGetPropertyInfo
2006-01-16 16:23:59.085 SimplePlayFile[1924] fileDuration 4.784898
2006-01-16 16:23:59.085 SimplePlayFile[1924] fTotalSamples 105507.000000

source of complete method:
http://siddha.ca/snippets/makeGraph_snippet.m
 _______________________________________________
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

  • Prev by Date: "Recording" generated audio to AAC (or anything)
  • Next by Date: PlayFile-based code crashes on multichannel wav
  • Previous by thread: "Recording" generated audio to AAC (or anything)
  • Next by thread: PlayFile-based code crashes on multichannel wav
  • Index(es):
    • Date
    • Thread