Files
RetroArch/audio/audio_thread_wrapper.h
LibretroAdmin 400d7ed4a3 audio: a format change no longer parks the audio thread
audio_driver_set_core_float() decides a source format change at once
and hands it to the threaded pipeline's consumer as a request word, to
install before its next pass; the producer writes nothing into the ring
until it has. A populated ring keeps its native format, as before, and
the producer converts its writes meanwhile. The stage a running or
suspended transport needs in the new format is made by the producer and
the old one handed back to it to free; one that cannot be made drops
the transport, keeping the new source native.

That was the last control to park the audio thread, so
audio_thread_apply_control() goes. Harnesses that parked the consumer
to look at its state stop and start the wrapper instead, and
thread_handshake checks audio_thread_parked() across its round trips.
pipeline_format hands its format change to a consumer pass and checks
nothing takes effect before it.
2026-10-30 09:42:01 +01:00

59 lines
2.3 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RARCH_AUDIO_THREAD_H__
#define RARCH_AUDIO_THREAD_H__
#include <boolean.h>
#include "audio_driver.h"
/**
* audio_init_thread:
* @out_driver : output driver
* @out_data : output audio data
* @device : audio device (optional)
* @out_rate : output audio rate
* @new_rate : new output audio rate
* @latency : audio latency
* @driver : audio driver
*
* Starts a audio driver in a new thread.
* Access to audio driver will be mediated through this driver.
* This driver interfaces with audio callback and is only used in that case.
*
* Returns: true (1) if successful, otherwise false (0).
**/
/* Ident of the driver the wrapper is running, so callers that key on
* the driver name (per-driver menu settings) see "wasapi", not
* "audio-thread". NULL if data is not a wrapper context. */
const char *audio_thread_wrapped_ident(void *data);
/* The driver the wrapper is running, or NULL if data is NULL. */
const audio_driver_t *audio_thread_wrapped_driver(void *data);
/* Main thread. True while the audio thread runs no pass and starts
* none until the main thread lets it: parked by a stop, or gone. */
bool audio_thread_parked(void *data);
bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
const char *device, unsigned out_rate, unsigned *new_rate, unsigned latency,
bool raise_priority,
bool prefer_fast_cores,
const audio_driver_t *driver);
#endif