From 14ecc7d2900788b10c4a84314350a39f5c963040 Mon Sep 17 00:00:00 2001 From: Chance4us <45902449+Chance4us@users.noreply.github.com> Date: Fri, 28 Dec 2018 17:16:37 +0100 Subject: [PATCH 1/2] Update sound.cpp great audio quality improvement from 8 to 16 bit format --- Stub/sound.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Stub/sound.cpp b/Stub/sound.cpp index 5a07b1762..4bdcf407d 100644 --- a/Stub/sound.cpp +++ b/Stub/sound.cpp @@ -41,7 +41,7 @@ void __fastcall snd_init(HWND hWnd) printf("Opened 3 channels\n\n\n"); } - if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) { + if (Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 1024) < 0) { printf("SDL_mixer could not initialize! SDL_mixer Error: %s\n", Mix_GetError()); } @@ -76,9 +76,9 @@ void fill_audio(void *udata, Uint8 *stream, int len) void __fastcall music_start(int nTrack) { //DUMMY(); - wanted.freq = 22050; - wanted.format = AUDIO_S8; - wanted.channels = 5; /* 1 = mono, 2 = stereo */ + wanted.freq = 44100; + wanted.format = AUDIO_S16LSB; + wanted.channels = 2; /* 1 = mono, 2 = stereo */ wanted.samples = 1024; /* Good low-latency value for callback */ wanted.callback = fill_audio; wanted.userdata = NULL; @@ -101,7 +101,7 @@ void __fastcall music_start(int nTrack) // This is a hack.... I don't like it . // If you know this better than I , please help clean it up. - Mix_OpenAudio(22050, AUDIO_S8, 1, 1024); + Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 1024); file = sgpMusicTrack; bytestoread = (int)SFileGetFileSize((HANDLE)file, 0); buffer = DiabloAllocPtr(bytestoread); @@ -222,4 +222,4 @@ void __fastcall snd_update(BOOL bStopAll) { // DUMMY_PRINT("stopall: %d", bStopAll); -} \ No newline at end of file +} From 62591c7be8a4a95ea64aa5b892e81ec550c1f6c4 Mon Sep 17 00:00:00 2001 From: Chance4us <45902449+Chance4us@users.noreply.github.com> Date: Fri, 28 Dec 2018 22:11:27 +0100 Subject: [PATCH 2/2] Update sound.cpp line 104 / Mix_OpenAudio / third parameter had to be reverted --- Stub/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stub/sound.cpp b/Stub/sound.cpp index 4bdcf407d..af0e2f3f8 100644 --- a/Stub/sound.cpp +++ b/Stub/sound.cpp @@ -101,7 +101,7 @@ void __fastcall music_start(int nTrack) // This is a hack.... I don't like it . // If you know this better than I , please help clean it up. - Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 1024); + Mix_OpenAudio(44100, AUDIO_S16LSB, 1, 1024); file = sgpMusicTrack; bytestoread = (int)SFileGetFileSize((HANDLE)file, 0); buffer = DiabloAllocPtr(bytestoread);