From 8502c1433b84c4c0ce55a7fbcafbe4bdfc9b0562 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 15 Mar 2024 17:43:53 +0200 Subject: [PATCH] Fixed only audio filter mode --- audio.cpp | 14 ++++++++++++-- cfgfile.cpp | 2 +- od-win32/resources/resource.h | 1 + od-win32/resources/winuae.rc | 1 + od-win32/sounddep/sound.h | 1 + od-win32/win32gui.cpp | 12 +++++++++--- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/audio.cpp b/audio.cpp index a03a4df5..6c7fbf15 100644 --- a/audio.cpp +++ b/audio.cpp @@ -432,7 +432,8 @@ static float filter_a0; /* a500 and a1200 use the same */ enum { FILTER_NONE = 0, FILTER_MODEL_A500, - FILTER_MODEL_A1200 + FILTER_MODEL_A1200, + FILTER_MODEL_A500_FIXEDONLY }; /* Amiga has two separate filtering circuits per channel, a static RC filter @@ -471,6 +472,13 @@ static int filter (int input, struct filter_state *fs) led_output = fs->rc5; break; + case FILTER_MODEL_A500_FIXEDONLY: + fs->rc1 = (float)(a500e_filter1_a0 * input + (1.0f - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET); + fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1.0f - a500e_filter2_a0) * fs->rc2; + normal_output = fs->rc2; + led_output = fs->rc2; + break; + case FILTER_MODEL_A1200: normal_output = (float)input; @@ -626,7 +634,7 @@ static void samplexx_sinc_handler (int *datasp, int ch_start, int ch_num) int const *winsinc; if (sound_use_filter_sinc && ch_start == 0) { - n = (sound_use_filter_sinc == FILTER_MODEL_A500) ? 0 : 2; + n = (sound_use_filter_sinc == FILTER_MODEL_A500 || sound_use_filter_sinc == FILTER_MODEL_A500_FIXEDONLY) ? 0 : 2; if (led_filter_on) n += 1; } else { @@ -2193,6 +2201,8 @@ void set_audio (void) sound_use_filter = FILTER_MODEL_A500; else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A1200) sound_use_filter = FILTER_MODEL_A1200; + else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A500_FIXEDONLY) + sound_use_filter = FILTER_MODEL_A500_FIXEDONLY; } a500e_filter1_a0 = rc_calculate_a0 (currprefs.sound_freq, 6200); a500e_filter2_a0 = rc_calculate_a0 (currprefs.sound_freq, 20000); diff --git a/cfgfile.cpp b/cfgfile.cpp index 33e4b56c..58b3a5ab 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -160,7 +160,7 @@ static const TCHAR *compmode[] = { _T("direct"), _T("indirect"), _T("indirectKS" static const TCHAR *flushmode[] = { _T("soft"), _T("hard"), 0 }; static const TCHAR *kbleds[] = { _T("none"), _T("POWER"), _T("DF0"), _T("DF1"), _T("DF2"), _T("DF3"), _T("HD"), _T("CD"), _T("DFx"), 0 }; static const TCHAR *onscreenleds[] = { _T("false"), _T("true"), _T("rtg"), _T("both"), 0 }; -static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), 0 }; +static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), _T("fixedonly"), 0 }; static const TCHAR *soundfiltermode2[] = { _T("standard"), _T("enhanced"), 0 }; static const TCHAR *lorestype1[] = { _T("lores"), _T("hires"), _T("superhires"), 0 }; static const TCHAR *lorestype2[] = { _T("true"), _T("false"), 0 }; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 66f74ecf..07a8c87f 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -435,6 +435,7 @@ #define IDS_NONE2 440 #define IDS_SOUND_CLONED71 441 #define IDS_SOUND_71 442 +#define IDS_SOUND_FILTER_ON_FIXEDONLY 443 #define IDS_QS_MODELS 1000 #define IDS_QS_MODEL_A500 1001 #define IDS_QS_MODEL_A500P 1002 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 64e3a381..63f79d87 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -2239,6 +2239,7 @@ BEGIN IDS_NONE2 "" IDS_SOUND_CLONED71 "Cloned stereo (7.1)" IDS_SOUND_71 "7.1 channels" + IDS_SOUND_FILTER_ON_FIXEDONLY "Always on (Fixed only)" END #endif // English (United Kingdom) resources diff --git a/od-win32/sounddep/sound.h b/od-win32/sounddep/sound.h index 384f6f0a..56fa34bb 100644 --- a/od-win32/sounddep/sound.h +++ b/od-win32/sounddep/sound.h @@ -82,6 +82,7 @@ extern int active_sound_stereo; #define FILTER_SOUND_TYPE_A500 0 #define FILTER_SOUND_TYPE_A1200 1 +#define FILTER_SOUND_TYPE_A500_FIXEDONLY 2 struct dsaudiomodes { int ch; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 67483aa4..5e7084c2 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -14024,8 +14024,10 @@ static void values_to_sounddlg (HWND hDlg) xSendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt); WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_AGA, txt, sizeof (txt) / sizeof (TCHAR)); xSendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt); - WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_A500, txt, sizeof (txt) / sizeof (TCHAR)); - xSendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt); + WIN32GUI_LoadUIString(IDS_SOUND_FILTER_ON_A500, txt, sizeof(txt) / sizeof(TCHAR)); + xSendDlgItemMessage(hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt); + WIN32GUI_LoadUIString(IDS_SOUND_FILTER_ON_FIXEDONLY, txt, sizeof(txt) / sizeof(TCHAR)); + xSendDlgItemMessage(hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt); i = 0; switch (workprefs.sound_filter) { @@ -14036,7 +14038,7 @@ static void values_to_sounddlg (HWND hDlg) i = workprefs.sound_filter_type ? 2 : 1; break; case 2: - i = workprefs.sound_filter_type ? 4 : 3; + i = workprefs.sound_filter_type == 2 ? 5 : (workprefs.sound_filter_type == 1 ? 4 : 3); break; } xSendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_SETCURSEL, i, 0); @@ -14243,6 +14245,10 @@ static void values_from_sounddlg (HWND hDlg) workprefs.sound_filter = FILTER_SOUND_ON; workprefs.sound_filter_type = 1; break; + case 5: + workprefs.sound_filter = FILTER_SOUND_ON; + workprefs.sound_filter_type = 2; + break; } workprefs.sound_stereo_swap_paula = (xSendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_GETCURSEL, 0, 0) & 1) ? 1 : 0; -- 2.47.3