mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
plugins: Convert all plugins to using mixer API for playback
pcm_play_data -> mixer_channel_play_data pcm_set_frequeny -> mixer_set_frequency pcm_play_stop -> audio_stop at startup / mixer_channel_stop at shutdown pcm_is_playing -> mixer_channel_status All of these have been removed from the plugin API. Updated API docs to clarify role of audio_stop() vs mixer_channel_stop() Todo: get rid of pcm_play_[un]lock(). Change-Id: I8800c131b51f064ee923a4c6e42aa405d33851fc
This commit is contained in:
parent
f6dfa5144d
commit
017dd72ff3
22 changed files with 113 additions and 178 deletions
|
|
@ -645,10 +645,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
&audio_master_sampr_list[0],
|
&audio_master_sampr_list[0],
|
||||||
&hw_freq_sampr[0],
|
&hw_freq_sampr[0],
|
||||||
pcm_apply_settings,
|
pcm_apply_settings,
|
||||||
pcm_play_data,
|
|
||||||
pcm_play_stop,
|
|
||||||
pcm_set_frequency,
|
|
||||||
pcm_is_playing,
|
|
||||||
pcm_play_lock,
|
pcm_play_lock,
|
||||||
pcm_play_unlock,
|
pcm_play_unlock,
|
||||||
beep_play,
|
beep_play,
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ int plugin_open(const char *plugin, const char *parameter);
|
||||||
* when this happens please take the opportunity to sort in
|
* when this happens please take the opportunity to sort in
|
||||||
* any new functions "waiting" at the end of the list.
|
* any new functions "waiting" at the end of the list.
|
||||||
*/
|
*/
|
||||||
#define PLUGIN_API_VERSION 278
|
#define PLUGIN_API_VERSION 279
|
||||||
|
|
||||||
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
|
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
|
||||||
|
|
||||||
|
|
@ -743,12 +743,6 @@ struct plugin_api {
|
||||||
const unsigned long *audio_master_sampr_list;
|
const unsigned long *audio_master_sampr_list;
|
||||||
const unsigned long *hw_freq_sampr;
|
const unsigned long *hw_freq_sampr;
|
||||||
void (*pcm_apply_settings)(void);
|
void (*pcm_apply_settings)(void);
|
||||||
void (*pcm_play_data)(pcm_play_callback_type get_more,
|
|
||||||
pcm_status_callback_type status_cb,
|
|
||||||
const void *start, size_t size);
|
|
||||||
void (*pcm_play_stop)(void);
|
|
||||||
void (*pcm_set_frequency)(unsigned int frequency);
|
|
||||||
bool (*pcm_is_playing)(void);
|
|
||||||
void (*pcm_play_lock)(void);
|
void (*pcm_play_lock)(void);
|
||||||
void (*pcm_play_unlock)(void);
|
void (*pcm_play_unlock)(void);
|
||||||
void (*beep_play)(unsigned int frequency, unsigned int duration,
|
void (*beep_play)(unsigned int frequency, unsigned int duration,
|
||||||
|
|
|
||||||
|
|
@ -471,13 +471,13 @@ void I_SubmitSound(void)
|
||||||
if (!enable_sound)
|
if (!enable_sound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rb->pcm_play_data(&get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &get_more, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_ShutdownSound(void)
|
void I_ShutdownSound(void)
|
||||||
{
|
{
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); // 44100
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_InitSound()
|
void I_InitSound()
|
||||||
|
|
@ -486,14 +486,14 @@ void I_InitSound()
|
||||||
|
|
||||||
// Initialize external data (all sounds) at start, keep static.
|
// Initialize external data (all sounds) at start, keep static.
|
||||||
printf( "I_InitSound: ");
|
printf( "I_InitSound: ");
|
||||||
rb->pcm_play_stop();
|
rb->audio_stop();
|
||||||
|
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
rb->pcm_set_frequency(SAMPLERATE);
|
rb->mixer_set_frequency(SAMPLERATE);
|
||||||
|
|
||||||
vol_lookup=malloc(128*256*sizeof(int));
|
vol_lookup=malloc(128*256*sizeof(int));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ static int show_menu(void) /* return 1 to quit */
|
||||||
/* slideshow times < 10s keep disk spinning */
|
/* slideshow times < 10s keep disk spinning */
|
||||||
rb->storage_spindown(0);
|
rb->storage_spindown(0);
|
||||||
}
|
}
|
||||||
else if (!rb->pcm_is_playing())
|
else if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) != CHANNEL_PLAYING)
|
||||||
{
|
{
|
||||||
/* slideshow times > 10s and not playing: ata_off after load */
|
/* slideshow times > 10s and not playing: ata_off after load */
|
||||||
iv_api.immediate_ata_off = true;
|
iv_api.immediate_ata_off = true;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,5 @@
|
||||||
if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end
|
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_apply_settings = function() rb.pcm("apply_settings") end
|
||||||
rb.pcm_set_frequency = function(freq) rb.pcm("set_frequency", freq) end
|
|
||||||
rb.pcm_play_stop = function() rb.pcm("play_stop") end
|
|
||||||
rb.pcm_play_lock = function() rb.pcm("play_lock") end
|
rb.pcm_play_lock = function() rb.pcm("play_lock") end
|
||||||
rb.pcm_play_unlock = function() rb.pcm("play_unlock") end
|
rb.pcm_play_unlock = function() rb.pcm("play_unlock") end
|
||||||
rb.pcm_is_playing = function() return rb.pcm("is_playing") end
|
|
||||||
|
|
|
||||||
|
|
@ -549,13 +549,11 @@ RB_WRAP(sound)
|
||||||
|
|
||||||
RB_WRAP(pcm)
|
RB_WRAP(pcm)
|
||||||
{
|
{
|
||||||
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING,
|
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_PLAYLOCK, PCM_PLAYUNLOCK,
|
||||||
PCM_PLAYSTOP, PCM_PLAYLOCK, PCM_PLAYUNLOCK,
|
PCM_ECOUNT};
|
||||||
PCM_SETFREQUENCY, PCM_ECOUNT};
|
|
||||||
|
|
||||||
const char *pcm_option[] = {"apply_settings", "is_playing",
|
const char *pcm_option[] = {"apply_settings", "play_lock", "play_unlock",
|
||||||
"play_stop", "play_lock", "play_unlock",
|
NULL};
|
||||||
"set_frequency", NULL};
|
|
||||||
bool b_result;
|
bool b_result;
|
||||||
|
|
||||||
lua_pushnil(L); /*push nil so options w/o return have something to return */
|
lua_pushnil(L); /*push nil so options w/o return have something to return */
|
||||||
|
|
@ -566,22 +564,12 @@ RB_WRAP(pcm)
|
||||||
case PCM_APPLYSETTINGS:
|
case PCM_APPLYSETTINGS:
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
break;
|
break;
|
||||||
case PCM_ISPLAYING:
|
|
||||||
b_result = rb->pcm_is_playing();
|
|
||||||
lua_pushboolean(L, b_result);
|
|
||||||
break;
|
|
||||||
case PCM_PLAYSTOP:
|
|
||||||
rb->pcm_play_stop();
|
|
||||||
break;
|
|
||||||
case PCM_PLAYLOCK:
|
case PCM_PLAYLOCK:
|
||||||
rb->pcm_play_lock();
|
rb->pcm_play_lock();
|
||||||
break;
|
break;
|
||||||
case PCM_PLAYUNLOCK:
|
case PCM_PLAYUNLOCK:
|
||||||
rb->pcm_play_unlock();
|
rb->pcm_play_unlock();
|
||||||
break;
|
break;
|
||||||
case PCM_SETFREQUENCY:
|
|
||||||
rb->pcm_set_frequency((unsigned int) luaL_checkint(L, 2));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yield();
|
yield();
|
||||||
|
|
|
||||||
|
|
@ -809,9 +809,6 @@ static int bpm_step_counter = 0;
|
||||||
|
|
||||||
static bool sound_trigger = false;
|
static bool sound_trigger = false;
|
||||||
|
|
||||||
#define MET_IS_PLAYING rb->pcm_is_playing()
|
|
||||||
#define MET_PLAY_STOP rb->audio_stop()
|
|
||||||
|
|
||||||
/* Really necessary? Cannot just play mono?
|
/* Really necessary? Cannot just play mono?
|
||||||
Also: This is wasted memory! */
|
Also: This is wasted memory! */
|
||||||
static short tick_buf[sizeof(tick_sound)*2];
|
static short tick_buf[sizeof(tick_sound)*2];
|
||||||
|
|
@ -829,12 +826,12 @@ static void prepare_buffers(void)
|
||||||
|
|
||||||
static void play_tick(void)
|
static void play_tick(void)
|
||||||
{
|
{
|
||||||
rb->pcm_play_data(NULL, NULL, tick_buf, sizeof(tick_buf));
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, NULL, tick_buf, sizeof(tick_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void play_tock(void)
|
static void play_tock(void)
|
||||||
{
|
{
|
||||||
rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf));
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, NULL, tock_buf, sizeof(tock_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
|
/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
|
||||||
|
|
@ -1216,10 +1213,10 @@ static void cleanup(void)
|
||||||
if(fd >= 0) rb->close(fd);
|
if(fd >= 0) rb->close(fd);
|
||||||
|
|
||||||
metronome_pause();
|
metronome_pause();
|
||||||
MET_PLAY_STOP; /* stop audio ISR */
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
tweak_volume(0);
|
tweak_volume(0);
|
||||||
rb->led(0);
|
rb->led(0);
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1555,7 +1552,7 @@ enum plugin_status plugin_start(const void* file)
|
||||||
|
|
||||||
mem_init();
|
mem_init();
|
||||||
|
|
||||||
if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */
|
rb->audio_stop();
|
||||||
|
|
||||||
prepare_buffers();
|
prepare_buffers();
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
|
|
@ -1563,7 +1560,7 @@ enum plugin_status plugin_start(const void* file)
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
rb->pcm_set_frequency(SAMPR_44);
|
rb->mixer_set_frequency(SAMPR_44);
|
||||||
|
|
||||||
if(file)
|
if(file)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,7 @@ static int midimain(const void * filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->talk_force_shutup();
|
rb->talk_force_shutup();
|
||||||
rb->pcm_play_stop();
|
rb->audio_stop();
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
|
|
|
||||||
|
|
@ -536,7 +536,7 @@ static void applysettings(void)
|
||||||
if (inited && (md_mixfreq != rb->hw_freq_sampr[settings.sample_rate])) {
|
if (inited && (md_mixfreq != rb->hw_freq_sampr[settings.sample_rate])) {
|
||||||
md_mixfreq = rb->hw_freq_sampr[settings.sample_rate];
|
md_mixfreq = rb->hw_freq_sampr[settings.sample_rate];
|
||||||
// MikMod_Reset(""); BROKEN!
|
// MikMod_Reset(""); BROKEN!
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->mixer_set_frequency(md_mixfreq);
|
rb->mixer_set_frequency(md_mixfreq);
|
||||||
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -964,7 +964,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
rb->lcd_getstringsize("A", NULL, &font_h);
|
rb->lcd_getstringsize("A", NULL, &font_h);
|
||||||
|
|
||||||
rb->talk_force_shutup();
|
rb->talk_force_shutup();
|
||||||
rb->pcm_play_stop();
|
rb->audio_stop();
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
|
|
@ -1019,10 +1019,11 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
retval = playfile(np_file);
|
retval = playfile(np_file);
|
||||||
} while (retval == PLUGIN_NEWSONG);
|
} while (retval == PLUGIN_NEWSONG);
|
||||||
|
|
||||||
MikMod_Exit();
|
|
||||||
|
|
||||||
rb->pcmbuf_fade(false, false);
|
rb->pcmbuf_fade(false, false);
|
||||||
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
|
|
||||||
|
MikMod_Exit();
|
||||||
|
|
||||||
rb->mixer_set_frequency(orig_samplerate);
|
rb->mixer_set_frequency(orig_samplerate);
|
||||||
|
|
||||||
if (retval == PLUGIN_OK)
|
if (retval == PLUGIN_OK)
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,8 @@ static void start_sound(void)
|
||||||
if (sound_playing)
|
if (sound_playing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
rb->audio_stop();
|
||||||
|
|
||||||
#ifndef USE_IRAM
|
#ifndef USE_IRAM
|
||||||
/* Ensure control of PCM - stopping music itn't obligatory */
|
/* Ensure control of PCM - stopping music itn't obligatory */
|
||||||
rb->plugin_get_audio_buffer(NULL);
|
rb->plugin_get_audio_buffer(NULL);
|
||||||
|
|
@ -405,8 +407,8 @@ static void start_sound(void)
|
||||||
|
|
||||||
wsg3_set_sampling_rate(rb->hw_freq_sampr[sr_index]);
|
wsg3_set_sampling_rate(rb->hw_freq_sampr[sr_index]);
|
||||||
|
|
||||||
rb->pcm_set_frequency(rb->hw_freq_sampr[sr_index]);
|
rb->mixer_set_frequency(rb->hw_freq_sampr[sr_index]);
|
||||||
rb->pcm_play_data(get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
|
|
||||||
sound_playing = true;
|
sound_playing = true;
|
||||||
}
|
}
|
||||||
|
|
@ -419,8 +421,8 @@ static void stop_sound(void)
|
||||||
if (!sound_playing)
|
if (!sound_playing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
|
|
||||||
sound_playing = false;
|
sound_playing = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ void rockbox_open_audio(int rate)
|
||||||
playing = false;
|
playing = false;
|
||||||
|
|
||||||
/* Stop playing to reconfigure audio settings. */
|
/* Stop playing to reconfigure audio settings. */
|
||||||
rb->pcm_play_stop();
|
rb->audio_stop();
|
||||||
|
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
|
|
@ -63,7 +63,7 @@ void rockbox_open_audio(int rate)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set sample rate of the audio buffer. */
|
/* Set sample rate of the audio buffer. */
|
||||||
rb->pcm_set_frequency(rate);
|
rb->mixer_set_frequency(rate);
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
|
|
||||||
/* Initialize output buffer. */
|
/* Initialize output buffer. */
|
||||||
|
|
@ -79,13 +79,13 @@ void rockbox_open_audio(int rate)
|
||||||
void rockbox_close_audio(void)
|
void rockbox_close_audio(void)
|
||||||
{
|
{
|
||||||
/* Stop playback. */
|
/* Stop playback. */
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
|
|
||||||
/* Reset playing status. */
|
/* Reset playing status. */
|
||||||
playing = false;
|
playing = false;
|
||||||
|
|
||||||
/* Restore default sampling rate. */
|
/* Restore default sampling rate. */
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ int rockbox_send_dacs(void)
|
||||||
if(!playing && outbuf_fill > 0)
|
if(!playing && outbuf_fill > 0)
|
||||||
{
|
{
|
||||||
/* Start playing. */
|
/* Start playing. */
|
||||||
rb->pcm_play_data(pdbox_get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, pdbox_get_more, NULL, 0);
|
||||||
|
|
||||||
/* Set status flag. */
|
/* Set status flag. */
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
@ -191,4 +191,3 @@ int rockbox_send_dacs(void)
|
||||||
|
|
||||||
return SENDDACS_YES;
|
return SENDDACS_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1084,7 +1084,7 @@ static void record_and_get_pitch(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb->pcm_close_recording();
|
rb->pcm_close_recording();
|
||||||
rb->pcm_set_frequency(HW_SAMPR_RESET | SAMPR_TYPE_REC);
|
rb->mixer_set_frequency(HW_SAMPR_RESET | SAMPR_TYPE_REC);
|
||||||
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
||||||
rb->cancel_cpu_boost();
|
rb->cancel_cpu_boost();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1118,7 +1118,7 @@ static void init_everything(void)
|
||||||
sample_rate = rb->round_value_to_list32(9000, rb->rec_freq_sampr,
|
sample_rate = rb->round_value_to_list32(9000, rb->rec_freq_sampr,
|
||||||
REC_NUM_FREQ, false);
|
REC_NUM_FREQ, false);
|
||||||
sample_rate = rb->rec_freq_sampr[sample_rate];
|
sample_rate = rb->rec_freq_sampr[sample_rate];
|
||||||
rb->pcm_set_frequency(sample_rate | SAMPR_TYPE_REC);
|
rb->mixer_set_frequency(sample_rate | SAMPR_TYPE_REC);
|
||||||
rb->pcm_init_recording();
|
rb->pcm_init_recording();
|
||||||
|
|
||||||
/* avoid divsion by zero */
|
/* avoid divsion by zero */
|
||||||
|
|
|
||||||
|
|
@ -47,24 +47,23 @@ void rockboy_pcm_init(void)
|
||||||
pcm.pos = 0;
|
pcm.pos = 0;
|
||||||
memset(buf, 0, pcm.len * N_BUFS*sizeof(short));
|
memset(buf, 0, pcm.len * N_BUFS*sizeof(short));
|
||||||
}
|
}
|
||||||
|
rb->audio_stop();
|
||||||
rb->pcm_play_stop();
|
|
||||||
|
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rb->pcm_set_frequency(pcm.hz); /* 44100 22050 11025 */
|
rb->mixer_set_frequency(pcm.hz); /* 44100 22050 11025 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void rockboy_pcm_close(void)
|
void rockboy_pcm_close(void)
|
||||||
{
|
{
|
||||||
memset(&pcm, 0, sizeof pcm);
|
memset(&pcm, 0, sizeof pcm);
|
||||||
newly_started = true;
|
newly_started = true;
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rockboy_pcm_submit(void)
|
int rockboy_pcm_submit(void)
|
||||||
|
|
@ -74,7 +73,7 @@ int rockboy_pcm_submit(void)
|
||||||
|
|
||||||
if(newly_started)
|
if(newly_started)
|
||||||
{
|
{
|
||||||
rb->pcm_play_data(&get_more, NULL, NULL,0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &get_more, NULL, 0);
|
||||||
newly_started = false;
|
newly_started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ static Uint8 *ROCKBOXAUD_GetAudioBuf(_THIS)
|
||||||
|
|
||||||
static void ROCKBOXAUD_CloseAudio(_THIS)
|
static void ROCKBOXAUD_CloseAudio(_THIS)
|
||||||
{
|
{
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
if ( this->hidden->mixbuf != NULL ) {
|
if ( this->hidden->mixbuf != NULL ) {
|
||||||
SDL_FreeAudioMem(this->hidden->mixbuf);
|
SDL_FreeAudioMem(this->hidden->mixbuf);
|
||||||
this->hidden->mixbuf = NULL;
|
this->hidden->mixbuf = NULL;
|
||||||
|
|
@ -226,7 +226,7 @@ static void ROCKBOXAUD_CloseAudio(_THIS)
|
||||||
if(this->hidden->rb_buf[i])
|
if(this->hidden->rb_buf[i])
|
||||||
SDL_FreeAudioMem(this->hidden->rb_buf[i]);
|
SDL_FreeAudioMem(this->hidden->rb_buf[i]);
|
||||||
}
|
}
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool freq_ok(unsigned int freq)
|
static bool freq_ok(unsigned int freq)
|
||||||
|
|
@ -257,7 +257,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
||||||
SDL_CalculateAudioSpec(spec);
|
SDL_CalculateAudioSpec(spec);
|
||||||
|
|
||||||
LOGF("samplerate %d", spec->freq);
|
LOGF("samplerate %d", spec->freq);
|
||||||
rb->pcm_set_frequency(spec->freq);
|
rb->mixer_set_frequency(spec->freq);
|
||||||
|
|
||||||
/* Allocate mixing buffer */
|
/* Allocate mixing buffer */
|
||||||
this->hidden->mixlen = spec->size;
|
this->hidden->mixlen = spec->size;
|
||||||
|
|
@ -286,7 +286,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
||||||
|
|
||||||
rbaud_underruns = 0;
|
rbaud_underruns = 0;
|
||||||
|
|
||||||
rb->pcm_play_data(get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
|
|
||||||
/* We're ready to rock and roll. :-) */
|
/* We're ready to rock and roll. :-) */
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ static void set_frequency(int index)
|
||||||
output_clear();
|
output_clear();
|
||||||
update_gen_step();
|
update_gen_step();
|
||||||
|
|
||||||
rb->pcm_set_frequency(hw_sampr);
|
rb->mixer_set_frequency(hw_sampr);
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ static void play_tone(bool volume_set)
|
||||||
rb->cpu_boost(true);
|
rb->cpu_boost(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rb->pcm_set_frequency(rb->hw_freq_sampr[freq]);
|
rb->mixer_set_frequency(rb->hw_freq_sampr[freq]);
|
||||||
|
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Recordable targets can play back from other sources */
|
/* Recordable targets can play back from other sources */
|
||||||
|
|
@ -237,7 +237,7 @@ static void play_tone(bool volume_set)
|
||||||
IF_PRIO(, PRIORITY_PLAYBACK)
|
IF_PRIO(, PRIORITY_PLAYBACK)
|
||||||
IF_COP(, CPU));
|
IF_COP(, CPU));
|
||||||
|
|
||||||
rb->pcm_play_data(get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
|
|
||||||
#ifndef HAVE_VOLUME_IN_LIST
|
#ifndef HAVE_VOLUME_IN_LIST
|
||||||
if (volume_set)
|
if (volume_set)
|
||||||
|
|
@ -260,7 +260,7 @@ static void play_tone(bool volume_set)
|
||||||
|
|
||||||
rb->thread_wait(gen_thread_id);
|
rb->thread_wait(gen_thread_id);
|
||||||
|
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(false);
|
rb->cpu_boost(false);
|
||||||
|
|
@ -268,7 +268,7 @@ static void play_tone(bool volume_set)
|
||||||
|
|
||||||
/* restore default - user of apis is responsible for restoring
|
/* restore default - user of apis is responsible for restoring
|
||||||
default state - normally playback at 44100Hz */
|
default state - normally playback at 44100Hz */
|
||||||
rb->pcm_set_frequency(HW_FREQ_DEFAULT);
|
rb->mixer_set_frequency(HW_FREQ_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tests hardware sample rate switching */
|
/* Tests hardware sample rate switching */
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ void syssnd_update(void)
|
||||||
|
|
||||||
if (!isAudioPlaying && fillCount > 0)
|
if (!isAudioPlaying && fillCount > 0)
|
||||||
{
|
{
|
||||||
rb->pcm_play_data(&get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
isAudioPlaying = true;
|
isAudioPlaying = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -240,6 +240,7 @@ bool syssnd_init(void)
|
||||||
|
|
||||||
IFDEBUG_AUDIO(sys_printf("xrick/audio: start\n"););
|
IFDEBUG_AUDIO(sys_printf("xrick/audio: start\n"););
|
||||||
|
|
||||||
|
rb->audio_stop();
|
||||||
rb->talk_disable(true);
|
rb->talk_disable(true);
|
||||||
|
|
||||||
/* Stop playback to reconfigure audio settings and acquire audio buffer */
|
/* Stop playback to reconfigure audio settings and acquire audio buffer */
|
||||||
|
|
@ -251,7 +252,7 @@ bool syssnd_init(void)
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rb->pcm_set_frequency(HW_FREQ_44);
|
rb->mixer_set_frequency(HW_FREQ_44);
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
|
|
||||||
rb->memset(channels, 0, sizeof(channels));
|
rb->memset(channels, 0, sizeof(channels));
|
||||||
|
|
@ -278,13 +279,13 @@ void syssnd_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop playback. */
|
/* Stop playback. */
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
|
|
||||||
/* Reset playing status. */
|
/* Reset playing status. */
|
||||||
isAudioPlaying = false;
|
isAudioPlaying = false;
|
||||||
|
|
||||||
/* Restore default sampling rate. */
|
/* Restore default sampling rate. */
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
rb->pcm_apply_settings();
|
rb->pcm_apply_settings();
|
||||||
|
|
||||||
rb->talk_disable(false);
|
rb->talk_disable(false);
|
||||||
|
|
@ -361,9 +362,7 @@ void syssnd_pauseAll(bool pause)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->pcm_play_lock();
|
|
||||||
rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, !pause);
|
rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, !pause);
|
||||||
rb->pcm_play_unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1029,13 +1029,13 @@ void sys_startAudio(struct System* sys, AudioCallback callback, void *param)
|
||||||
audio_param = param;
|
audio_param = param;
|
||||||
audio_sys = sys;
|
audio_sys = sys;
|
||||||
|
|
||||||
rb->pcm_play_data(get_more, NULL, NULL, 0);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_stopAudio(struct System* sys)
|
void sys_stopAudio(struct System* sys)
|
||||||
{
|
{
|
||||||
(void) sys;
|
(void) sys;
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t sys_getOutputSampleRate(struct System* sys)
|
uint32_t sys_getOutputSampleRate(struct System* sys)
|
||||||
|
|
|
||||||
|
|
@ -290,9 +290,7 @@ static void options_menu(void){
|
||||||
no_yes, 2, NULL);
|
no_yes, 2, NULL);
|
||||||
if (new_setting != settings.sound )
|
if (new_setting != settings.sound )
|
||||||
settings.sound=new_setting;
|
settings.sound=new_setting;
|
||||||
#if !defined SIMULATOR
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->pcm_play_stop();
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
new_setting = 9 - settings.volume;
|
new_setting = 9 - settings.volume;
|
||||||
|
|
@ -318,9 +316,6 @@ static void options_menu(void){
|
||||||
/* menu */
|
/* menu */
|
||||||
static bool zxbox_menu(void)
|
static bool zxbox_menu(void)
|
||||||
{
|
{
|
||||||
#if !defined SIMULATOR
|
|
||||||
rb->pcm_play_stop();
|
|
||||||
#endif
|
|
||||||
int selected=0;
|
int selected=0;
|
||||||
int result;
|
int result;
|
||||||
int menu_quit=0;
|
int menu_quit=0;
|
||||||
|
|
@ -332,6 +327,7 @@ static bool zxbox_menu(void)
|
||||||
"Save Snapshot", "Toggle \"fast\" mode",
|
"Save Snapshot", "Toggle \"fast\" mode",
|
||||||
"Options", "Quit");
|
"Options", "Quit");
|
||||||
|
|
||||||
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
|
|
@ -524,7 +520,3 @@ void start_spectemu(const void *parameter)
|
||||||
|
|
||||||
run_singlemode();
|
run_singlemode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version. See the file COPYING.
|
* (at your option) any later version. See the file COPYING.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
|
@ -67,71 +67,65 @@ unsigned short my_buf[TMNUM*2*3*2];
|
||||||
|
|
||||||
|
|
||||||
const byte lin8_ulaw[] = {
|
const byte lin8_ulaw[] = {
|
||||||
31, 31, 31, 32, 32, 32, 32, 33,
|
31, 31, 31, 32, 32, 32, 32, 33,
|
||||||
33, 33, 33, 34, 34, 34, 34, 35,
|
33, 33, 33, 34, 34, 34, 34, 35,
|
||||||
35, 35, 35, 36, 36, 36, 36, 37,
|
35, 35, 35, 36, 36, 36, 36, 37,
|
||||||
37, 37, 37, 38, 38, 38, 38, 39,
|
37, 37, 37, 38, 38, 38, 38, 39,
|
||||||
39, 39, 39, 40, 40, 40, 40, 41,
|
39, 39, 39, 40, 40, 40, 40, 41,
|
||||||
41, 41, 41, 42, 42, 42, 42, 43,
|
41, 41, 41, 42, 42, 42, 42, 43,
|
||||||
43, 43, 43, 44, 44, 44, 44, 45,
|
43, 43, 43, 44, 44, 44, 44, 45,
|
||||||
45, 45, 45, 46, 46, 46, 46, 47,
|
45, 45, 45, 46, 46, 46, 46, 47,
|
||||||
47, 47, 47, 48, 48, 49, 49, 50,
|
47, 47, 47, 48, 48, 49, 49, 50,
|
||||||
50, 51, 51, 52, 52, 53, 53, 54,
|
50, 51, 51, 52, 52, 53, 53, 54,
|
||||||
54, 55, 55, 56, 56, 57, 57, 58,
|
54, 55, 55, 56, 56, 57, 57, 58,
|
||||||
58, 59, 59, 60, 60, 61, 61, 62,
|
58, 59, 59, 60, 60, 61, 61, 62,
|
||||||
62, 63, 63, 64, 65, 66, 67, 68,
|
62, 63, 63, 64, 65, 66, 67, 68,
|
||||||
69, 70, 71, 72, 73, 74, 75, 76,
|
69, 70, 71, 72, 73, 74, 75, 76,
|
||||||
77, 78, 79, 81, 83, 85, 87, 89,
|
77, 78, 79, 81, 83, 85, 87, 89,
|
||||||
91, 93, 95, 99, 103, 107, 111, 119,
|
91, 93, 95, 99, 103, 107, 111, 119,
|
||||||
255, 247, 239, 235, 231, 227, 223, 221,
|
255, 247, 239, 235, 231, 227, 223, 221,
|
||||||
219, 217, 215, 213, 211, 209, 207, 206,
|
219, 217, 215, 213, 211, 209, 207, 206,
|
||||||
205, 204, 203, 202, 201, 200, 199, 198,
|
205, 204, 203, 202, 201, 200, 199, 198,
|
||||||
197, 196, 195, 194, 193, 192, 191, 191,
|
197, 196, 195, 194, 193, 192, 191, 191,
|
||||||
190, 190, 189, 189, 188, 188, 187, 187,
|
190, 190, 189, 189, 188, 188, 187, 187,
|
||||||
186, 186, 185, 185, 184, 184, 183, 183,
|
186, 186, 185, 185, 184, 184, 183, 183,
|
||||||
182, 182, 181, 181, 180, 180, 179, 179,
|
182, 182, 181, 181, 180, 180, 179, 179,
|
||||||
178, 178, 177, 177, 176, 176, 175, 175,
|
178, 178, 177, 177, 176, 176, 175, 175,
|
||||||
175, 175, 174, 174, 174, 174, 173, 173,
|
175, 175, 174, 174, 174, 174, 173, 173,
|
||||||
173, 173, 172, 172, 172, 172, 171, 171,
|
173, 173, 172, 172, 172, 172, 171, 171,
|
||||||
171, 171, 170, 170, 170, 170, 169, 169,
|
171, 171, 170, 170, 170, 170, 169, 169,
|
||||||
169, 169, 168, 168, 168, 168, 167, 167,
|
169, 169, 168, 168, 168, 168, 167, 167,
|
||||||
167, 167, 166, 166, 166, 166, 165, 165,
|
167, 167, 166, 166, 166, 166, 165, 165,
|
||||||
165, 165, 164, 164, 164, 164, 163, 163,
|
165, 165, 164, 164, 164, 164, 163, 163,
|
||||||
163, 163, 162, 162, 162, 162, 161, 161,
|
163, 163, 162, 162, 162, 162, 161, 161,
|
||||||
161, 161, 160, 160, 160, 160, 159, 159,
|
161, 161, 160, 160, 160, 160, 159, 159,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void open_snd(void)
|
static void open_snd(void)
|
||||||
{
|
{
|
||||||
sndstate = SPS_OPENED;
|
sndstate = SPS_OPENED;
|
||||||
sound_avail=1;
|
sound_avail=1;
|
||||||
rb->pcm_play_stop();
|
rb->audio_stop();
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
/* Select playback */
|
/* Select playback */
|
||||||
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
||||||
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
||||||
#endif
|
#endif
|
||||||
rb->pcm_set_frequency(SAMPR_44);
|
rb->mixer_set_frequency(SAMPR_44);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_snd(int normal)
|
static void close_snd(int normal)
|
||||||
{
|
{
|
||||||
(void)normal;
|
(void)normal;
|
||||||
sound_avail = 0;
|
sound_avail = 0;
|
||||||
rb->pcm_play_stop();
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void init_spect_sound(void)
|
void init_spect_sound(void)
|
||||||
{
|
{
|
||||||
#if 1 /* TODO: Is this OK? */
|
|
||||||
open_snd();
|
open_snd();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef VOLREDUCE
|
#ifndef VOLREDUCE
|
||||||
#define VOLREDUCE 0
|
#define VOLREDUCE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -149,7 +143,7 @@ void init_spect_sound(void)
|
||||||
|
|
||||||
static void process_sound(void)
|
static void process_sound(void)
|
||||||
{
|
{
|
||||||
static int soundhp;
|
static int soundhp;
|
||||||
int i;
|
int i;
|
||||||
byte *sb;
|
byte *sb;
|
||||||
register int sv;
|
register int sv;
|
||||||
|
|
@ -169,7 +163,7 @@ static void process_sound(void)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
signed char *tsp;
|
signed char *tsp;
|
||||||
|
|
||||||
tsp = sp_tape_sound;
|
tsp = sp_tape_sound;
|
||||||
for(i = TMNUM; i; sb++,tsp++,i--) {
|
for(i = TMNUM; i; sb++,tsp++,i--) {
|
||||||
sv = *sb + TAPESOUND(tsp);
|
sv = *sb + TAPESOUND(tsp);
|
||||||
|
|
@ -218,7 +212,7 @@ static void write_buf(void){
|
||||||
= my_buf[j+10] = my_buf[j+11] \
|
= my_buf[j+10] = my_buf[j+11] \
|
||||||
= (((byte)sp_sound_buf[i])<<8) >> settings.volume;
|
= (((byte)sp_sound_buf[i])<<8) >> settings.volume;
|
||||||
|
|
||||||
rb->pcm_play_data(&get_more,NULL,(unsigned char*)(my_buf),TMNUM*4*3*2);
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, (unsigned char*)(my_buf),TMNUM*4*3*2);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* can use to save and later analyze what we produce */
|
/* can use to save and later analyze what we produce */
|
||||||
|
|
@ -232,10 +226,9 @@ static void write_buf(void){
|
||||||
rb->close (i);
|
rb->close (i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
while(!doneplay)
|
while(!doneplay)
|
||||||
rb->yield();
|
rb->yield();
|
||||||
|
|
||||||
}
|
}
|
||||||
void play_sound(int evenframe)
|
void play_sound(int evenframe)
|
||||||
{
|
{
|
||||||
|
|
@ -249,7 +242,7 @@ void play_sound(int evenframe)
|
||||||
close_snd(1);
|
close_snd(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
z80_proc.sound_change = 0;
|
z80_proc.sound_change = 0;
|
||||||
|
|
||||||
process_sound();
|
process_sound();
|
||||||
|
|
@ -260,7 +253,7 @@ void play_sound(int evenframe)
|
||||||
|
|
||||||
void setbufsize(void)
|
void setbufsize(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -286,5 +279,3 @@ void autoclose_sound(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NO_SOUND */
|
#endif /* NO_SOUND */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,13 +103,12 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_GREY
|
#ifdef USE_GREY
|
||||||
grey_show(false);
|
grey_show(false);
|
||||||
grey_release();
|
grey_release();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined SIMULATOR
|
rb->audio_stop();
|
||||||
rb->pcm_play_stop();
|
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
#endif
|
|
||||||
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -267,4 +266,3 @@ void press_key(int c){
|
||||||
spkb_kbstate[ki].state = 1;
|
spkb_kbstate[ki].state = 1;
|
||||||
process_keys();
|
process_keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ int audio_status(void)
|
||||||
|
|
||||||
void audio_stop(void)
|
void audio_stop(void)
|
||||||
\group playback control
|
\group playback control
|
||||||
\description
|
\description Gracefully shuts down the playback (ie codec) engine. Anything else playing back (talk/voice, other mixer channels) is unaffected.
|
||||||
|
|
||||||
void backlight_off(void)
|
void backlight_off(void)
|
||||||
\group For OLED targets like the Sansa Clip, the backlight_* functions control * the display enable, which has essentially the same effect.
|
\group For OLED targets like the Sansa Clip, the backlight_* functions control * the display enable, which has essentially the same effect.
|
||||||
|
|
@ -1775,27 +1775,10 @@ void pcm_init_recording(void)
|
||||||
\conditions (defined(HAVE_RECORDING))
|
\conditions (defined(HAVE_RECORDING))
|
||||||
\description
|
\description
|
||||||
|
|
||||||
bool pcm_is_playing(void)
|
|
||||||
\group sound
|
|
||||||
\return true unless playback is paused
|
|
||||||
\description
|
|
||||||
|
|
||||||
void pcm_play_data(pcm_play_callback_type get_more, pcm_status_callback_type status_cb, const void *start, size_t size)
|
|
||||||
\group sound
|
|
||||||
\param get_more Optional callback
|
|
||||||
\param status_cb Optional status callback
|
|
||||||
\param start is the address of raw 16-16, interleaved PCM data
|
|
||||||
\param size is the size of the data to play
|
|
||||||
\description
|
|
||||||
|
|
||||||
void pcm_play_lock(void)
|
void pcm_play_lock(void)
|
||||||
\group sound
|
\group sound
|
||||||
\description
|
\description
|
||||||
|
|
||||||
void pcm_play_stop(void)
|
|
||||||
\group sound
|
|
||||||
\description Stops the playback and empties the audio buffer.
|
|
||||||
|
|
||||||
void pcm_play_unlock(void)
|
void pcm_play_unlock(void)
|
||||||
\group sound
|
\group sound
|
||||||
\description
|
\description
|
||||||
|
|
@ -1809,11 +1792,6 @@ void pcm_record_data(pcm_rec_callback_type more_ready, pcm_status_callback_type
|
||||||
\param size
|
\param size
|
||||||
\description
|
\description
|
||||||
|
|
||||||
void pcm_set_frequency(unsigned int frequency)
|
|
||||||
\group sound
|
|
||||||
\param frequency
|
|
||||||
\description
|
|
||||||
|
|
||||||
void pcm_stop_recording(void)
|
void pcm_stop_recording(void)
|
||||||
\group sound
|
\group sound
|
||||||
\conditions (defined(HAVE_RECORDING))
|
\conditions (defined(HAVE_RECORDING))
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,10 @@ void mixer_set_frequency(unsigned int samplerate)
|
||||||
pcm_set_frequency(samplerate);
|
pcm_set_frequency(samplerate);
|
||||||
samplerate = pcm_get_frequency();
|
samplerate = pcm_get_frequency();
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMPR_TYPES
|
||||||
|
samplerate &= ~SAMPR_TYPE_MASK;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (samplerate == mixer_sampr)
|
if (samplerate == mixer_sampr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue