pcm: Make more of the low-level PCM API private

* pcm_play_data
 * pcm_play_stop
 * pcm_play_stop_int
 * pcm_is_playing
 * pcm_set_frequency
 * pcm_get_frequency
 * pcm_apply_settings

Now, the only user of these functions are the mixer and recording layers
that provide a higher-level API to plugins and the main [playback]
application.

Outside of the PCM core, pcm_apply_settings() was only used immediately
following a call to mixer_set_frequency(), so the latter function
now always calls the former.

Change-Id: I61c3144dc156b9de9b7963160b525c6d10c6ad4b
This commit is contained in:
Solomon Peachy 2026-03-02 12:14:34 -05:00
parent be1e074800
commit ea570c5728
14 changed files with 28 additions and 44 deletions

View file

@ -24,6 +24,5 @@
-- [[ conversion to old style pcm_ functions ]]
if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end
rb.pcm_apply_settings = function() rb.pcm("apply_settings") end
rb.pcm_play_lock = function() rb.pcm("play_lock") end
rb.pcm_play_unlock = function() rb.pcm("play_unlock") end

View file

@ -549,10 +549,10 @@ RB_WRAP(sound)
RB_WRAP(pcm)
{
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_PLAYLOCK, PCM_PLAYUNLOCK,
enum e_pcm {PCM_PLAYLOCK = 0, PCM_PLAYUNLOCK,
PCM_ECOUNT};
const char *pcm_option[] = {"apply_settings", "play_lock", "play_unlock",
const char *pcm_option[] = {"play_lock", "play_unlock",
NULL};
lua_pushnil(L); /*push nil so options w/o return have something to return */
@ -560,9 +560,6 @@ RB_WRAP(pcm)
int option = luaL_checkoption (L, 1, NULL, pcm_option);
switch(option)
{
case PCM_APPLYSETTINGS:
rb->pcm_apply_settings();
break;
case PCM_PLAYLOCK:
rb->pcm_play_lock();
break;

View file

@ -64,7 +64,6 @@ void rockbox_open_audio(int rate)
/* Set sample rate of the audio buffer. */
rb->mixer_set_frequency(rate);
rb->pcm_apply_settings();
/* Initialize output buffer. */
for(i = 0; i < OUTBUFSIZE; i++)
@ -86,7 +85,6 @@ void rockbox_close_audio(void)
/* Restore default sampling rate. */
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
rb->pcm_apply_settings();
}
/* Rockbox audio callback. */

View file

@ -168,7 +168,6 @@ static void set_frequency(int index)
update_gen_step();
rb->mixer_set_frequency(hw_sampr);
rb->pcm_apply_settings();
}
#ifndef HAVE_VOLUME_IN_LIST

View file

@ -253,7 +253,6 @@ bool syssnd_init(void)
#endif
rb->mixer_set_frequency(HW_FREQ_44);
rb->pcm_apply_settings();
rb->memset(channels, 0, sizeof(channels));
rb->memset(mixBuffers, 0, sizeof(mixBuffers));
@ -286,7 +285,6 @@ void syssnd_shutdown(void)
/* Restore default sampling rate. */
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
rb->pcm_apply_settings();
rb->talk_disable(false);