• 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
Problem opening *some* audiofiles via AudioFileOpenWithCallbacks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem opening *some* audiofiles via AudioFileOpenWithCallbacks


  • Subject: Problem opening *some* audiofiles via AudioFileOpenWithCallbacks
  • From: email@hidden
  • Date: Tue, 6 Feb 2007 09:28:31 +0100 (CET)
  • Importance: Normal

Hello!

I am holding audio data in an NSData Object, passing it to
AudioFileOpenWithCallbacks to read the audiofile. Afterwards I call:

AudioFileGetProperty(audioFile2, kAudioFilePropertyDataFormat, &propsize,
&fileFormat);

to read the data format. Curiously, this works with many files, but with
some files it fails with the following error:

AudioUnitGetProperty (file format) failed with error -50



This is how I have implemented the ReadAudioFromBuffer method:

xtern OSStatus ReadAudioFromBuffer(void       *inRefCon,
									SInt64		inPosition,
									ByteCount	requestCount,
									void       *buffer,
									ByteCount  *actualCount)
{

	ByteCount requestOffset = inPosition + requestCount;
	ByteCount availableBytes = [inRefCon length] - inPosition;

	if (requestOffset > [inRefCon length]) {
		*actualCount = availableBytes;
	} else {
		*actualCount = requestCount;
	}
	[inRefCon getBytes:buffer range:NSMakeRange(inPosition,*actualCount)];
	return noErr;
}



You can download the xcode project together with a working and a "broken"
audio file here:

http://www.systemshutdown.de/audiocallbacktest.zip



Thanks for any advice,

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

  • Prev by Date: Re: Converting PCM value into AIFF
  • Next by Date: Garageband 3/audio units odd behaviour
  • Previous by thread: Re: Converting PCM value into AIFF
  • Next by thread: Garageband 3/audio units odd behaviour
  • Index(es):
    • Date
    • Thread