You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(78) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2024-09-25 11:21:19
|
Author: manx Date: Wed Sep 25 13:21:06 2024 New Revision: 21746 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21746 Log: [Ref] openmpt123: Return device lists as vector instead of plain text. [Ref] openmpt123: Move version information into audio backends. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Wed Sep 25 13:21:06 2024 (r21746) @@ -223,26 +223,13 @@ public: static void show_versions( [[maybe_unused]] concat_stream<mpt::ustring> & log ) { #ifdef MPT_WITH_SDL2 - log << MPT_USTRING(" libSDL2 "); - SDL_version sdlver; - std::memset( &sdlver, 0, sizeof( SDL_version ) ); - SDL_GetVersion( &sdlver ); - log << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); - const char * revision = SDL_GetRevision(); - if ( revision ) { - log << MPT_USTRING(" (") << mpt::transcode<mpt::ustring>( sdl2_encoding, revision ) << MPT_USTRING(")"); - } - log << MPT_USTRING(", "); - std::memset( &sdlver, 0, sizeof( SDL_version ) ); - SDL_VERSION( &sdlver ); - log << MPT_USTRING("API: ") << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); - log << MPT_USTRING(" <https://libsdl.org/>") << lf; + log << MPT_USTRING(" ") << show_sdl2_version() << lf; #endif #ifdef MPT_WITH_PULSEAUDIO - log << MPT_USTRING(" ") << MPT_USTRING("libpulse, libpulse-simple") << MPT_USTRING(" (headers ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, pa_get_headers_version() ) << MPT_USTRING(", API ") << PA_API_VERSION << MPT_USTRING(", PROTOCOL ") << PA_PROTOCOL_VERSION << MPT_USTRING(", library ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, ( pa_get_library_version() ? pa_get_library_version() : "unknown" ) ) << MPT_USTRING(") <https://www.freedesktop.org/wiki/Software/PulseAudio/>") << lf; + log << MPT_USTRING(" ") << show_pulseaudio_version() << lf; #endif #ifdef MPT_WITH_PORTAUDIO - log << MPT_USTRING(" ") << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetVersionText() ) << MPT_USTRING(" (") << Pa_GetVersion() << MPT_USTRING(") <http://portaudio.com/>") << lf; + log << MPT_USTRING(" ") << show_portaudio_version() << lf; #endif } static void show_drivers( concat_stream<mpt::ustring> & drivers ) { @@ -268,19 +255,49 @@ devices << MPT_USTRING(" Available devices:") << lf; devices << MPT_USTRING(" default: default") << lf; #if defined( MPT_WITH_PULSEAUDIO ) - devices << show_pulseaudio_devices( log ); + devices << MPT_USTRING(" pulseaudio:") << lf; + { + auto devs = show_pulseaudio_devices( log ); + for ( const auto & dev : devs ) { + devices << MPT_USTRING(" ") << dev << lf; + } + } #endif #if defined( MPT_WITH_SDL2 ) - devices << show_sdl2_devices( log ); + devices << MPT_USTRING(" SDL2:") << lf; + { + auto devs = show_sdl2_devices( log ); + for ( const auto & dev : devs ) { + devices << MPT_USTRING(" ") << dev << lf; + } + } #endif #if defined( MPT_WITH_PORTAUDIO ) - devices << show_portaudio_devices( log ); + devices << MPT_USTRING(" portaudio:") << lf; + { + auto devs = show_portaudio_devices( log ); + for ( const auto & dev : devs ) { + devices << MPT_USTRING(" ") << dev << lf; + } + } #endif #if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT - devices << show_waveout_devices( log ); + devices << MPT_USTRING(" waveout:") << lf; + { + auto devs = show_waveout_devices( log ); + for ( const auto & dev : devs ) { + devices << MPT_USTRING(" ") << dev << lf; + } + } #endif #if defined( MPT_WITH_ALLEGRO42 ) - devices << show_allegro42_devices( log ); + devices << MPT_USTRING(" allegro42:") << lf; + { + auto devs = show_allegro42_devices( log ); + for ( const auto & dev : devs ) { + devices << MPT_USTRING(" ") << dev << lf; + } + } #endif } public: Modified: trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp Wed Sep 25 13:21:06 2024 (r21746) @@ -174,11 +174,10 @@ } }; -static mpt::ustring show_allegro42_devices( concat_stream<mpt::ustring> & /* log */ ) { - string_concat_stream<mpt::ustring> devices; - devices << MPT_USTRING(" allegro42:") << lf; - devices << MPT_USTRING(" ") << MPT_USTRING("0") << MPT_USTRING(": Default Device") << lf; - return devices.str(); +inline std::vector<mpt::ustring> show_allegro42_devices( concat_stream<mpt::ustring> & /* log */ ) { + string_concat_stream<mpt::ustring> device; + device << MPT_USTRING("0") << MPT_USTRING(": Default Device"); + return { device.str() }; } } // namespace openmpt123 Modified: trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp Wed Sep 25 13:21:06 2024 (r21746) @@ -258,38 +258,44 @@ #define portaudio_stream_raii portaudio_stream_blocking_raii -static mpt::ustring show_portaudio_devices( concat_stream<mpt::ustring> & log ) { - string_concat_stream<mpt::ustring> devices; - devices << MPT_USTRING(" portaudio:") << lf; +inline std::vector<mpt::ustring> show_portaudio_devices( concat_stream<mpt::ustring> & log ) { + std::vector<mpt::ustring> devices; portaudio_raii portaudio( false, log ); for ( PaDeviceIndex i = 0; i < Pa_GetDeviceCount(); ++i ) { if ( Pa_GetDeviceInfo( i ) && Pa_GetDeviceInfo( i )->maxOutputChannels > 0 ) { - devices << MPT_USTRING(" ") << i << MPT_USTRING(": "); + string_concat_stream<mpt::ustring> device; + device << i << MPT_USTRING(": "); if ( Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi ) && Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi )->name ) { - devices << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi )->name ); + device << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi )->name ); } else { - devices << MPT_USTRING("Host API ") << Pa_GetDeviceInfo( i )->hostApi; + device << MPT_USTRING("Host API ") << Pa_GetDeviceInfo( i )->hostApi; } if ( Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi ) ) { if ( i == Pa_GetHostApiInfo( Pa_GetDeviceInfo( i )->hostApi )->defaultOutputDevice ) { - devices << MPT_USTRING(" (default)"); + device << MPT_USTRING(" (default)"); } } - devices << MPT_USTRING(" - "); + device << MPT_USTRING(" - "); if ( Pa_GetDeviceInfo( i )->name ) { - devices << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetDeviceInfo( i )->name ); + device << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetDeviceInfo( i )->name ); } else { - devices << MPT_USTRING("Device ") << i; + device << MPT_USTRING("Device ") << i; } - devices << MPT_USTRING(" ("); - devices << MPT_USTRING("high latency: ") << Pa_GetDeviceInfo( i )->defaultHighOutputLatency; - devices << MPT_USTRING(", "); - devices << MPT_USTRING("low latency: ") << Pa_GetDeviceInfo( i )->defaultLowOutputLatency; - devices << MPT_USTRING(")"); - devices << lf; + device << MPT_USTRING(" ("); + device << MPT_USTRING("high latency: ") << Pa_GetDeviceInfo( i )->defaultHighOutputLatency; + device << MPT_USTRING(", "); + device << MPT_USTRING("low latency: ") << Pa_GetDeviceInfo( i )->defaultLowOutputLatency; + device << MPT_USTRING(")"); + devices.push_back( device.str() ); } } - return devices.str(); + return devices; +} + +inline mpt::ustring show_portaudio_version() { + string_concat_stream<mpt::ustring> log; + log << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetVersionText() ) << MPT_USTRING(" (") << Pa_GetVersion() << MPT_USTRING(") <http://portaudio.com/>"); + return log.str(); } } // namespace openmpt123 Modified: trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp Wed Sep 25 13:21:06 2024 (r21746) @@ -154,11 +154,16 @@ } }; -static mpt::ustring show_pulseaudio_devices( concat_stream<mpt::ustring> & /* log */ ) { - string_concat_stream<mpt::ustring> devices; - devices << MPT_USTRING(" pulseaudio:") << lf; - devices << MPT_USTRING(" ") << MPT_USTRING("0") << MPT_USTRING(": Default Device") << lf; - return devices.str(); +inline std::vector<mpt::ustring> show_pulseaudio_devices( concat_stream<mpt::ustring> & /* log */ ) { + string_concat_stream<mpt::ustring> device; + device << MPT_USTRING("0") << MPT_USTRING(": Default Device"); + return { device.str() }; +} + +inline mpt::ustring show_pulseaudio_version() { + string_concat_stream<mpt::ustring> log; + log << MPT_USTRING("libpulse, libpulse-simple") << MPT_USTRING(" (headers ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, pa_get_headers_version() ) << MPT_USTRING(", API ") << PA_API_VERSION << MPT_USTRING(", PROTOCOL ") << PA_PROTOCOL_VERSION << MPT_USTRING(", library ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, ( pa_get_library_version() ? pa_get_library_version() : "unknown" ) ) << MPT_USTRING(") <https://www.freedesktop.org/wiki/Software/PulseAudio/>"); + return log.str(); } } // namespace openmpt123 Modified: trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp Wed Sep 25 13:21:06 2024 (r21746) @@ -189,10 +189,9 @@ } }; -static mpt::ustring show_sdl2_devices( concat_stream<mpt::ustring> & /* log */ ) { - string_concat_stream<mpt::ustring> devices; +inline std::vector<mpt::ustring> show_sdl2_devices( concat_stream<mpt::ustring> & /* log */ ) { + std::vector<mpt::ustring> devices; std::size_t device_index = 0; - devices << MPT_USTRING(" SDL2:") << lf; sdl2_raii sdl2( SDL_INIT_NOPARACHUTE | SDL_INIT_AUDIO ); for ( int driver = 0; driver < SDL_GetNumAudioDrivers(); ++driver ) { const char * driver_name = SDL_GetAudioDriver( driver ); @@ -206,6 +205,7 @@ continue; } for ( int device = 0; device < SDL_GetNumAudioDevices( 0 ); ++device ) { + string_concat_stream<mpt::ustring> dev; const char * device_name = SDL_GetAudioDeviceName( device, 0 ); if ( !device_name ) { continue; @@ -213,12 +213,32 @@ if ( std::string( device_name ).empty() ) { continue; } - devices << MPT_USTRING(" ") << device_index << MPT_USTRING(": ") << mpt::transcode<mpt::ustring>( sdl2_encoding, driver_name ) << MPT_USTRING(" - ") << mpt::transcode<mpt::ustring>( sdl2_encoding, device_name ) << lf; + dev << device_index << MPT_USTRING(": ") << mpt::transcode<mpt::ustring>( sdl2_encoding, driver_name ) << MPT_USTRING(" - ") << mpt::transcode<mpt::ustring>( sdl2_encoding, device_name ); device_index++; + devices.push_back( dev.str() ); } SDL_AudioQuit(); } - return devices.str(); + return devices; +} + +inline mpt::ustring show_sdl2_version() { + string_concat_stream<mpt::ustring> log; + log << MPT_USTRING("libSDL2 "); + SDL_version sdlver; + std::memset(&sdlver, 0, sizeof(SDL_version)); + SDL_GetVersion(&sdlver); + log << static_cast<int>(sdlver.major) << MPT_USTRING(".") << static_cast<int>(sdlver.minor) << MPT_USTRING(".") << static_cast<int>(sdlver.patch); + const char* revision = SDL_GetRevision(); + if (revision) { + log << MPT_USTRING(" (") << mpt::transcode<mpt::ustring>(sdl2_encoding, revision) << MPT_USTRING(")"); + } + log << MPT_USTRING(", "); + std::memset(&sdlver, 0, sizeof(SDL_version)); + SDL_VERSION(&sdlver); + log << MPT_USTRING("API: ") << static_cast<int>(sdlver.major) << MPT_USTRING(".") << static_cast<int>(sdlver.minor) << MPT_USTRING(".") << static_cast<int>(sdlver.patch); + log << MPT_USTRING(" <https://libsdl.org/>"); + return log.str(); } } // namespace openmpt123 Modified: trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Wed Sep 25 13:19:30 2024 (r21745) +++ trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Wed Sep 25 13:21:06 2024 (r21746) @@ -177,22 +177,22 @@ } }; -static mpt::ustring show_waveout_devices( concat_stream<mpt::ustring> & /*log*/ ) { - string_concat_stream<mpt::ustring> devices; - devices << MPT_USTRING(" waveout:") << lf; +inline std::vector<mpt::ustring> show_waveout_devices( concat_stream<mpt::ustring> & /*log*/ ) { + std::vector<mpt::ustring> devices; for ( UINT i = 0; i < waveOutGetNumDevs(); ++i ) { - devices << MPT_USTRING(" ") << i << MPT_USTRING(": "); + string_concat_stream<mpt::ustring> device; + device << i << MPT_USTRING(": "); WAVEOUTCAPS caps; ZeroMemory( &caps, sizeof( caps ) ); waveOutGetDevCaps( i, &caps, sizeof( caps ) ); #if defined(UNICODE) - devices << mpt::transcode<mpt::ustring>( caps.szPname ); + device << mpt::transcode<mpt::ustring>( caps.szPname ); #else - devices << mpt::transcode<mpt::ustring>( mpt::logical_encoding::locale, caps.szPname ); + device << mpt::transcode<mpt::ustring>( mpt::logical_encoding::locale, caps.szPname ); #endif - devices << lf; + devices.push_back( device.str() ); } - return devices.str(); + return devices; } } // namespace openmpt123 |
From: <sv...@op...> - 2024-09-25 11:19:37
|
Author: sagamusix Date: Wed Sep 25 13:19:30 2024 New Revision: 21745 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21745 Log: Merged revision(s) 21744 from trunk/OpenMPT: [Fix] Plugin editor: Pasting a preset may cause a change of the menu bar height due to longer preset name. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/mptrack/AbstractVstEditor.cpp Modified: branches/OpenMPT-1.31/mptrack/AbstractVstEditor.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/AbstractVstEditor.cpp Wed Sep 25 13:19:13 2024 (r21744) +++ branches/OpenMPT-1.31/mptrack/AbstractVstEditor.cpp Wed Sep 25 13:19:30 2024 (r21745) @@ -235,6 +235,7 @@ { pModDoc->SetModified(); } + WindowSizeAdjuster adjuster(*this); UpdatePresetField(); } else { @@ -340,7 +341,6 @@ } DrawMenuBar(); - } |
From: <sv...@op...> - 2024-09-25 11:19:25
|
Author: sagamusix Date: Wed Sep 25 13:19:13 2024 New Revision: 21744 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21744 Log: [Fix] Plugin editor: Pasting a preset may cause a change of the menu bar height due to longer preset name. Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp ============================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp Wed Sep 25 10:51:19 2024 (r21743) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp Wed Sep 25 13:19:13 2024 (r21744) @@ -239,6 +239,7 @@ { pModDoc->SetModified(); } + WindowSizeAdjuster adjuster(*this); UpdatePresetField(); } else { @@ -344,7 +345,6 @@ } DrawMenuBar(); - } |
From: <sv...@op...> - 2024-09-25 08:51:25
|
Author: manx Date: Wed Sep 25 10:51:19 2024 New Revision: 21743 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21743 Log: [Fix] openmpt123: We need to verify DJGPP crt0 flags before modifying them. See r21742. Modified: branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.31/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Wed Sep 25 10:43:38 2024 (r21742) +++ branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Wed Sep 25 10:51:19 2024 (r21743) @@ -2203,8 +2203,8 @@ static int main( int argc, char * argv [] ) { #endif #if MPT_OS_DJGPP - _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; /* disable automatic locking for all further memory allocations */ assert(mpt::platform::libc().is_ok()); + _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; /* disable automatic locking for all further memory allocations */ #endif /* MPT_OS_DJGPP */ std::vector<mpt::ustring> args; #if MPT_OS_WINDOWS && defined(UNICODE) |
From: <sv...@op...> - 2024-09-25 08:43:50
|
Author: manx Date: Wed Sep 25 10:43:38 2024 New Revision: 21742 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21742 Log: [Fix] mpt/main/main.hpp: We need to verify DJGPP crt0 flags before modifying them. Modified: trunk/OpenMPT/src/mpt/main/main.hpp Modified: trunk/OpenMPT/src/mpt/main/main.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/main/main.hpp Wed Sep 25 10:34:23 2024 (r21741) +++ trunk/OpenMPT/src/mpt/main/main.hpp Wed Sep 25 10:43:38 2024 (r21742) @@ -100,8 +100,8 @@ /* clang-format off */ #define MPT_MAIN_PROLOG() \ do { \ - _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; \ assert(mpt::platform::libc().is_ok()); \ + _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; \ } while (0) \ /**/ /* clang-format on */ |
From: <sv...@op...> - 2024-09-25 08:34:35
|
Author: manx Date: Wed Sep 25 10:34:23 2024 New Revision: 21741 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21741 Log: [Fix] UNIC: Fix copyright notice. Modified: trunk/OpenMPT/soundlib/Load_unic.cpp Modified: trunk/OpenMPT/soundlib/Load_unic.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_unic.cpp Wed Sep 25 10:32:26 2024 (r21740) +++ trunk/OpenMPT/soundlib/Load_unic.cpp Wed Sep 25 10:34:23 2024 (r21741) @@ -7,7 +7,7 @@ * UNIC files without file signature are not supported. * Authors: OpenMPT Devs * Based on ProWizard by Asle - * The OpenMPT source code is released under the BSD lUNICnse. Read LUNICNSE for more details. + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ |
From: <sv...@op...> - 2024-09-25 08:32:40
|
Author: manx Date: Wed Sep 25 10:32:26 2024 New Revision: 21740 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21740 Log: [Var] Apply svn auto-props. Modified: trunk/OpenMPT/soundlib/Load_unic.cpp (contents, props changed) Modified: trunk/OpenMPT/soundlib/Load_unic.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_unic.cpp Tue Sep 24 15:41:13 2024 (r21739) +++ trunk/OpenMPT/soundlib/Load_unic.cpp Wed Sep 25 10:32:26 2024 (r21740) @@ -1,254 +1,254 @@ -/* - * Load_unic.cpp - * ------------- - * Purpose: UNIC Tracker v1 loader - * Notes : UNIC Tracker is actually a module packer, not a stand-alone tracker software. - * Support is mostly included to avoid such modules being recognized as regular M.K. MODs. - * UNIC files without file signature are not supported. - * Authors: OpenMPT Devs - * Based on ProWizard by Asle - * The OpenMPT source code is released under the BSD lUNICnse. Read LUNICNSE for more details. - */ - - -#include "stdafx.h" -#include "Loaders.h" -#include "MODTools.h" - -OPENMPT_NAMESPACE_BEGIN - - -static bool ValidateUNICSampleHeader(const MODSampleHeader &sampleHeader) -{ - if(CountInvalidChars(mpt::as_span(sampleHeader.name).subspan(0, 20))) - return false; - int16be finetune; - memcpy(&finetune, &sampleHeader.name[20], sizeof(int16be)); - if(finetune < -42 || finetune > 8) // African Dreams.unic has finetune = -42 - return false; - if(sampleHeader.finetune != 0 || sampleHeader.volume > 64) - return false; - if(sampleHeader.length >= 0x8000 || sampleHeader.loopStart >= 0x8000 || sampleHeader.loopLength >= 0x8000) - return false; - if(!sampleHeader.length && (sampleHeader.loopStart > 0 || sampleHeader.loopLength > 1 || finetune != 0)) - return false; - if(sampleHeader.length && sampleHeader.length < sampleHeader.loopStart + sampleHeader.loopLength) - return false; - return true; -} - - -static bool ValidateUNICPatternEntry(const std::array<uint8, 3> data, SAMPLEINDEX lastSample) -{ - if(data[0] > 0x74) - return false; - if((data[0] & 0x3F) > 0x24) - return false; - const uint8 command = (data[1] & 0x0F), param = data[2]; - if(command == 0x0C && param > 80) // Mastercoma.unic has values > 64 - return false; - if(command == 0x0B && param > 0x7F) - return false; - if(command == 0x0D && param > 0x40) - return false; - if(uint8 instr = ((data[0] >> 2) & 0x30) | ((data[1] >> 4) & 0x0F); instr > lastSample) - return false; - return true; -} - - -struct UNICFileHeader -{ - using PatternData = std::array<std::array<uint8, 3>, 64 * 4>; - - std::array<char, 20> title; - MODSampleHeader sampleHeaders[31]; - MODFileHeader fileHeader; - std::array<char, 4> magic; - PatternData firstPattern; - - struct ValidationResult - { - uint32 totalSampleSize = 0; - SAMPLEINDEX lastSample = 0; - uint8 numPatterns = 0; - }; - - ValidationResult IsValid() const noexcept - { - if(!IsMagic(magic.data(), "M.K.") && !IsMagic(magic.data(), "UNIC") && !IsMagic(magic.data(), "\0\0\0\0")) - return {}; - - if(CountInvalidChars(title)) - return {}; - - uint32 totalSampleSize = 0; - SAMPLEINDEX lastSample = 0; - for(SAMPLEINDEX smp = 1; smp <= 31; smp++) - { - const MODSampleHeader &sampleHeader = sampleHeaders[smp - 1]; - if(!ValidateUNICSampleHeader(sampleHeader)) - return {}; - totalSampleSize += sampleHeader.length * 2; - if(sampleHeader.length) - lastSample = smp; - } - if(totalSampleSize < 256) - return {}; - - if(!fileHeader.numOrders || fileHeader.numOrders >= 128) - return {}; - - uint8 numPatterns = 0; - for(uint8 pat = 0; pat < 128; pat++) - { - if(fileHeader.orderList[pat] >= 128 || (pat > fileHeader.numOrders + 1 && fileHeader.orderList[pat] != 0)) - return {}; - numPatterns = std::max(numPatterns, fileHeader.orderList[pat].get()); - } - numPatterns++; - - for(const auto data : firstPattern) - { - if(!ValidateUNICPatternEntry(data, lastSample)) - return {}; - } - - return {totalSampleSize, lastSample, numPatterns}; - } - -}; - -MPT_BINARY_STRUCT(UNICFileHeader, 1084 + 768) - - -CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderUNIC(MemoryFileReader file, const uint64 *pfilesize) -{ - UNICFileHeader fileHeader; - if(!file.ReadStruct(fileHeader)) - return ProbeWantMoreData; - - const auto headerValidationResult = fileHeader.IsValid(); - if(!headerValidationResult.totalSampleSize) - return ProbeFailure; - - if(pfilesize && *pfilesize < 1084 + headerValidationResult.numPatterns * 64u * 4u * 3u + headerValidationResult.totalSampleSize) - return ProbeFailure; - - return ProbeSuccess; -} - - -bool CSoundFile::ReadUNIC(FileReader &file, ModLoadingFlags loadFlags) -{ - UNICFileHeader fileHeader; - file.Rewind(); - if(!file.ReadStruct(fileHeader)) - return false; - - const auto headerValidationResult = fileHeader.IsValid(); - if(!headerValidationResult.totalSampleSize) - return false; - if(loadFlags == onlyVerifyHeader) - return true; - - InitializeGlobals(MOD_TYPE_MOD, 4); - - // Reading patterns (done first to avoid doing unnecessary work if this is a real ProTracker M.K. file) - file.Seek(1084); - if(!file.CanRead(headerValidationResult.numPatterns * 64u * 4u * 3u)) - return false; - if(loadFlags & loadPatternData) - Patterns.ResizeArray(headerValidationResult.numPatterns); - uint16 numNotes = 0; - ModCommand::INSTR allInstrs = 0; - for(PATTERNINDEX pat = 0; pat < headerValidationResult.numPatterns; pat++) - { - if(!(loadFlags & loadPatternData) || !Patterns.Insert(pat, 64)) - { - UNICFileHeader::PatternData pattern; - if(!file.ReadArray(pattern)) - return false; - - for(const auto data : pattern) - { - if(!ValidateUNICPatternEntry(data, headerValidationResult.lastSample)) - return false; - } - continue; - } - - for(ModCommand &m : Patterns[pat]) - { - const auto data = file.ReadArray<uint8, 3>(); - if(!ValidateUNICPatternEntry(data, headerValidationResult.lastSample)) - return false; - - if(data[0] & 0x3F) - { - m.note = NOTE_MIDDLEC - 13 + (data[0] & 0x3F); - numNotes++; - } - m.instr = ((data[0] >> 2) & 0x30) | ((data[1] >> 4) & 0x0F); - allInstrs |= m.instr; - ConvertModCommand(m, data[1] & 0x0F, data[2]); - } - } - if(numNotes < 16 || !allInstrs) - return false; - - // Reading samples - if(!file.CanRead(headerValidationResult.totalSampleSize)) - return false; - m_nSamples = 31; - for(SAMPLEINDEX smp = 1; smp <= 31; smp++) - { - const MODSampleHeader &sampleHeader = fileHeader.sampleHeaders[smp - 1]; - ModSample &mptSmp = Samples[smp]; - sampleHeader.ConvertToMPT(mptSmp, true); - int16be finetune; - memcpy(&finetune, &sampleHeader.name[20], sizeof(int16be)); - mptSmp.nFineTune = MOD2XMFineTune(-finetune); - // Metal Jumpover.unic (and various other files) has incorrect loop starts expressed as DWORDs - // But for the flute sample African Dreams.unic this fix doesn't seem to be quite right - if(mptSmp.uFlags[CHN_LOOP] && mptSmp.nLoopStart > 0 - && mptSmp.nLoopStart + mptSmp.nLoopEnd >= mptSmp.nLength - 2 - && mptSmp.nLoopStart + mptSmp.nLoopEnd <= mptSmp.nLength) - { - mptSmp.nLoopEnd += mptSmp.nLoopStart; - mptSmp.nLoopStart += mptSmp.nLoopStart; - } - - m_szNames[smp] = mpt::String::ReadBuf(mpt::String::spacePadded, sampleHeader.name, 20); - - if(!(loadFlags & loadSampleData)) - continue; - SampleIO( - SampleIO::_8bit, - SampleIO::mono, - SampleIO::littleEndian, - SampleIO::signedPCM).ReadSample(Samples[smp], file); - } - - SetupMODPanning(true); - Order().SetDefaultSpeed(6); - Order().SetDefaultTempoInt(125); - ReadOrderFromArray(Order(), fileHeader.fileHeader.orderList, headerValidationResult.numPatterns); - m_nMinPeriod = 113 * 4; - m_nMaxPeriod = 856 * 4; - m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED); - m_playBehaviour.reset(kMODOneShotLoops); - m_playBehaviour.set(kMODIgnorePanning); - m_playBehaviour.set(kMODSampleSwap); // untested - - m_songName = mpt::String::ReadBuf(mpt::String::spacePadded, fileHeader.title); - - m_modFormat.formatName = UL_("UNIC Tracker"); - m_modFormat.type = UL_("unic"); - m_modFormat.charset = mpt::Charset::Amiga_no_C1; - - return true; -} - -OPENMPT_NAMESPACE_END +/* + * Load_unic.cpp + * ------------- + * Purpose: UNIC Tracker v1 loader + * Notes : UNIC Tracker is actually a module packer, not a stand-alone tracker software. + * Support is mostly included to avoid such modules being recognized as regular M.K. MODs. + * UNIC files without file signature are not supported. + * Authors: OpenMPT Devs + * Based on ProWizard by Asle + * The OpenMPT source code is released under the BSD lUNICnse. Read LUNICNSE for more details. + */ + + +#include "stdafx.h" +#include "Loaders.h" +#include "MODTools.h" + +OPENMPT_NAMESPACE_BEGIN + + +static bool ValidateUNICSampleHeader(const MODSampleHeader &sampleHeader) +{ + if(CountInvalidChars(mpt::as_span(sampleHeader.name).subspan(0, 20))) + return false; + int16be finetune; + memcpy(&finetune, &sampleHeader.name[20], sizeof(int16be)); + if(finetune < -42 || finetune > 8) // African Dreams.unic has finetune = -42 + return false; + if(sampleHeader.finetune != 0 || sampleHeader.volume > 64) + return false; + if(sampleHeader.length >= 0x8000 || sampleHeader.loopStart >= 0x8000 || sampleHeader.loopLength >= 0x8000) + return false; + if(!sampleHeader.length && (sampleHeader.loopStart > 0 || sampleHeader.loopLength > 1 || finetune != 0)) + return false; + if(sampleHeader.length && sampleHeader.length < sampleHeader.loopStart + sampleHeader.loopLength) + return false; + return true; +} + + +static bool ValidateUNICPatternEntry(const std::array<uint8, 3> data, SAMPLEINDEX lastSample) +{ + if(data[0] > 0x74) + return false; + if((data[0] & 0x3F) > 0x24) + return false; + const uint8 command = (data[1] & 0x0F), param = data[2]; + if(command == 0x0C && param > 80) // Mastercoma.unic has values > 64 + return false; + if(command == 0x0B && param > 0x7F) + return false; + if(command == 0x0D && param > 0x40) + return false; + if(uint8 instr = ((data[0] >> 2) & 0x30) | ((data[1] >> 4) & 0x0F); instr > lastSample) + return false; + return true; +} + + +struct UNICFileHeader +{ + using PatternData = std::array<std::array<uint8, 3>, 64 * 4>; + + std::array<char, 20> title; + MODSampleHeader sampleHeaders[31]; + MODFileHeader fileHeader; + std::array<char, 4> magic; + PatternData firstPattern; + + struct ValidationResult + { + uint32 totalSampleSize = 0; + SAMPLEINDEX lastSample = 0; + uint8 numPatterns = 0; + }; + + ValidationResult IsValid() const noexcept + { + if(!IsMagic(magic.data(), "M.K.") && !IsMagic(magic.data(), "UNIC") && !IsMagic(magic.data(), "\0\0\0\0")) + return {}; + + if(CountInvalidChars(title)) + return {}; + + uint32 totalSampleSize = 0; + SAMPLEINDEX lastSample = 0; + for(SAMPLEINDEX smp = 1; smp <= 31; smp++) + { + const MODSampleHeader &sampleHeader = sampleHeaders[smp - 1]; + if(!ValidateUNICSampleHeader(sampleHeader)) + return {}; + totalSampleSize += sampleHeader.length * 2; + if(sampleHeader.length) + lastSample = smp; + } + if(totalSampleSize < 256) + return {}; + + if(!fileHeader.numOrders || fileHeader.numOrders >= 128) + return {}; + + uint8 numPatterns = 0; + for(uint8 pat = 0; pat < 128; pat++) + { + if(fileHeader.orderList[pat] >= 128 || (pat > fileHeader.numOrders + 1 && fileHeader.orderList[pat] != 0)) + return {}; + numPatterns = std::max(numPatterns, fileHeader.orderList[pat].get()); + } + numPatterns++; + + for(const auto data : firstPattern) + { + if(!ValidateUNICPatternEntry(data, lastSample)) + return {}; + } + + return {totalSampleSize, lastSample, numPatterns}; + } + +}; + +MPT_BINARY_STRUCT(UNICFileHeader, 1084 + 768) + + +CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderUNIC(MemoryFileReader file, const uint64 *pfilesize) +{ + UNICFileHeader fileHeader; + if(!file.ReadStruct(fileHeader)) + return ProbeWantMoreData; + + const auto headerValidationResult = fileHeader.IsValid(); + if(!headerValidationResult.totalSampleSize) + return ProbeFailure; + + if(pfilesize && *pfilesize < 1084 + headerValidationResult.numPatterns * 64u * 4u * 3u + headerValidationResult.totalSampleSize) + return ProbeFailure; + + return ProbeSuccess; +} + + +bool CSoundFile::ReadUNIC(FileReader &file, ModLoadingFlags loadFlags) +{ + UNICFileHeader fileHeader; + file.Rewind(); + if(!file.ReadStruct(fileHeader)) + return false; + + const auto headerValidationResult = fileHeader.IsValid(); + if(!headerValidationResult.totalSampleSize) + return false; + if(loadFlags == onlyVerifyHeader) + return true; + + InitializeGlobals(MOD_TYPE_MOD, 4); + + // Reading patterns (done first to avoid doing unnecessary work if this is a real ProTracker M.K. file) + file.Seek(1084); + if(!file.CanRead(headerValidationResult.numPatterns * 64u * 4u * 3u)) + return false; + if(loadFlags & loadPatternData) + Patterns.ResizeArray(headerValidationResult.numPatterns); + uint16 numNotes = 0; + ModCommand::INSTR allInstrs = 0; + for(PATTERNINDEX pat = 0; pat < headerValidationResult.numPatterns; pat++) + { + if(!(loadFlags & loadPatternData) || !Patterns.Insert(pat, 64)) + { + UNICFileHeader::PatternData pattern; + if(!file.ReadArray(pattern)) + return false; + + for(const auto data : pattern) + { + if(!ValidateUNICPatternEntry(data, headerValidationResult.lastSample)) + return false; + } + continue; + } + + for(ModCommand &m : Patterns[pat]) + { + const auto data = file.ReadArray<uint8, 3>(); + if(!ValidateUNICPatternEntry(data, headerValidationResult.lastSample)) + return false; + + if(data[0] & 0x3F) + { + m.note = NOTE_MIDDLEC - 13 + (data[0] & 0x3F); + numNotes++; + } + m.instr = ((data[0] >> 2) & 0x30) | ((data[1] >> 4) & 0x0F); + allInstrs |= m.instr; + ConvertModCommand(m, data[1] & 0x0F, data[2]); + } + } + if(numNotes < 16 || !allInstrs) + return false; + + // Reading samples + if(!file.CanRead(headerValidationResult.totalSampleSize)) + return false; + m_nSamples = 31; + for(SAMPLEINDEX smp = 1; smp <= 31; smp++) + { + const MODSampleHeader &sampleHeader = fileHeader.sampleHeaders[smp - 1]; + ModSample &mptSmp = Samples[smp]; + sampleHeader.ConvertToMPT(mptSmp, true); + int16be finetune; + memcpy(&finetune, &sampleHeader.name[20], sizeof(int16be)); + mptSmp.nFineTune = MOD2XMFineTune(-finetune); + // Metal Jumpover.unic (and various other files) has incorrect loop starts expressed as DWORDs + // But for the flute sample African Dreams.unic this fix doesn't seem to be quite right + if(mptSmp.uFlags[CHN_LOOP] && mptSmp.nLoopStart > 0 + && mptSmp.nLoopStart + mptSmp.nLoopEnd >= mptSmp.nLength - 2 + && mptSmp.nLoopStart + mptSmp.nLoopEnd <= mptSmp.nLength) + { + mptSmp.nLoopEnd += mptSmp.nLoopStart; + mptSmp.nLoopStart += mptSmp.nLoopStart; + } + + m_szNames[smp] = mpt::String::ReadBuf(mpt::String::spacePadded, sampleHeader.name, 20); + + if(!(loadFlags & loadSampleData)) + continue; + SampleIO( + SampleIO::_8bit, + SampleIO::mono, + SampleIO::littleEndian, + SampleIO::signedPCM).ReadSample(Samples[smp], file); + } + + SetupMODPanning(true); + Order().SetDefaultSpeed(6); + Order().SetDefaultTempoInt(125); + ReadOrderFromArray(Order(), fileHeader.fileHeader.orderList, headerValidationResult.numPatterns); + m_nMinPeriod = 113 * 4; + m_nMaxPeriod = 856 * 4; + m_nSamplePreAmp = 64; + m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED); + m_playBehaviour.reset(kMODOneShotLoops); + m_playBehaviour.set(kMODIgnorePanning); + m_playBehaviour.set(kMODSampleSwap); // untested + + m_songName = mpt::String::ReadBuf(mpt::String::spacePadded, fileHeader.title); + + m_modFormat.formatName = UL_("UNIC Tracker"); + m_modFormat.type = UL_("unic"); + m_modFormat.charset = mpt::Charset::Amiga_no_C1; + + return true; +} + +OPENMPT_NAMESPACE_END |
From: <sv...@op...> - 2024-09-24 13:41:20
|
Author: manx Date: Tue Sep 24 15:41:13 2024 New Revision: 21739 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21739 Log: [Ref] openmpt123: Silence warnings. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 15:10:29 2024 (r21738) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 15:41:13 2024 (r21739) @@ -157,7 +157,7 @@ private: std::unique_ptr<file_audio_stream_base> impl; public: - static void show_versions( concat_stream<mpt::ustring> & log ) { + static void show_versions([[maybe_unused]] concat_stream<mpt::ustring> & log ) { #ifdef MPT_WITH_FLAC log << MPT_USTRING(" FLAC ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VERSION_STRING ) << MPT_USTRING(", ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VENDOR_STRING ) << MPT_USTRING(", API ") << FLAC_API_VERSION_CURRENT << MPT_USTRING(".") << FLAC_API_VERSION_REVISION << MPT_USTRING(".") << FLAC_API_VERSION_AGE << MPT_USTRING(" <https://xiph.org/flac/>") << lf; #endif @@ -170,7 +170,7 @@ #endif } public: - file_audio_stream( const commandlineflags & flags, const mpt::native_path & filename, concat_stream<mpt::ustring> & log ) + file_audio_stream( const commandlineflags & flags, const mpt::native_path & filename, [[maybe_unused]] concat_stream<mpt::ustring> & log ) : impl(nullptr) { if ( !flags.force_overwrite ) { @@ -221,7 +221,7 @@ private: std::unique_ptr<write_buffers_interface> impl; public: - static void show_versions( concat_stream<mpt::ustring> & log ) { + static void show_versions( [[maybe_unused]] concat_stream<mpt::ustring> & log ) { #ifdef MPT_WITH_SDL2 log << MPT_USTRING(" libSDL2 "); SDL_version sdlver; @@ -264,7 +264,7 @@ drivers << MPT_USTRING(" allegro42") << lf; #endif } - static void show_devices( concat_stream<mpt::ustring> & devices, concat_stream<mpt::ustring> & log ) { + static void show_devices( concat_stream<mpt::ustring> & devices, [[maybe_unused]] concat_stream<mpt::ustring> & log ) { devices << MPT_USTRING(" Available devices:") << lf; devices << MPT_USTRING(" default: default") << lf; #if defined( MPT_WITH_PULSEAUDIO ) @@ -284,7 +284,7 @@ #endif } public: - realtime_audio_stream( commandlineflags & flags, concat_stream<mpt::ustring> & log ) + realtime_audio_stream( commandlineflags & flags, [[maybe_unused]] concat_stream<mpt::ustring> & log ) : impl(nullptr) { if constexpr ( false ) { |
From: <sv...@op...> - 2024-09-24 13:10:41
|
Author: manx Date: Tue Sep 24 15:10:29 2024 New Revision: 21738 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21738 Log: [Ref] openmpt123: Move knowledge about audio and file backends into wrapper class. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 13:56:02 2024 (r21737) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 15:10:29 2024 (r21738) @@ -153,11 +153,24 @@ constexpr auto libopenmpt_encoding = mpt::common_encoding::utf8; -class file_audio_stream_raii : public file_audio_stream_base { +class file_audio_stream : public file_audio_stream_base { private: std::unique_ptr<file_audio_stream_base> impl; public: - file_audio_stream_raii( const commandlineflags & flags, const mpt::native_path & filename, concat_stream<mpt::ustring> & log ) + static void show_versions( concat_stream<mpt::ustring> & log ) { +#ifdef MPT_WITH_FLAC + log << MPT_USTRING(" FLAC ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VERSION_STRING ) << MPT_USTRING(", ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VENDOR_STRING ) << MPT_USTRING(", API ") << FLAC_API_VERSION_CURRENT << MPT_USTRING(".") << FLAC_API_VERSION_REVISION << MPT_USTRING(".") << FLAC_API_VERSION_AGE << MPT_USTRING(" <https://xiph.org/flac/>") << lf; +#endif +#ifdef MPT_WITH_SNDFILE + char sndfile_info[128]; + std::memset( sndfile_info, 0, sizeof( sndfile_info ) ); + sf_command( 0, SFC_GET_LIB_VERSION, sndfile_info, sizeof( sndfile_info ) ); + sndfile_info[127] = '\0'; + log << MPT_USTRING(" libsndfile ") << mpt::transcode<mpt::ustring>( sndfile_encoding, sndfile_info ) << MPT_USTRING(" <http://mega-nerd.com/libsndfile/>") << lf; +#endif + } +public: + file_audio_stream( const commandlineflags & flags, const mpt::native_path & filename, concat_stream<mpt::ustring> & log ) : impl(nullptr) { if ( !flags.force_overwrite ) { @@ -173,11 +186,11 @@ #if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT } else if ( flags.output_extension == MPT_NATIVE_PATH("wav") ) { impl = std::make_unique<mmio_stream_raii>( filename, flags, log ); -#endif +#endif #ifdef MPT_WITH_FLAC } else if ( flags.output_extension == MPT_NATIVE_PATH("flac") ) { impl = std::make_unique<flac_stream_raii>( filename, flags, log ); -#endif +#endif #ifdef MPT_WITH_SNDFILE } else { impl = std::make_unique<sndfile_stream_raii>( filename, flags, log ); @@ -187,7 +200,7 @@ throw exception( MPT_USTRING("file format handler '") + mpt::transcode<mpt::ustring>( flags.output_extension ) + MPT_USTRING("' not found") ); } } - virtual ~file_audio_stream_raii() { + virtual ~file_audio_stream() { return; } void write_metadata( std::map<mpt::ustring, mpt::ustring> metadata ) override { @@ -204,11 +217,74 @@ } }; -class realtime_audio_stream_raii : public write_buffers_interface { +class realtime_audio_stream : public write_buffers_interface { private: std::unique_ptr<write_buffers_interface> impl; public: - realtime_audio_stream_raii( commandlineflags & flags, concat_stream<mpt::ustring> & log ) + static void show_versions( concat_stream<mpt::ustring> & log ) { +#ifdef MPT_WITH_SDL2 + log << MPT_USTRING(" libSDL2 "); + SDL_version sdlver; + std::memset( &sdlver, 0, sizeof( SDL_version ) ); + SDL_GetVersion( &sdlver ); + log << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); + const char * revision = SDL_GetRevision(); + if ( revision ) { + log << MPT_USTRING(" (") << mpt::transcode<mpt::ustring>( sdl2_encoding, revision ) << MPT_USTRING(")"); + } + log << MPT_USTRING(", "); + std::memset( &sdlver, 0, sizeof( SDL_version ) ); + SDL_VERSION( &sdlver ); + log << MPT_USTRING("API: ") << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); + log << MPT_USTRING(" <https://libsdl.org/>") << lf; +#endif +#ifdef MPT_WITH_PULSEAUDIO + log << MPT_USTRING(" ") << MPT_USTRING("libpulse, libpulse-simple") << MPT_USTRING(" (headers ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, pa_get_headers_version() ) << MPT_USTRING(", API ") << PA_API_VERSION << MPT_USTRING(", PROTOCOL ") << PA_PROTOCOL_VERSION << MPT_USTRING(", library ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, ( pa_get_library_version() ? pa_get_library_version() : "unknown" ) ) << MPT_USTRING(") <https://www.freedesktop.org/wiki/Software/PulseAudio/>") << lf; +#endif +#ifdef MPT_WITH_PORTAUDIO + log << MPT_USTRING(" ") << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetVersionText() ) << MPT_USTRING(" (") << Pa_GetVersion() << MPT_USTRING(") <http://portaudio.com/>") << lf; +#endif + } + static void show_drivers( concat_stream<mpt::ustring> & drivers ) { + drivers << MPT_USTRING(" Available drivers:") << lf; + drivers << MPT_USTRING(" default") << lf; +#if defined( MPT_WITH_PULSEAUDIO ) + drivers << MPT_USTRING(" pulseaudio") << lf; +#endif +#if defined( MPT_WITH_SDL2 ) + drivers << MPT_USTRING(" sdl2") << lf; +#endif +#if defined( MPT_WITH_PORTAUDIO ) + drivers << MPT_USTRING(" portaudio") << lf; +#endif +#if MPT_OS_WINDOWS + drivers << MPT_USTRING(" waveout") << lf; +#endif +#if defined( MPT_WITH_ALLEGRO42 ) + drivers << MPT_USTRING(" allegro42") << lf; +#endif + } + static void show_devices( concat_stream<mpt::ustring> & devices, concat_stream<mpt::ustring> & log ) { + devices << MPT_USTRING(" Available devices:") << lf; + devices << MPT_USTRING(" default: default") << lf; +#if defined( MPT_WITH_PULSEAUDIO ) + devices << show_pulseaudio_devices( log ); +#endif +#if defined( MPT_WITH_SDL2 ) + devices << show_sdl2_devices( log ); +#endif +#if defined( MPT_WITH_PORTAUDIO ) + devices << show_portaudio_devices( log ); +#endif +#if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT + devices << show_waveout_devices( log ); +#endif +#if defined( MPT_WITH_ALLEGRO42 ) + devices << show_allegro42_devices( log ); +#endif + } +public: + realtime_audio_stream( commandlineflags & flags, concat_stream<mpt::ustring> & log ) : impl(nullptr) { if constexpr ( false ) { @@ -239,7 +315,7 @@ throw exception( MPT_USTRING("audio driver '") + flags.driver + MPT_USTRING("' not found") ); } } - virtual ~realtime_audio_stream_raii() { + virtual ~realtime_audio_stream() { return; } void write_metadata( std::map<mpt::ustring, mpt::ustring> metadata ) override { @@ -438,38 +514,8 @@ log << lf; log << MPT_USTRING(" libopenmpt compiler: ") << mpt::transcode<mpt::ustring>( libopenmpt_encoding, openmpt::string::get( "build_compiler" ) ) << lf; log << MPT_USTRING(" libopenmpt features: ") << mpt::transcode<mpt::ustring>( libopenmpt_encoding, openmpt::string::get( "library_features" ) ) << lf; -#ifdef MPT_WITH_SDL2 - log << MPT_USTRING(" libSDL2 "); - SDL_version sdlver; - std::memset( &sdlver, 0, sizeof( SDL_version ) ); - SDL_GetVersion( &sdlver ); - log << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); - const char * revision = SDL_GetRevision(); - if ( revision ) { - log << MPT_USTRING(" (") << mpt::transcode<mpt::ustring>( sdl2_encoding, revision ) << MPT_USTRING(")"); - } - log << MPT_USTRING(", "); - std::memset( &sdlver, 0, sizeof( SDL_version ) ); - SDL_VERSION( &sdlver ); - log << MPT_USTRING("API: ") << static_cast<int>( sdlver.major ) << MPT_USTRING(".") << static_cast<int>( sdlver.minor ) << MPT_USTRING(".") << static_cast<int>( sdlver.patch ); - log << MPT_USTRING(" <https://libsdl.org/>") << lf; -#endif -#ifdef MPT_WITH_PULSEAUDIO - log << MPT_USTRING(" ") << MPT_USTRING("libpulse, libpulse-simple") << MPT_USTRING(" (headers ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, pa_get_headers_version() ) << MPT_USTRING(", API ") << PA_API_VERSION << MPT_USTRING(", PROTOCOL ") << PA_PROTOCOL_VERSION << MPT_USTRING(", library ") << mpt::transcode<mpt::ustring>( pulseaudio_encoding, ( pa_get_library_version() ? pa_get_library_version() : "unknown" ) ) << MPT_USTRING(") <https://www.freedesktop.org/wiki/Software/PulseAudio/>") << lf; -#endif -#ifdef MPT_WITH_PORTAUDIO - log << MPT_USTRING(" ") << mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetVersionText() ) << MPT_USTRING(" (") << Pa_GetVersion() << MPT_USTRING(") <http://portaudio.com/>") << lf; -#endif -#ifdef MPT_WITH_FLAC - log << MPT_USTRING(" FLAC ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VERSION_STRING ) << MPT_USTRING(", ") << mpt::transcode<mpt::ustring>( mpt::source_encoding, FLAC__VENDOR_STRING ) << MPT_USTRING(", API ") << FLAC_API_VERSION_CURRENT << MPT_USTRING(".") << FLAC_API_VERSION_REVISION << MPT_USTRING(".") << FLAC_API_VERSION_AGE << MPT_USTRING(" <https://xiph.org/flac/>") << lf; -#endif -#ifdef MPT_WITH_SNDFILE - char sndfile_info[128]; - std::memset( sndfile_info, 0, sizeof( sndfile_info ) ); - sf_command( 0, SFC_GET_LIB_VERSION, sndfile_info, sizeof( sndfile_info ) ); - sndfile_info[127] = '\0'; - log << MPT_USTRING(" libsndfile ") << mpt::transcode<mpt::ustring>( sndfile_encoding, sndfile_info ) << MPT_USTRING(" <http://mega-nerd.com/libsndfile/>") << lf; -#endif + realtime_audio_stream::show_versions( log ); + file_audio_stream::show_versions( log ); log << lf; } @@ -1955,23 +2001,7 @@ // nothing } else if ( nextarg == MPT_USTRING("help") ) { string_concat_stream<mpt::ustring> drivers; - drivers << MPT_USTRING(" Available drivers:") << lf; - drivers << MPT_USTRING(" default") << lf; -#if defined( MPT_WITH_PULSEAUDIO ) - drivers << MPT_USTRING(" pulseaudio") << lf; -#endif -#if defined( MPT_WITH_SDL2 ) - drivers << MPT_USTRING(" sdl2") << lf; -#endif -#if defined( MPT_WITH_PORTAUDIO ) - drivers << MPT_USTRING(" portaudio") << lf; -#endif -#if MPT_OS_WINDOWS - drivers << MPT_USTRING(" waveout") << lf; -#endif -#if defined( MPT_WITH_ALLEGRO42 ) - drivers << MPT_USTRING(" allegro42") << lf; -#endif + realtime_audio_stream::show_drivers( drivers ); throw show_help_exception( drivers.str() ); } else if ( nextarg == MPT_USTRING("default") ) { flags.driver = MPT_USTRING(""); @@ -1984,23 +2014,7 @@ // nothing } else if ( nextarg == MPT_USTRING("help") ) { string_concat_stream<mpt::ustring> devices; - devices << MPT_USTRING(" Available devices:") << lf; - devices << MPT_USTRING(" default: default") << lf; -#if defined( MPT_WITH_PULSEAUDIO ) - devices << show_pulseaudio_devices(log); -#endif -#if defined( MPT_WITH_SDL2 ) - devices << show_sdl2_devices( log ); -#endif -#if defined( MPT_WITH_PORTAUDIO ) - devices << show_portaudio_devices( log ); -#endif -#if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT - devices << show_waveout_devices( log ); -#endif -#if defined( MPT_WITH_ALLEGRO42 ) - devices << show_allegro42_devices( log ); -#endif + realtime_audio_stream::show_devices( devices, log ); throw show_help_exception( devices.str() ); } else if ( nextarg == MPT_USTRING("default") ) { flags.device = MPT_USTRING(""); @@ -2379,17 +2393,17 @@ render_files( flags, log, stdout_audio_stream, prng ); } else if ( !flags.output_filename.empty() ) { flags.apply_default_buffer_sizes(); - file_audio_stream_raii file_audio_stream( flags, flags.output_filename, log ); + file_audio_stream file_audio_stream( flags, flags.output_filename, log ); render_files( flags, log, file_audio_stream, prng ); } else { - realtime_audio_stream_raii audio_stream( flags, log ); + realtime_audio_stream audio_stream( flags, log ); render_files( flags, log, audio_stream, prng ); } } break; case Mode::Render: { for ( const auto & filename : flags.filenames ) { flags.apply_default_buffer_sizes(); - file_audio_stream_raii file_audio_stream( flags, filename + MPT_NATIVE_PATH(".") + flags.output_extension, log ); + file_audio_stream file_audio_stream( flags, filename + MPT_NATIVE_PATH(".") + flags.output_extension, log ); render_file( flags, filename, log, file_audio_stream ); flags.playlist_index++; } |
From: <sv...@op...> - 2024-09-24 11:56:14
|
Author: manx Date: Tue Sep 24 13:56:02 2024 New Revision: 21737 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21737 Log: [Ref] openmpt123: Silence warning. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 12:53:46 2024 (r21736) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 13:56:02 2024 (r21737) @@ -227,7 +227,7 @@ #endif #if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT } else if ( flags.driver == MPT_USTRING("waveout") || flags.driver.empty() ) { - impl = std::make_unique<waveout_stream_raii>( flags ); + impl = std::make_unique<waveout_stream_raii>( flags, log ); #endif #if defined( MPT_WITH_ALLEGRO42 ) } else if ( flags.driver == MPT_USTRING("allegro42") || flags.driver.empty() ) { Modified: trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Tue Sep 24 12:53:46 2024 (r21736) +++ trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Tue Sep 24 13:56:02 2024 (r21737) @@ -34,7 +34,7 @@ std::vector<std::vector<char> > wavebuffers; std::deque<char> byte_queue; public: - waveout_stream_raii( commandlineflags & flags ) + waveout_stream_raii( commandlineflags & flags, concat_stream<mpt::ustring> & /* log */ ) : waveout(NULL) , num_channels(0) , num_chunks(0) |
From: <sv...@op...> - 2024-09-24 10:53:58
|
Author: manx Date: Tue Sep 24 12:53:46 2024 New Revision: 21736 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21736 Log: [Ref] openmpt123: Wrap audio backends in a separate realtime_audio_stream_raii class, similar to file backends. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 10:07:46 2024 (r21735) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 12:53:46 2024 (r21736) @@ -202,7 +202,68 @@ void write( const std::vector<std::int16_t*> buffers, std::size_t frames ) override { impl->write( buffers, frames ); } -}; +}; + +class realtime_audio_stream_raii : public write_buffers_interface { +private: + std::unique_ptr<write_buffers_interface> impl; +public: + realtime_audio_stream_raii( commandlineflags & flags, concat_stream<mpt::ustring> & log ) + : impl(nullptr) + { + if constexpr ( false ) { + // nothing +#if defined( MPT_WITH_PULSEAUDIO ) + } else if ( flags.driver == MPT_USTRING("pulseaudio") || flags.driver.empty() ) { + impl = std::make_unique<pulseaudio_stream_raii>( flags, log ); +#endif +#if defined( MPT_WITH_SDL2 ) + } else if ( flags.driver == MPT_USTRING("sdl2") || flags.driver.empty() ) { + impl = std::make_unique<sdl2_stream_raii>( flags, log ); +#endif +#if defined( MPT_WITH_PORTAUDIO ) + } else if ( flags.driver == MPT_USTRING("portaudio") || flags.driver.empty() ) { + impl = std::make_unique<portaudio_stream_raii>( flags, log ); +#endif +#if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT + } else if ( flags.driver == MPT_USTRING("waveout") || flags.driver.empty() ) { + impl = std::make_unique<waveout_stream_raii>( flags ); +#endif +#if defined( MPT_WITH_ALLEGRO42 ) + } else if ( flags.driver == MPT_USTRING("allegro42") || flags.driver.empty() ) { + impl = std::make_unique<allegro42_stream_raii>( flags, log ); +#endif + } else if ( flags.driver.empty() ) { + throw exception(MPT_USTRING("openmpt123 is compiled without any audio driver")); + } else { + throw exception( MPT_USTRING("audio driver '") + flags.driver + MPT_USTRING("' not found") ); + } + } + virtual ~realtime_audio_stream_raii() { + return; + } + void write_metadata( std::map<mpt::ustring, mpt::ustring> metadata ) override { + impl->write_metadata( metadata ); + } + void write_updated_metadata( std::map<mpt::ustring, mpt::ustring> metadata ) override { + impl->write_updated_metadata( metadata ); + } + void write( const std::vector<float*> buffers, std::size_t frames ) override { + impl->write( buffers, frames ); + } + void write( const std::vector<std::int16_t*> buffers, std::size_t frames ) override { + impl->write( buffers, frames ); + } + bool unpause() override { + return impl->unpause(); + } + bool sleep( int ms ) override { + return impl->sleep( ms ); + } + bool is_dummy() const override { + return impl->is_dummy(); + } +}; static mpt::ustring ctls_to_string( const std::map<std::string, std::string> & ctls ) { mpt::ustring result; @@ -2320,37 +2381,9 @@ flags.apply_default_buffer_sizes(); file_audio_stream_raii file_audio_stream( flags, flags.output_filename, log ); render_files( flags, log, file_audio_stream, prng ); -#if defined( MPT_WITH_PULSEAUDIO ) - } else if ( flags.driver == MPT_USTRING("pulseaudio") || flags.driver.empty() ) { - pulseaudio_stream_raii pulseaudio_stream( flags, log ); - render_files( flags, log, pulseaudio_stream, prng ); -#endif -#if defined( MPT_WITH_SDL2 ) - } else if ( flags.driver == MPT_USTRING("sdl2") || flags.driver.empty() ) { - sdl2_stream_raii sdl2_stream( flags, log ); - render_files( flags, log, sdl2_stream, prng ); -#endif -#if defined( MPT_WITH_PORTAUDIO ) - } else if ( flags.driver == MPT_USTRING("portaudio") || flags.driver.empty() ) { - portaudio_stream_raii portaudio_stream( flags, log ); - render_files( flags, log, portaudio_stream, prng ); -#endif -#if MPT_OS_WINDOWS && !MPT_OS_WINDOWS_WINRT - } else if ( flags.driver == MPT_USTRING("waveout") || flags.driver.empty() ) { - waveout_stream_raii waveout_stream( flags ); - render_files( flags, log, waveout_stream, prng ); -#endif -#if defined( MPT_WITH_ALLEGRO42 ) - } else if ( flags.driver == MPT_USTRING("allegro42") || flags.driver.empty() ) { - allegro42_stream_raii allegro42_stream( flags, log ); - render_files( flags, log, allegro42_stream, prng ); -#endif } else { - if ( flags.driver.empty() ) { - throw exception( MPT_USTRING("openmpt123 is compiled without any audio driver") ); - } else { - throw exception( MPT_USTRING("audio driver '") + flags.driver + MPT_USTRING("' not found") ); - } + realtime_audio_stream_raii audio_stream( flags, log ); + render_files( flags, log, audio_stream, prng ); } } break; case Mode::Render: { Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 10:07:46 2024 (r21735) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 12:53:46 2024 (r21736) @@ -725,11 +725,10 @@ } class write_buffers_interface { -protected: +public: virtual ~write_buffers_interface() { return; } -public: virtual void write_metadata( std::map<mpt::ustring, mpt::ustring> metadata ) { (void)metadata; return; |
Author: manx Date: Tue Sep 24 10:07:46 2024 New Revision: 21735 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21735 Log: [Ref] libopenmpt-test: Use mpt/main. Modified: trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj.filters trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_test/libopenmpt_test.cpp Modified: trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua ============================================================================== --- trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/premake/mpt-libopenmpt_test.lua Tue Sep 24 10:07:46 2024 (r21735) @@ -78,8 +78,6 @@ "../../src/mpt/json/**.hpp", "../../src/mpt/library/**.cpp", "../../src/mpt/library/**.hpp", - "../../src/mpt/main/**.cpp", - "../../src/mpt/main/**.hpp", "../../src/mpt/uuid_namespace/**.cpp", "../../src/mpt/uuid_namespace/**.hpp", "../../test/mpt_tests_crypto.cpp", Modified: trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -920,6 +920,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2017winxp/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -100,6 +100,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -924,6 +927,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -920,6 +920,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2017winxpansi/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -100,6 +100,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -924,6 +927,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -917,6 +917,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2019win7/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -1635,6 +1635,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win10/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -1553,6 +1553,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win10clang/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -937,6 +937,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win7/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -1277,6 +1277,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win8/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj ============================================================================== --- trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj Tue Sep 24 10:07:46 2024 (r21735) @@ -1277,6 +1277,7 @@ <ClInclude Include="..\..\src\mpt\io_read\filedata_stdstream.hpp" /> <ClInclude Include="..\..\src\mpt\io_read\filereader.hpp" /> <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp" /> + <ClInclude Include="..\..\src\mpt\main\main.hpp" /> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\class.hpp" /> <ClInclude Include="..\..\src\mpt\osinfo\dos_memory.hpp" /> Modified: trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj.filters ============================================================================== --- trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj.filters Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/build/vs2022win81/libopenmpt_test.vcxproj.filters Tue Sep 24 10:07:46 2024 (r21735) @@ -106,6 +106,9 @@ <Filter Include="src\mpt\io_write"> <UniqueIdentifier>{BE6C5801-AA65-7753-D397-5CD8BFEF565F}</UniqueIdentifier> </Filter> + <Filter Include="src\mpt\main"> + <UniqueIdentifier>{C1DDD503-AD40-65A8-56C6-9D5E4208312B}</UniqueIdentifier> + </Filter> <Filter Include="src\mpt\mutex"> <UniqueIdentifier>{8FBB9C7E-FB7B-18B5-C4B6-613230365D91}</UniqueIdentifier> </Filter> @@ -930,6 +933,9 @@ <ClInclude Include="..\..\src\mpt\io_write\buffer.hpp"> <Filter>src\mpt\io_write</Filter> </ClInclude> + <ClInclude Include="..\..\src\mpt\main\main.hpp"> + <Filter>src\mpt\main</Filter> + </ClInclude> <ClInclude Include="..\..\src\mpt\mutex\mutex.hpp"> <Filter>src\mpt\mutex</Filter> </ClInclude> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_test/libopenmpt_test.cpp ============================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_test/libopenmpt_test.cpp Tue Sep 24 10:05:10 2024 (r21734) +++ trunk/OpenMPT/libopenmpt/libopenmpt_test/libopenmpt_test.cpp Tue Sep 24 10:07:46 2024 (r21735) @@ -8,12 +8,10 @@ */ #include "openmpt/all/BuildSettings.hpp" +#include "openmpt/all/PlatformFixes.hpp" -#include "mpt/base/macros.hpp" - -#if defined(__MINGW32__) && !defined(__MINGW64__) -#include <sys/types.h> -#endif +#include "mpt/base/integer.hpp" +#include "mpt/main/main.hpp" #include "../../libopenmpt/libopenmpt_internal.h" @@ -25,41 +23,14 @@ #include <clocale> #include <cstdlib> -#if defined( __DJGPP__ ) -#include <crt0.h> -#endif /* __DJGPP__ */ - #if defined(__EMSCRIPTEN__) #include <emscripten.h> #endif /* __EMSCRIPTEN__ */ -using namespace OpenMPT; +namespace libopenmpt_test { + +static mpt::uint8 main() { -#if defined( __DJGPP__ ) -/* Work-around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977> */ -/* clang-format off */ -extern "C" { - int _crt0_startup_flags = 0 - | _CRT0_FLAG_NONMOVE_SBRK /* force interrupt compatible allocation */ - | _CRT0_DISABLE_SBRK_ADDRESS_WRAP /* force NT compatible allocation */ - | _CRT0_FLAG_LOCK_MEMORY /* lock all code and data at program startup */ - | 0; -} -/* clang-format on */ -#endif /* __DJGPP__ */ -#if (defined(_WIN32) || defined(WIN32)) && (defined(_UNICODE) || defined(UNICODE)) -#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER)) -// mingw-w64 g++ does only default to special C linkage for "main", but not for "wmain" (see <https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/>). -extern "C" int wmain( int /*argc*/ , wchar_t * /*argv*/ [] ); -extern "C" -#endif -int wmain( int /*argc*/ , wchar_t * /*argv*/ [] ) { -#else -int main( int /*argc*/ , char * /*argv*/ [] ) { -#endif -#if defined( __DJGPP__ ) - _crt0_startup_flags &= ~_CRT0_FLAG_LOCK_MEMORY; /* disable automatic locking for all further memory allocations */ -#endif /* __DJGPP__ */ #if defined(__EMSCRIPTEN__) EM_ASM( FS.mkdir('/test'); @@ -70,7 +41,9 @@ #endif /* __EMSCRIPTEN__ */ try { - + + using namespace OpenMPT; + // run test with "C" / classic() locale Test::DoTests(); @@ -83,7 +56,7 @@ // try to set the C and C++ locales to the user locale try { std::locale old = std::locale::global( std::locale( "" ) ); - (void)old; + static_cast<void>( old ); } catch ( ... ) { // Setting c++ global locale does not work. // This is no problem for libopenmpt, just continue. @@ -94,10 +67,14 @@ } catch ( const std::exception & e ) { std::cerr << "TEST ERROR: exception: " << ( e.what() ? e.what() : "" ) << std::endl; - return -1; + return 255; } catch ( ... ) { std::cerr << "TEST ERROR: unknown exception" << std::endl; - return -1; + return 255; } return 0; } + +} // namespace libopenmpt_test + +MPT_MAIN_IMPLEMENT_MAIN_NO_ARGS(libopenmpt_test) |
From: <sv...@op...> - 2024-09-24 08:05:22
|
Author: manx Date: Tue Sep 24 10:05:10 2024 New Revision: 21734 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21734 Log: [Fix] mpt/main/main.hpp: Fix syntax in MPT_MAIN_IMPLEMENT_MAIN_NO_ARGS(). Modified: trunk/OpenMPT/src/mpt/main/main.hpp Modified: trunk/OpenMPT/src/mpt/main/main.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/main/main.hpp Tue Sep 24 09:51:35 2024 (r21733) +++ trunk/OpenMPT/src/mpt/main/main.hpp Tue Sep 24 10:05:10 2024 (r21734) @@ -176,7 +176,7 @@ MPT_MAIN_DECL \ MPT_MAIN_DEF_PREFIX int MPT_MAIN_NAME(int argc, MPT_MAIN_ARGV_TYPE * argv[]) { \ MPT_MAIN_PROLOG(); \ - static_assert(std::is_same<decltype(ns::main), mpt::uint8(void); \ + static_assert(std::is_same<decltype(ns::main), mpt::uint8(void)>::value); \ MPT_UNUSED(argc); \ MPT_UNUSED(argv); \ return static_cast<int>(ns::main()); \ |
From: <sv...@op...> - 2024-09-24 07:51:42
|
Author: manx Date: Tue Sep 24 09:51:35 2024 New Revision: 21733 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21733 Log: [Fix] openmpt123: Set stdin to text mode only after parsing commandline and verifying that we are not supposed to take binary data from stdin. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 09:30:00 2024 (r21732) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 09:51:35 2024 (r21733) @@ -2184,7 +2184,6 @@ static mpt::uint8 main( std::vector<mpt::ustring> args ) { - FILE_mode_guard stdin_text_guard( stdin, FILE_mode::text ); FILE_mode_guard stdout_text_guard( stdout, FILE_mode::text ); FILE_mode_guard stderr_text_guard( stderr, FILE_mode::text ); @@ -2276,7 +2275,8 @@ [[maybe_unused]] std::optional<FILE_mode_guard> stdin_guard{ stdin_data ? std::make_optional<FILE_mode_guard>( stdin, FILE_mode::binary ) : std::nullopt }; [[maybe_unused]] std::optional<FILE_mode_guard> stdout_guard{ stdout_data ? std::make_optional<FILE_mode_guard>( stdout, FILE_mode::binary ) : std::nullopt }; - // setup terminal + // setup terminal input + [[maybe_unused]] std::optional<FILE_mode_guard> stdin_text_guard{ stdin_text ? std::make_optional<FILE_mode_guard>( stdin, FILE_mode::text ) : std::nullopt }; [[maybe_unused]] std::optional<terminal_ui_guard> input_guard{ stdin_text && ( flags.mode == Mode::UI ) ? std::make_optional<terminal_ui_guard>() : std::nullopt }; // choose text output between quiet/stdout/stderr |
From: <sv...@op...> - 2024-09-24 07:30:12
|
Author: manx Date: Tue Sep 24 09:30:00 2024 New Revision: 21732 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21732 Log: [Ref] openmpt123: Simplify commandlineflags. [Mod] openmpt123: Move querying terminal size after parsing commandline. This changes the displayed default for terminal size to be -1. Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 09:25:43 2024 (r21731) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 09:30:00 2024 (r21732) @@ -605,7 +605,7 @@ terminal_height = 25; } #else - if (terminal_width <= 0) { + if ( terminal_width <= 0 ) { terminal_width = 72; } if ( terminal_height <= 0 ) { |
From: <sv...@op...> - 2024-09-24 07:25:50
|
Author: manx Date: Tue Sep 24 09:25:43 2024 New Revision: 21731 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21731 Log: [Ref] openmpt123: Simplify commandlineflags. [Mod] openmpt123: Move querying terminal size after parsing commandline. This changes the displayed default for terminal size to be -1. Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 09:18:12 2024 (r21730) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp Tue Sep 24 09:25:43 2024 (r21731) @@ -463,51 +463,53 @@ }; struct commandlineflags { - Mode mode; - std::int32_t ui_redraw_interval; - mpt::ustring driver; - mpt::ustring device; - std::int32_t buffer; - std::int32_t period; - std::int32_t samplerate; - std::int32_t channels; - std::int32_t gain; - std::int32_t separation; - std::int32_t filtertaps; - std::int32_t ramping; // ramping strength : -1:default 0:off 1 2 3 4 5 // roughly milliseconds - std::int32_t tempo; - std::int32_t pitch; - std::int32_t dither; - std::int32_t repeatcount; - std::int32_t subsong; - std::map<std::string, std::string> ctls; - double seek_target; - double end_time; - bool quiet; - verbosity banner; - bool verbose; - bool assume_terminal; - int terminal_width; - int terminal_height; - bool show_details; - bool show_message; - bool show_ui; - bool show_progress; - bool show_meters; - bool show_channel_meters; - bool show_pattern; - bool use_float; - bool use_stdout; - bool randomize; - bool shuffle; - bool restart; - std::size_t playlist_index; - std::vector<mpt::native_path> filenames; - mpt::native_path output_filename; - mpt::native_path output_extension; - bool force_overwrite; - bool paused; - mpt::ustring warnings; + + Mode mode = Mode::UI; + std::int32_t ui_redraw_interval = default_high; + mpt::ustring driver = MPT_USTRING(""); + mpt::ustring device = MPT_USTRING(""); + std::int32_t buffer = default_high; + std::int32_t period = default_high; + std::int32_t samplerate = MPT_OS_DJGPP ? 44100 : 48000; + std::int32_t channels = 2; + std::int32_t gain = 0; + std::int32_t separation = 100; + std::int32_t filtertaps = 8; + std::int32_t ramping = -1; // ramping strength : -1:default 0:off 1 2 3 4 5 // roughly milliseconds + std::int32_t tempo = 0; + std::int32_t pitch = 0; + std::int32_t dither = 1; + std::int32_t repeatcount = 0; + std::int32_t subsong = -1; + std::map<std::string, std::string> ctls = {}; + double seek_target = 0.0; + double end_time = 0.0; + bool quiet = false; + verbosity banner = verbosity_normal; + bool verbose = false; + bool assume_terminal = false; + int terminal_width = -1; + int terminal_height = -1; + bool show_details = true; + bool show_message = false; + bool show_ui = true; + bool show_progress = true; + bool show_meters = true; + bool show_channel_meters = false; + bool show_pattern = false; + bool use_float = MPT_OS_DJGPP ? false : mpt::float_traits<float>::is_hard && mpt::float_traits<float>::is_ieee754_binary; + bool use_stdout = false; + bool randomize = false; + bool shuffle = false; + bool restart = false; + std::size_t playlist_index = 0; + std::vector<mpt::native_path> filenames = {}; + mpt::native_path output_filename = MPT_NATIVE_PATH(""); + mpt::native_path output_extension = MPT_NATIVE_PATH("auto"); + bool force_overwrite = false; + bool paused = false; + mpt::ustring warnings = MPT_USTRING(""); + void apply_default_buffer_sizes() { if ( ui_redraw_interval == default_high ) { ui_redraw_interval = 50; @@ -525,115 +527,91 @@ period = 10; } } - commandlineflags() { - mode = Mode::UI; - ui_redraw_interval = default_high; - driver = MPT_USTRING(""); - device = MPT_USTRING(""); - buffer = default_high; - period = default_high; -#if MPT_OS_DJGPP - samplerate = 44100; - channels = 2; - use_float = false; -#else - samplerate = 48000; - channels = 2; - use_float = mpt::float_traits<float>::is_hard && mpt::float_traits<float>::is_ieee754_binary; -#endif - gain = 0; - separation = 100; - filtertaps = 8; - ramping = -1; - tempo = 0; - pitch = 0; - dither = 1; - repeatcount = 0; - subsong = -1; - seek_target = 0.0; - end_time = 0.0; - quiet = false; - banner = verbosity_normal; - verbose = false; - assume_terminal = false; -#if MPT_OS_DJGPP - terminal_width = 80; - terminal_height = 25; -#else - terminal_width = 72; - terminal_height = 23; -#endif + + void check_and_sanitize() { + bool canUI = true; + bool canProgress = true; + if ( !assume_terminal ) { +#if MPT_OS_WINDOWS + canUI = IsTerminal( 0 ) ? true : false; + canProgress = IsTerminal( 2 ) ? true : false; +#else // !MPT_OS_WINDOWS + canUI = isatty( STDIN_FILENO ) ? true : false; + canProgress = isatty( STDERR_FILENO ) ? true : false; +#endif // MPT_OS_WINDOWS + } #if MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) - terminal_width = 72; - terminal_height = 23; HANDLE hStdOutput = GetStdHandle( STD_OUTPUT_HANDLE ); if ( ( hStdOutput != NULL ) && ( hStdOutput != INVALID_HANDLE_VALUE ) ) { CONSOLE_SCREEN_BUFFER_INFO csbi; ZeroMemory( &csbi, sizeof( CONSOLE_SCREEN_BUFFER_INFO ) ); if ( GetConsoleScreenBufferInfo( hStdOutput, &csbi ) != FALSE ) { - terminal_width = std::min( static_cast<int>( 1 + csbi.srWindow.Right - csbi.srWindow.Left ), static_cast<int>( csbi.dwSize.X ) ); - terminal_height = std::min( static_cast<int>( 1 + csbi.srWindow.Bottom - csbi.srWindow.Top ), static_cast<int>( csbi.dwSize.Y ) ); + if ( terminal_width <= 0 ) { + terminal_width = std::min( static_cast<int>( 1 + csbi.srWindow.Right - csbi.srWindow.Left ), static_cast<int>( csbi.dwSize.X ) ); + } + if ( terminal_height <= 0 ) { + terminal_height = std::min( static_cast<int>( 1 + csbi.srWindow.Bottom - csbi.srWindow.Top ), static_cast<int>( csbi.dwSize.Y ) ); + } } } #else // !(MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10)) if ( isatty( STDERR_FILENO ) ) { - const char * env_columns = std::getenv( "COLUMNS" ); - if ( env_columns ) { - int tmp = mpt::parse_or<int>( env_columns, 0 ); - if ( tmp > 0 ) { - terminal_width = tmp; + if ( terminal_width <= 0 ) { + const char * env_columns = std::getenv( "COLUMNS" ); + if ( env_columns ) { + int tmp = mpt::parse_or<int>( env_columns, 0 ); + if ( tmp > 0 ) { + terminal_width = tmp; + } } } - const char * env_rows = std::getenv( "ROWS" ); - if ( env_rows ) { - int tmp = mpt::parse_or<int>( env_rows, 0 ); - if ( tmp > 0 ) { - terminal_height = tmp; + if ( terminal_height <= 0 ) { + const char * env_rows = std::getenv( "ROWS" ); + if ( env_rows ) { + int tmp = mpt::parse_or<int>( env_rows, 0 ); + if ( tmp > 0 ) { + terminal_height = tmp; + } } } #if defined(TIOCGWINSZ) struct winsize ts; if ( ioctl( STDERR_FILENO, TIOCGWINSZ, &ts ) >= 0 ) { - terminal_width = ts.ws_col; - terminal_height = ts.ws_row; + if ( terminal_width <= 0 ) { + terminal_width = ts.ws_col; + } + if ( terminal_height <= 0 ) { + terminal_height = ts.ws_row; + } } #elif defined(TIOCGSIZE) struct ttysize ts; if ( ioctl( STDERR_FILENO, TIOCGSIZE, &ts ) >= 0 ) { - terminal_width = ts.ts_cols; - terminal_height = ts.ts_rows; + if ( terminal_width <= 0 ) { + terminal_width = ts.ts_cols; + } + if ( terminal_height <= 0 ) { + terminal_height = ts.ts_rows; + } } #endif } #endif // MPT_OS_WINDOWS && !MPT_WINRT_BEFORE(MPT_WIN_10) - show_details = true; - show_message = false; - show_ui = true; - show_progress = true; - show_meters = true; - show_channel_meters = false; - show_pattern = false; - use_stdout = false; - randomize = false; - shuffle = false; - restart = false; - playlist_index = 0; - output_extension = MPT_NATIVE_PATH("auto"); - force_overwrite = false; - paused = false; - } - void check_and_sanitize() { - bool canUI = true; - bool canProgress = true; - if ( !assume_terminal ) { -#if MPT_OS_WINDOWS - canUI = IsTerminal( 0 ) ? true : false; - canProgress = IsTerminal( 2 ) ? true : false; -#else // !MPT_OS_WINDOWS - canUI = isatty( STDIN_FILENO ) ? true : false; - canProgress = isatty( STDERR_FILENO ) ? true : false; -#endif // MPT_OS_WINDOWS +#if MPT_OS_DJGPP + if ( terminal_width <= 0 ) { + terminal_width = 80; + } + if ( terminal_height <= 0 ) { + terminal_height = 25; } +#else + if (terminal_width <= 0) { + terminal_width = 72; + } + if ( terminal_height <= 0 ) { + terminal_height = 23; + } +#endif if ( filenames.size() == 0 ) { throw args_nofiles_exception(); } @@ -732,6 +710,7 @@ output_extension = MPT_NATIVE_PATH("wav"); } } + }; template < typename Tsample > Tsample convert_sample_to( float val ); |
From: <sv...@op...> - 2024-09-24 07:18:24
|
Author: manx Date: Tue Sep 24 09:18:12 2024 New Revision: 21730 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21730 Log: [Ref] openmpt123: Small cleanup. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 23:12:59 2024 (r21729) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Tue Sep 24 09:18:12 2024 (r21730) @@ -2188,7 +2188,6 @@ FILE_mode_guard stdout_text_guard( stdout, FILE_mode::text ); FILE_mode_guard stderr_text_guard( stderr, FILE_mode::text ); - textout_dummy dummy_log; textout_wrapper<textout_destination::destination_stdout> std_out; textout_wrapper<textout_destination::destination_stderr> std_err; @@ -2281,6 +2280,7 @@ [[maybe_unused]] std::optional<terminal_ui_guard> input_guard{ stdin_text && ( flags.mode == Mode::UI ) ? std::make_optional<terminal_ui_guard>() : std::nullopt }; // choose text output between quiet/stdout/stderr + textout_dummy dummy_log; textout & log = flags.quiet ? static_cast<textout&>( dummy_log ) : stdout_text ? static_cast<textout&>( std_out ) : static_cast<textout&>( std_err ); show_banner( log, flags.banner ); |
From: <sv...@op...> - 2024-09-23 21:13:10
|
Author: manx Date: Mon Sep 23 23:12:59 2024 New Revision: 21729 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21729 Log: Merged revision(s) 21727 from branches/OpenMPT-1.30: [Fix] openmpt123: Fixup backport of r21721. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.28/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Mon Sep 23 23:10:55 2024 (r21728) +++ branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Mon Sep 23 23:12:59 2024 (r21729) @@ -2364,7 +2364,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { @@ -2543,7 +2543,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { |
From: <sv...@op...> - 2024-09-23 21:11:07
|
Author: manx Date: Mon Sep 23 23:10:55 2024 New Revision: 21728 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21728 Log: Merged revision(s) 21727 from branches/OpenMPT-1.30: [Fix] openmpt123: Fixup backport of r21721. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.29/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Mon Sep 23 23:10:16 2024 (r21727) +++ branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Mon Sep 23 23:10:55 2024 (r21728) @@ -2349,7 +2349,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { @@ -2517,7 +2517,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { |
From: <sv...@op...> - 2024-09-23 21:10:28
|
Author: manx Date: Mon Sep 23 23:10:16 2024 New Revision: 21727 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21727 Log: [Fix] openmpt123: Fixup backport of r21721. Modified: branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.30/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Mon Sep 23 23:06:33 2024 (r21726) +++ branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Mon Sep 23 23:10:16 2024 (r21727) @@ -2359,7 +2359,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { @@ -2527,7 +2527,7 @@ } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { - std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err << "error: " << e.what() << std::endl; std_err.writeout(); return 1; } catch ( std::exception & e ) { |
From: <sv...@op...> - 2024-09-23 21:06:47
|
Author: manx Date: Mon Sep 23 23:06:33 2024 New Revision: 21726 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21726 Log: [Ref] openmpt123: Simplify error printing for audio backends. Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp Mon Sep 23 23:06:33 2024 (r21726) @@ -2371,30 +2371,6 @@ std_err << MPT_USTRING("Error parsing command line.") << lf; std_err.writeout(); return 1; -#ifdef MPT_WITH_ALLEGRO42 - } catch ( allegro42_exception & e ) { - std_err << MPT_USTRING("Allegro-4.2 error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; - std_err.writeout(); - return 1; -#endif -#ifdef MPT_WITH_PULSEAUDIO - } catch ( pulseaudio_exception & e ) { - std_err << MPT_USTRING("PulseAudio error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; - std_err.writeout(); - return 1; -#endif -#ifdef MPT_WITH_PORTAUDIO - } catch ( portaudio_exception & e ) { - std_err << MPT_USTRING("PortAudio error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; - std_err.writeout(); - return 1; -#endif -#ifdef MPT_WITH_SDL2 - } catch ( sdl2_exception & e ) { - std_err << MPT_USTRING("SDL2 error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; - std_err.writeout(); - return 1; -#endif } catch ( silent_exit_exception & ) { return 0; } catch ( exception & e ) { Modified: trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123_allegro42.hpp Mon Sep 23 23:06:33 2024 (r21726) @@ -39,7 +39,7 @@ } } allegro42_exception() - : exception( error_to_string() ) + : exception( MPT_USTRING("Allegro-4.2: ") + error_to_string() ) { } }; Modified: trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123_portaudio.hpp Mon Sep 23 23:06:33 2024 (r21726) @@ -30,7 +30,7 @@ inline constexpr auto portaudio_encoding = mpt::common_encoding::utf8; struct portaudio_exception : public exception { - portaudio_exception( PaError code ) : exception( mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetErrorText( code ) ) ) { } + portaudio_exception( PaError code ) : exception( MPT_USTRING("PortAudio: ") + mpt::transcode<mpt::ustring>( portaudio_encoding, Pa_GetErrorText( code ) ) ) { } }; typedef void (*PaUtilLogCallback ) (const char *log); Modified: trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123_pulseaudio.hpp Mon Sep 23 23:06:33 2024 (r21726) @@ -44,7 +44,7 @@ return mpt::ustring(); } } - pulseaudio_exception( int error ) : exception( error_to_string( error ) ) { } + pulseaudio_exception( int error ) : exception( MPT_USTRING("PulseAudio: ") + error_to_string( error ) ) { } }; class pulseaudio_stream_raii : public write_buffers_interface { Modified: trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123_sdl2.hpp Mon Sep 23 23:06:33 2024 (r21726) @@ -46,7 +46,7 @@ return s.str(); } public: - sdl2_exception( int code, const char * error ) : exception( text_from_code( code ) + MPT_USTRING(" (") + mpt::transcode<mpt::ustring>( sdl2_encoding, error ? std::string(error) : std::string("NULL") ) + MPT_USTRING(")") ) { } + sdl2_exception( int code, const char * error ) : exception( MPT_USTRING("SDL2: ") + text_from_code( code ) + MPT_USTRING(" (") + mpt::transcode<mpt::ustring>( sdl2_encoding, error ? std::string(error) : std::string("NULL") ) + MPT_USTRING(")") ) { } }; static void check_sdl2_error( int e ) { Modified: trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp ============================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Mon Sep 23 23:02:15 2024 (r21725) +++ trunk/OpenMPT/openmpt123/openmpt123_waveout.hpp Mon Sep 23 23:06:33 2024 (r21726) @@ -20,7 +20,7 @@ namespace openmpt123 { struct waveout_exception : public exception { - waveout_exception() : exception( MPT_USTRING("waveout") ) { } + waveout_exception() : exception( MPT_USTRING("WaveOut: ") + MPT_USTRING("waveout") ) { } }; class waveout_stream_raii : public write_buffers_interface { |
From: <sv...@op...> - 2024-09-23 21:02:27
|
Author: manx Date: Mon Sep 23 23:02:15 2024 New Revision: 21725 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21725 Log: Merged revision(s) 21721 from trunk/OpenMPT: [Fix] openmpt123: Catch openmpt123::exception. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.28/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Mon Sep 23 23:01:54 2024 (r21724) +++ branches/OpenMPT-1.28/openmpt123/openmpt123.cpp Mon Sep 23 23:02:15 2024 (r21725) @@ -2363,6 +2363,10 @@ return 0; } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); @@ -2538,6 +2542,10 @@ #endif } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); |
From: <sv...@op...> - 2024-09-23 21:02:06
|
Author: manx Date: Mon Sep 23 23:01:54 2024 New Revision: 21724 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21724 Log: Merged revision(s) 21721 from trunk/OpenMPT: [Fix] openmpt123: Catch openmpt123::exception. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.29/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Mon Sep 23 23:01:35 2024 (r21723) +++ branches/OpenMPT-1.29/openmpt123/openmpt123.cpp Mon Sep 23 23:01:54 2024 (r21724) @@ -2348,6 +2348,10 @@ return 0; } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); @@ -2512,6 +2516,10 @@ #endif } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); |
From: <sv...@op...> - 2024-09-23 21:01:43
|
Author: manx Date: Mon Sep 23 23:01:35 2024 New Revision: 21723 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21723 Log: Merged revision(s) 21721 from trunk/OpenMPT: [Fix] openmpt123: Catch openmpt123::exception. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.30/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Mon Sep 23 23:01:15 2024 (r21722) +++ branches/OpenMPT-1.30/openmpt123/openmpt123.cpp Mon Sep 23 23:01:35 2024 (r21723) @@ -2358,6 +2358,10 @@ return 0; } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); @@ -2522,6 +2526,10 @@ #endif } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << "error: " << e.what() << std::endl; std_err.writeout(); |
From: <sv...@op...> - 2024-09-23 21:01:27
|
Author: manx Date: Mon Sep 23 23:01:15 2024 New Revision: 21722 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21722 Log: Merged revision(s) 21721 from trunk/OpenMPT: [Fix] openmpt123: Catch openmpt123::exception. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Modified: branches/OpenMPT-1.31/openmpt123/openmpt123.cpp ============================================================================== --- branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Mon Sep 23 23:00:43 2024 (r21721) +++ branches/OpenMPT-1.31/openmpt123/openmpt123.cpp Mon Sep 23 23:01:15 2024 (r21722) @@ -2301,6 +2301,10 @@ return 0; } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; std_err.writeout(); @@ -2468,6 +2472,10 @@ #endif } catch ( silent_exit_exception & ) { return 0; + } catch ( exception & e ) { + std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; + std_err.writeout(); + return 1; } catch ( std::exception & e ) { std_err << MPT_USTRING("error: ") << mpt::get_exception_text<mpt::ustring>( e ) << lf; std_err.writeout(); |