Added software audio volume control.

This commit is contained in:
profi200 2023-08-12 18:17:13 +02:00
parent 8ecc7ce458
commit cf7d1915e0
No known key found for this signature in database
GPG Key ID: FD2BAB7782919B0A
2 changed files with 12 additions and 2 deletions

View File

@ -84,6 +84,9 @@ Audio settings.
`u8 audioOut` - Audio output. 0 = auto, 1 = speakers, 2 = headphones.
* Default: `0`
`s8 volume` - Audio volume. Values above 48 mean control via volume slider. Range -128 (muted) to -20 (100%). Avoid the range -19 to 48.
* Default: `127`
### Input
Input settings. Each entry allows one or multiple buttons. Buttons are separated by a `,` without spaces.
Allowed buttons are `A B SELECT START RIGHT LEFT UP DOWN R L X Y TOUCH CP_RIGHT CP_LEFT CP_UP CP_DOWN`.

View File

@ -59,7 +59,8 @@
"contrast=1.0\n" \
"brightness=0.0\n\n" \
"[audio]\n" \
"audioOut=0\n\n" \
"audioOut=0\n" \
"volume=127\n\n" \
"[advanced]\n" \
"saveOverride=false\n" \
"defaultSave=14"
@ -82,6 +83,8 @@ typedef struct
// [audio]
u8 audioOut; // 0 = auto, 1 = speakers, 2 = headphones.
s8 volume; // -128 = muted, -127 - 48 = -63.5 - +24 dB.
// Higher than 48 = volume control via slider.
// [input]
u32 buttonMaps[10]; // A, B, Select, Start, Right, Left, Up, Down, R, L.
@ -122,6 +125,7 @@ static OafConfig g_oafConfig =
// [audio]
0, // Automatic audio output.
127, // Control via volume slider.
// [input]
{ // buttonMaps
@ -613,6 +617,8 @@ static int cfgIniCallback(void* user, const char* section, const char* name, con
{
if(strcmp(name, "audioOut") == 0)
config->audioOut = (u8)strtoul(value, NULL, 10);
else if(strcmp(name, "volume") == 0)
config->volume = (s8)strtol(value, NULL, 10);
}
else if(strcmp(section, "input") == 0)
{
@ -859,8 +865,9 @@ Result oafInitAndRun(void)
patchRom(romFilePath, &romSize);
free(romFilePath);
// Set audio output.
// Set audio output and volume.
CODEC_setAudioOutput(g_oafConfig.audioOut);
CODEC_setVolumeOverride(g_oafConfig.volume);
// Prepare ARM9 for GBA mode + save loading.
if((res = LGY_prepareGbaMode(g_oafConfig.directBoot, saveType, filePath)) == RES_OK)