The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
(iOS)Why use AudioQueue instead of AudioUnit
ancientli


Joined: 01 Jul 2015
Posts: 45
SDL2.0.5 use AudioQueue functions to play and record audio. In previous version, it is AudioUnit.

Of course, SDL2.0.5 support record audio, but AudoUnit can record also. Why SDL2.0.5 use AudioQueue instead of AudioUnit?
(iOS)Why use AudioQueue instead of AudioUnit
Alex Szpakowski
Guest

The commit message shares some insights: https://hg.libsdl.org/SDL/rev/38583cb96c1a
Quote:
On Nov 16, 2016, at 9:35 PM, leagor wrote:
SDL2.0.5 use AudioQueue functions to play and record audio. In previous version, it is AudioUnit.

Of course, SDL2.0.5 support record audio, but AudoUnit can record also. Why SDL2.0.5 use AudioQueue instead of AudioUnit?

_______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
(iOS)Why use AudioQueue instead of AudioUnit
Sik


Joined: 26 Nov 2011
Posts: 905
After doing a quick search, I guess this?
https://forums.libsdl.org/viewtopic.php?p=48857&sid=714b89c8259cd941f2933655840e4ab7
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
(iOS)Why use AudioQueue instead of AudioUnit
ancientli


Joined: 01 Jul 2015
Posts: 45
I think audio module on iOS has fault. In general, app opens playback at
startup, and works all time when app are runing. That is to say,
outputCallback in SDL_coreaudio.m will be called even if no sound require to
play. It will result to extra power consumption.

In previous version that using AudioUnit, I call AudioOutputUnitStop when no
sound require to play. When requiring, call AudioOutputUnitStart. This
method can avoid extra power consumption.

SDL2.0.5 use AudioQueue, it seems to be new way to avoid this problem.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
(iOS)Why use AudioQueue instead of AudioUnit
eclectocrat


Joined: 26 Mar 2011
Posts: 72
Sorry if I'm missing something obvious, but are AudioQueueStop() AudioQueueDispose() not good enough to prevent this, or or they not being called at the right times?

Regards,
Jeremy J.







On Thu, Nov 17, 2016 at 6:59 AM, leagor wrote:
Quote:
I think audio module on iOS has fault. In general, app opens playback at
startup, and works all time when app are runing. That is to say,
outputCallback in SDL_coreaudio.m will be called even if no sound require to
play. It will result to extra power consumption.

In previous version that using AudioUnit, I call AudioOutputUnitStop when no
sound require to play. When requiring, call AudioOutputUnitStart. This
method can avoid extra power consumption.

SDL2.0.5 use AudioQueue, it seems to be new way to avoid this problem.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


(iOS)Why use AudioQueue instead of AudioUnit
Ryan C. Gordon
Guest

Quote:
In previous version that using AudioUnit, I call AudioOutputUnitStop when no
sound require to play. When requiring, call AudioOutputUnitStart. This
method can avoid extra power consumption.

Is SDL_PauseAudioDevice() not an option?

Talking directly to system APIs for stuff SDL is handling for you tends
to be dangerous, for just this reason.

--ryan.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
(iOS)Why use AudioQueue instead of AudioUnit
ancientli


Joined: 01 Jul 2015
Posts: 45
I think SDL_PauseAudioDevice() can not achieve this purpose.

Even if the play is paused, SDL will still call AudioQueueEnqueueBuffer,
just to set desired data to 0.

By the way, I implemented to "Pause" based on AudioQueue. Below is code.
-----------------------------------
static void COREAUDIO_PauseDevice(_THIS, int pause_on)
{
if (pause_on) {
AudioQueueStop(this->hidden->audioQueue, 1);
} else {
OSStatus result = AudioQueueStart(this->hidden->audioQueue,
NULL);
}
}

-----Original Message-----
From: SDL [mailto:] On Behalf Of Ryan C. Gordon
Sent: Sunday, November 27, 2016 1:20 PM
To: SDL Development List
Subject: Re: [SDL] (iOS)Why use AudioQueue instead of AudioUnit


Quote:
In previous version that using AudioUnit, I call AudioOutputUnitStop
when no sound require to play. When requiring, call
AudioOutputUnitStart. This method can avoid extra power consumption.

Is SDL_PauseAudioDevice() not an option?

Talking directly to system APIs for stuff SDL is handling for you tends to
be dangerous, for just this reason.

--ryan.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org