(iOS)Why use AudioQueue instead of AudioUnit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

(iOS)Why use AudioQueue instead of AudioUnit

ancientcc-3

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 mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

Alex Szpakowski
The commit message shares some insights: https://hg.libsdl.org/SDL/rev/38583cb96c1a

On Nov 16, 2016, at 9:35 PM, leagor <[hidden email]> 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 mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

Sik the hedgehog
In reply to this post by ancientcc-3
After doing a quick search, I guess this?
https://forums.libsdl.org/viewtopic.php?p=48857&sid=714b89c8259cd941f2933655840e4ab7
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

ancientcc-3
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
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

Jeremy Jurksztowicz
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 <[hidden email]> wrote:
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
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

Ryan C. Gordon
In reply to this post by ancientcc-3

> 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
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (iOS)Why use AudioQueue instead of AudioUnit

ancientcc-3
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:[hidden email]] On Behalf Of Ryan C. Gordon
Sent: Sunday, November 27, 2016 1:20 PM
To: SDL Development List <[hidden email]>
Subject: Re: [SDL] (iOS)Why use AudioQueue instead of AudioUnit


> 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
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Loading...