• 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: File format conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File format conversion


  • Subject: Re: File format conversion
  • From: Fredrik <email@hidden>
  • Date: Thu, 5 Feb 2009 06:44:49 +0100

William, I have found the cause of the problem. What I had missed to put into the code was an AudioFileClose(). Doing this updated the required size fields in the header. It makes perfect sense that this isn´t added to the header until one is done working with the file by closing it.

Thanks

Fredrik


5 feb 2009 kl. 04.17 skrev William Stewart:

It could be a bug in the audio file code.

We normally read and write files using the Read/Write Packets API (we really don't use the bytes ones), so I wonder if this is a bug in our code where we aren't updating the size chunk properly.

Bill

On Feb 4, 2009, at 6:16 PM, Fredrik wrote:

Thank you guys. I got a hint earlier as well to use or instead of commas. After I changed it the AudioConverter works as expected and writes the buffer as big endian. The size of the data isn´t written in the header still though. I have tried to edit it in a hexeditor and then the file plays normally so this seems to be what is left to solve for me. Could this be a result of the offset parameter being hardcoded as 0 at the moment? I noticed that no information on the data size is expected in the argument fields of AudioFileCreate so I assume that it get this information from elsewhere.

Fredrik


5 feb 2009 kl. 02.56 skrev Brian Willoughby:

Fredrik, the comma operator will compile, but it won't work. The C language allows you to combine any number of expressions on a single line using commas, but those expressions are not related to each other in any way. Your code is assigning Big Endian, but dropping the Signed Integer and Packed flags.

I bet that if you turned on compiler warnings, it would tell you that you have orphaned expressions which are doing nothing.

Bill's suggestion below is absolutely correct, although I would change the description from "usually" to "must always" !!

Brian Willoughby
Sound Consulting


On Feb 3, 2009, at 10:36 PM, Fredrik wrote:

So, your format flags aren't complete. You need: kAudioFormatFlagIsBigEndian kAudioFormatFlagIsSignedInteger kAudioFormatFlagIsPacked


Yes, that makes sense. I added these flags. What is the proper way to do that though? I just separated them by commas now, and that compiled fine. Like this:


OutFormat.mFormatFlags = kAudioFormatFlagIsBigEndian,
kAudioFormatFlagIsSignedInteger,
kAudioFormatFlagIsPacked;

I usually or them in:

OutFormat.mFormatFlags = kAudioFormatFlagIsBigEndian |
kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;


Bill


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


This email sent to email@hidden


_______________________________________________ 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
References: 
 >File format conversion (From: Fredrik <email@hidden>)
 >Re: File format conversion (From: William Stewart <email@hidden>)
 >Re: File format conversion (From: Fredrik <email@hidden>)
 >Re: File format conversion (From: William Stewart <email@hidden>)
 >Re: File format conversion (From: Brian Willoughby <email@hidden>)
 >Re: File format conversion (From: Fredrik <email@hidden>)
 >Re: File format conversion (From: William Stewart <email@hidden>)

  • Prev by Date: Re: File format conversion
  • Next by Date: SPEAKER and MICROPHONE volume control
  • Previous by thread: Re: File format conversion
  • Next by thread: Re: File format conversion
  • Index(es):
    • Date
    • Thread