From 889e4d01805be30a5c4f6ce73b8f0995e8718473 Mon Sep 17 00:00:00 2001 From: Starg Date: Fri, 22 Dec 2023 22:37:04 +0900 Subject: [PATCH 1/3] [wasapi] Fix occasional AUDCLNT_E_BUFFER_TOO_LARGE errors in event-driven shared mode --- timidity/wasapi_a.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/timidity/wasapi_a.c b/timidity/wasapi_a.c index 7fe189fa..584ad20f 100644 --- a/timidity/wasapi_a.c +++ b/timidity/wasapi_a.c @@ -524,6 +524,7 @@ static int write_buffer_event(void) { UINT32 padding = 0; size_t out_bytes, out_frames; + size_t short_bytes = 0, short_frames = 0; BYTE *buf = NULL; if(!IsExclusive) @@ -532,20 +533,15 @@ static int write_buffer_event(void) out_bytes = calc_output_bytes((BufferFrames - padding) * FrameBytes); out_frames = out_bytes / FrameBytes; if(IsExclusive && out_frames < BufferFrames){ - if(!input_buffer(NULL, BufferFrames * FrameBytes - out_bytes)) - return FALSE; - out_bytes = BufferFrames * FrameBytes; - out_frames = out_bytes / FrameBytes; - }else if(out_frames == 0){ - if(!input_buffer(NULL, FrameBytes - out_bytes)) - return FALSE; - out_bytes = FrameBytes; - out_frames = 1; + short_frames = BufferFrames - out_frames; + short_bytes = short_frames * FrameBytes; } - if(check_hresult_failed(IAudioRenderClient_GetBuffer(pAudioRenderClient, out_frames, &buf), "IAudioRenderClient::GetBuffer()")) + if(check_hresult_failed(IAudioRenderClient_GetBuffer(pAudioRenderClient, out_frames + short_frames, &buf), "IAudioRenderClient::GetBuffer()")) return FALSE; output_buffer((uint8 *)buf, out_bytes); - IAudioRenderClient_ReleaseBuffer(pAudioRenderClient, out_frames, 0); + if(short_bytes > 0) + memset(buf + out_bytes, 0, short_bytes); + IAudioRenderClient_ReleaseBuffer(pAudioRenderClient, out_frames + short_frames, 0); return TRUE; } From 2cb7253becea2142ca845ade66bef4082331e2a5 Mon Sep 17 00:00:00 2001 From: Starg Date: Sat, 23 Dec 2023 17:34:57 +0900 Subject: [PATCH 2/3] Add version resource to sfviewer --- interface/w32g_res.rc | 7 +++---- sf_view_gui/CMakeLists.txt | 1 + sf_view_gui/sfview_dlg.rc | 41 +++++++++++++++++++++++++++++++++++++- version.h.in | 5 ++++- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/interface/w32g_res.rc b/interface/w32g_res.rc index 59778e64..6f0c5d1f 100644 --- a/interface/w32g_res.rc +++ b/interface/w32g_res.rc @@ -4158,22 +4158,21 @@ VS_VERSION_INFO VERSIONINFO { VALUE "Comments", "\0" VALUE "CompanyName", "\0" - VALUE "FileVersion", TIMID_VERSION_RESSTR + VALUE "FileVersion", TIMID_VERSION4_RESSTR #ifdef TWSYNG32 VALUE "FileDescription", "TiMidity++ Win32GUI Synthesizer\0" VALUE "InternalName", "twsyng\0" VALUE "OriginalFilename", "twsyng.exe\0" - VALUE "ProductName", "TiMidity++ Win32GUI Synthesizer Version\0" #else VALUE "FileDescription", "TiMidity++ Win32GUI\0" VALUE "InternalName", "timw32g\0" VALUE "OriginalFilename", "timw32g.exe\0" - VALUE "ProductName", "TiMidity++ Win32GUI Version\0" #endif + VALUE "ProductName", "TiMidity++\0" VALUE "LegalCopyright", "Copyright (C) 1999-2018 Masanao Izumo \r\nCopyright (C) 1995 Tuukka Toivonen \0" VALUE "LegalTrademarks", "\0" VALUE "PrivateBuild", "\0" - VALUE "ProductVersion", TIMID_VERSION + VALUE "ProductVersion", TIMID_VERSION_RESSTR VALUE "SpecialBuild", "\0" } } diff --git a/sf_view_gui/CMakeLists.txt b/sf_view_gui/CMakeLists.txt index ea25abb8..96cdb5c4 100644 --- a/sf_view_gui/CMakeLists.txt +++ b/sf_view_gui/CMakeLists.txt @@ -22,5 +22,6 @@ add_executable( sfview_dlg.rc ) +add_dependencies(sfviewer UpdateTim41Version) target_link_libraries(sfviewer timidity_cfgforsf libarc utils comctl32 shlwapi ws2_32) install(TARGETS sfviewer) diff --git a/sf_view_gui/sfview_dlg.rc b/sf_view_gui/sfview_dlg.rc index fbdd3703..3f38da28 100644 --- a/sf_view_gui/sfview_dlg.rc +++ b/sf_view_gui/sfview_dlg.rc @@ -2,6 +2,7 @@ #include #include #include "resource.h" +#include "version.h" IDB_TREEICON BITMAP "bitmap1.bmp" @@ -30,7 +31,7 @@ END 101 DIALOGEX 0, 0, 255, 195 STYLE WS_OVERLAPPEDWINDOW | DS_CENTER EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Soundfont Viewer 1.01" +CAPTION SFVIEWER_TITLE_WITH_VERSION MENU IDR_MENU1 LANGUAGE LANG_JAPANESE, 0x1 FONT 9, "MS UI Gothic", FW_NORMAL, 0, 128 @@ -43,3 +44,41 @@ END IDI_ICON1 ICON "icon1.ico" +// +// Version Information resources +// +#ifdef _MSC_VER +LANGUAGE LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN +#endif +VS_VERSION_INFO VERSIONINFO +FILEVERSION TIMID_VERSION4_COMMA +PRODUCTVERSION TIMID_VERSION4_COMMA +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE VFT2_UNKNOWN +FILEFLAGSMASK 0x0000003F +FILEFLAGS 0x00000000 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004E4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileVersion", TIMID_VERSION4_RESSTR + VALUE "FileDescription", "Soundfont Viewer\0" + VALUE "InternalName", "sfviewer\0" + VALUE "OriginalFilename", "sfviewer.exe\0" + VALUE "ProductName", "TiMidity++\0" + VALUE "LegalCopyright", "Copyright (C) 1999-2018 Masanao Izumo \r\nCopyright (C) 1995 Tuukka Toivonen \0" + VALUE "LegalTrademarks", "\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductVersion", TIMID_VERSION_RESSTR + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0000, 0x04E4 + END +END diff --git a/version.h.in b/version.h.in index affc4cf2..ac82e33d 100644 --- a/version.h.in +++ b/version.h.in @@ -23,7 +23,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define ___VERSION_H_ #define TIMID_VERSION "${tim41VersionStr}" +#define TIMID_VERSION_RESSTR "${tim41VersionStr}\0" #define TIMID_VERSION4_COMMA ${tim41Version4Comma} -#define TIMID_VERSION_RESSTR "${tim41Version4Comma}\0" +#define TIMID_VERSION4_RESSTR "${tim41Version4Comma}\0" + +#define SFVIEWER_TITLE_WITH_VERSION "Soundfont Viewer v${tim41VersionStr}" #endif /* !___VERSION_H_ */ From 95fa1dc351f83dfd62bdd7bda04a9ee09ad69d14 Mon Sep 17 00:00:00 2001 From: Starg Date: Sat, 23 Dec 2023 17:37:35 +0900 Subject: [PATCH 3/3] [flac] Add missing #include --- FLAC/src/stream_decoder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/FLAC/src/stream_decoder.c b/FLAC/src/stream_decoder.c index 18d8dd3b..8d7d5fd9 100644 --- a/FLAC/src/stream_decoder.c +++ b/FLAC/src/stream_decoder.c @@ -34,6 +34,7 @@ # include #endif +#include #include #include /* for malloc() */ #include /* for memset/memcpy() */