Note that there are some explanatory texts on larger screens.

plurals
  1. POAudioToolbox/OpenAL ExtAudioFile to play compressed audio
    primarykey
    data
    text
    <p>I'm currently using OpenAL to play game music. It works fine, except that it doesn't work with anything except for raw WAV files. This means that I end up with a ~9mb soundtrack.</p> <p>I'm new to OpenAL, and I'm using code directly from Apple's example (<a href="https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html#//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9" rel="nofollow">https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html%23//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9</a>) to get the buffer data.</p> <p>Question: Is there any way to modify this function so it reads compressed audio and decodes it on the fly?<br> I'm not so worried about the audio file format, just as long as it can be played and is compressed (like mp3, aac, caf). The only reason I want to do this (obviously) is to reduce file size.</p> <p><strong>Edit:</strong> It seems that the problem is not so much in OpenAL as the method I'm using to get the buffer. The function at <a href="https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html#//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9" rel="nofollow">https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html%23//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9</a> uses <code>AudioFileOpenURL</code> and <code>AudioFileReadBytes</code>. Is there any way to get the framework to decode the audio for me using <code>ExtAudioFileOpenURL</code> and <code>ExtAudioFileRead</code>?</p> <p>I have tried the code here: <a href="https://devforums.apple.com/message/10678#10678" rel="nofollow">https://devforums.apple.com/message/10678#10678</a>, but I don't know what to make of it. The function I use to get the buffer is at <a href="https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html#//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9" rel="nofollow">https://developer.apple.com/library/ios/#samplecode/MusicCube/Listings/Classes_MyOpenALSupport_h.html%23//apple_ref/doc/uid/DTS40008978-Classes_MyOpenALSupport_h-DontLinkElementID_9</a>, and I haven't really modified it, so that's what I need to build on.</p> <p>I've started a bounty because I really need this, hopefully someone can point me in the right direction.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload