Skip to content

Commit

Permalink
make sound rates platform dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Feb 17, 2024
1 parent 8ccf759 commit 2e0496e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions platform/common/menu_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,12 @@ static int menu_loop_adv_options(int id, int keys)

static int sndrate_prevnext(int rate, int dir)
{
static const int rates[] = { 8000, 11025, 16000, 22050, 44100, 53000 };
int rate_count = sizeof(rates)/sizeof(rates[0]);
const int *rates = plat_target.sound_rates;
int rate_count;
int i;

for (rate_count = 0; rates[rate_count] != -1; rate_count++)
;
for (i = 0; i < rate_count; i++)
if (rates[i] == rate) break;

Expand Down
3 changes: 2 additions & 1 deletion platform/common/plat_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ static struct in_pdata in_sdl_platform_data = {
.defbinds = in_sdl_defbinds,
};

struct plat_target plat_target;
static int sound_rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, 53000, -1 };
struct plat_target plat_target = { .sound_rates = sound_rates };

#if defined __MIYOO__
const char *plat_device = "miyoo";
Expand Down
2 changes: 1 addition & 1 deletion platform/gp2x/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ void pemu_sound_start(void)
}
}

static const int sound_rates[] = { 53000, 44100, 32000, 22050, 16000, 11025, 8000 };
static const int sound_rates[] = { 52000, 44100, 32000, 22050, 16000, 11025, 8000 };

void pemu_sound_stop(void)
{
Expand Down
2 changes: 1 addition & 1 deletion platform/libpicofe
Submodule libpicofe updated 4 files
+2 −1 gp2x/plat.c
+1 −1 linux/plat.c
+2 −0 pandora/plat.c
+2 −0 plat.h
3 changes: 2 additions & 1 deletion platform/ps2/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

#include "../libpicofe/plat.h"

struct plat_target plat_target = {};
static int sound_rates[] = { 11025, 22050, 44100, -1 };
struct plat_target plat_target = { .sound_rates = sound_rates };

static void reset_IOP() {
SifInitRpc(0);
Expand Down
1 change: 1 addition & 0 deletions platform/psp/emu.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* PicoDrive
* (C) notaz, 2007,2008
* (C) irixxxx, 2022-2024
*
* This work is licensed under the terms of MAME license.
* See COPYING file in the top-level directory.
Expand Down
2 changes: 2 additions & 0 deletions platform/psp/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,15 @@ static int plat_bat_capacity_get(void)
return scePowerGetBatteryLifePercent();
}

static int sound_rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, -1 };
struct plat_target plat_target = {
.cpu_clock_get = plat_cpu_clock_get,
.cpu_clock_set = plat_cpu_clock_set,
.bat_capacity_get = plat_bat_capacity_get,
// .gamma_set = plat_gamma_set,
// .hwfilter_set = plat_hwfilter_set,
// .hwfilters = plat_hwfilters,
.sound_rates = sound_rates,
};

int _flush_cache (char *addr, const int size, const int op)
Expand Down

0 comments on commit 2e0496e

Please sign in to comment.