From b5a39f5edbf32b34b87a4c6478d7b1f1d20e68c1 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 01:03:48 +0200 Subject: [PATCH] Ports: Play GLTron audio at 1x speed Because of sample rate issues, the audio used to be played at 2x speed. --- ...Build-Allow-CFLAGS-env-var-to-be-set.patch | 2 +- ...-lGL-with-lgl-to-reference-our-LibGL.patch | 2 +- ...003-Build-Remove-ansi-build-argument.patch | 2 +- ...ld-Fix-char-vs.-const-char-arguments.patch | 2 +- ...05-Scripting-Fix-default-keybindings.patch | 2 +- .../0006-SDL-Convert-SDL1-to-SDL2.patch | 2 +- .../0007-SDL-Fix-2x-audio-rate-issue.patch | 29 +++++++++++++++++++ Ports/gltron/patches/ReadMe.md | 9 ++++++ 8 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch diff --git a/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch b/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch index 58fd06e0b8..6e5504779e 100644 --- a/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch +++ b/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch @@ -1,7 +1,7 @@ From 94e90c97566a73cb03c4837d53a4cddf452e42bf Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:29:43 +0200 -Subject: [PATCH 1/6] Build: Allow `CFLAGS` env var to be set +Subject: [PATCH 1/7] Build: Allow `CFLAGS` env var to be set --- configure | 2 +- diff --git a/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch b/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch index 888d29e9f5..92b652b56b 100644 --- a/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch +++ b/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch @@ -1,7 +1,7 @@ From dd42cfe84e75619676a06b05f8ebe1c1c2e658c9 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:30:04 +0200 -Subject: [PATCH 2/6] Build: Replace `-lGL` with `-lgl` to reference our LibGL +Subject: [PATCH 2/7] Build: Replace `-lGL` with `-lgl` to reference our LibGL --- configure | 4 ++-- diff --git a/Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch b/Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch index 971b01844b..2b5938bb73 100644 --- a/Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch +++ b/Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch @@ -1,7 +1,7 @@ From b01d5c00dd0dbe9512857e32ffd0822bdfb8a9e3 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:30:54 +0200 -Subject: [PATCH 3/6] Build: Remove `-ansi` build argument +Subject: [PATCH 3/7] Build: Remove `-ansi` build argument --- lua/src/Makefile.in | 2 +- diff --git a/Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch b/Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch index ed65402f79..de18e070aa 100644 --- a/Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch +++ b/Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch @@ -1,7 +1,7 @@ From 0ec20dfd57ae517d18f06c4c580d346fddd2f926 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:32:04 +0200 -Subject: [PATCH 4/6] Build: Fix `char*` vs. `const char*` arguments +Subject: [PATCH 4/7] Build: Fix `char*` vs. `const char*` arguments These arguments are of the wrong constness, which will trip our compiler. diff --git a/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch b/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch index 949abdae6b..29a51fe0b0 100644 --- a/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch +++ b/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch @@ -1,7 +1,7 @@ From d2a56ba682814f2d2451fc0729ada79290de2939 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:36:08 +0200 -Subject: [PATCH 5/6] Scripting: Fix default keybindings +Subject: [PATCH 5/7] Scripting: Fix default keybindings These constants referred to the wrong keys. --- diff --git a/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch b/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch index 0c2a045c15..9d988c95d3 100644 --- a/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch +++ b/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch @@ -1,7 +1,7 @@ From bcaa941ae5b682862aacff18e44a8a33294ba716 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 9 May 2022 00:53:48 +0200 -Subject: [PATCH 6/6] SDL: Convert SDL1 to SDL2 +Subject: [PATCH 6/7] SDL: Convert SDL1 to SDL2 --- nebu/input/input_system.c | 7 ++++--- diff --git a/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch b/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch new file mode 100644 index 0000000000..12df655787 --- /dev/null +++ b/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch @@ -0,0 +1,29 @@ +From ad6b92ee167f1241de38da428a01c27f410f3d49 Mon Sep 17 00:00:00 2001 +From: Jelle Raaijmakers +Date: Mon, 9 May 2022 01:01:47 +0200 +Subject: [PATCH 7/7] SDL: Fix 2x audio rate issue + +By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL +to perform any sample rate and/or format conversion for us. Previously +GLTron would simply ignore the result in `obtained`, causing the audio +to be played back at 2x speed. +--- + src/audio/sound_glue.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/audio/sound_glue.cpp b/src/audio/sound_glue.cpp +index 9753f09..e08b1b3 100644 +--- a/src/audio/sound_glue.cpp ++++ b/src/audio/sound_glue.cpp +@@ -170,7 +170,7 @@ extern "C" { + + SDL_AudioSpec obtained; + +- if(SDL_OpenAudio( spec, &obtained ) != 0) { ++ if(SDL_OpenAudio( spec, nullptr ) != 0) { + fprintf(stderr, "[error] %s\n", SDL_GetError()); + sound->SetStatus(Sound::eUninitialized); + } else { +-- +2.34.1 + diff --git a/Ports/gltron/patches/ReadMe.md b/Ports/gltron/patches/ReadMe.md index 42c6d4b44d..1f3be2e61d 100644 --- a/Ports/gltron/patches/ReadMe.md +++ b/Ports/gltron/patches/ReadMe.md @@ -33,3 +33,12 @@ These constants referred to the wrong keys. SDL: Convert SDL1 to SDL2 +## `0007-SDL-Fix-2x-audio-rate-issue.patch` + +SDL: Fix 2x audio rate issue + +By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL +to perform any sample rate and/or format conversion for us. Previously +GLTron would simply ignore the result in `obtained`, causing the audio +to be played back at 2x speed. +