From e1af7e3f8c36432b2261323310f39584ad149e83 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:14:45 +0100 Subject: [PATCH 1/9] - Game-Music-Emu: reduce code delta with original source. This will help with the next Game-Music-Emu upgrades. --- game-music-emu/CMakeLists.txt | 7 +++++++ game-music-emu/gme/CMakeLists.txt | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index 8ceb1b4b7..fc6af33df 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -108,3 +108,10 @@ set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for # Shared library defined here add_subdirectory(gme) + +# EXCLUDE_FROM_ALL adds build rules but keeps it out of default build +# [ZDoom] Not needed. +if( FALSE ) +add_subdirectory(player EXCLUDE_FROM_ALL) +add_subdirectory(demo EXCLUDE_FROM_ALL) +endif() diff --git a/game-music-emu/gme/CMakeLists.txt b/game-music-emu/gme/CMakeLists.txt index 10544d721..d10ed2920 100644 --- a/game-music-emu/gme/CMakeLists.txt +++ b/game-music-emu/gme/CMakeLists.txt @@ -131,6 +131,12 @@ set (EXPORTED_HEADERS gme.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gme_types.h.in ${CMAKE_CURRENT_BINARY_DIR}/gme_types.h) +# [ZDoom] Not needed. +if( FALSE ) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgme.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc @ONLY) +endif() + # On some platforms we may need to change headers or whatnot based on whether # we're building the library or merely using the library. The following is # only defined when building the library to allow us to tell which is which. @@ -147,7 +153,18 @@ add_library(gme ${libgme_SRCS}) # to the API), the SOVERSION should be the same even when bumping up VERSION. # The way gme.h is designed, SOVERSION should very rarely be bumped, if ever. # Hopefully the API can stay compatible with old versions. -#set_target_properties(gme -# PROPERTIES VERSION ${GME_VERSION} -# SOVERSION 0) +# [ZDoom] Not needed. +if( FALSE ) +set_target_properties(gme + PROPERTIES VERSION ${GME_VERSION} + SOVERSION 0) + +install(TARGETS gme LIBRARY DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin # DLL platforms + ARCHIVE DESTINATION lib) # DLL platforms + +install(FILES ${EXPORTED_HEADERS} DESTINATION include/gme) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib/pkgconfig) +endif() + target_link_libraries(gme) From 8895716e273a5bcecaa00714ef95c99a2845b131 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:19:56 +0100 Subject: [PATCH 2/9] - Game-Music-Emu: Merge commit cf7bfd2. Commit title: 'added gme_tell_samples() and gme_seek_samples()' --- game-music-emu/gme/Music_Emu.cpp | 13 +++++++++++-- game-music-emu/gme/Music_Emu.h | 6 ++++++ game-music-emu/gme/gme.cpp | 2 ++ game-music-emu/gme/gme.h | 6 ++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/game-music-emu/gme/Music_Emu.cpp b/game-music-emu/gme/Music_Emu.cpp index d0dbe77a8..b7fc4993b 100644 --- a/game-music-emu/gme/Music_Emu.cpp +++ b/game-music-emu/gme/Music_Emu.cpp @@ -178,6 +178,11 @@ blargg_long Music_Emu::msec_to_samples( blargg_long msec ) const return (sec * sample_rate() + msec * sample_rate() / 1000) * stereo; } +long Music_Emu::tell_samples() const +{ + return out_time; +} + long Music_Emu::tell() const { blargg_long rate = sample_rate() * stereo; @@ -185,14 +190,18 @@ long Music_Emu::tell() const return sec * 1000 + (out_time - sec * rate) * 1000 / rate; } -blargg_err_t Music_Emu::seek( long msec ) +blargg_err_t Music_Emu::seek_samples( long time ) { - blargg_long time = msec_to_samples( msec ); if ( time < out_time ) RETURN_ERR( start_track( current_track_ ) ); return skip( time - out_time ); } +blargg_err_t Music_Emu::seek( long msec ) +{ + return seek_samples( msec_to_samples( msec ) ); +} + blargg_err_t Music_Emu::skip( long count ) { require( current_track() >= 0 ); // start_track() must have been called already diff --git a/game-music-emu/gme/Music_Emu.h b/game-music-emu/gme/Music_Emu.h index b96f4b611..d98f7ce7e 100644 --- a/game-music-emu/gme/Music_Emu.h +++ b/game-music-emu/gme/Music_Emu.h @@ -41,9 +41,15 @@ public: // Number of milliseconds (1000 msec = 1 second) played since beginning of track long tell() const; + // Number of samples generated since beginning of track + long tell_samples() const; + // Seek to new time in track. Seeking backwards or far forward can take a while. blargg_err_t seek( long msec ); + // Equivalent to restarting track then skipping n samples + blargg_err_t seek_samples( long n ); + // Skip n samples blargg_err_t skip( long n ); diff --git a/game-music-emu/gme/gme.cpp b/game-music-emu/gme/gme.cpp index 990fee345..5247c1f1a 100644 --- a/game-music-emu/gme/gme.cpp +++ b/game-music-emu/gme/gme.cpp @@ -337,7 +337,9 @@ BLARGG_EXPORT gme_err_t gme_play ( Music_Emu* me, int n, short* p ) BLARGG_EXPORT void gme_set_fade ( Music_Emu* me, int start_msec ) { me->set_fade( start_msec ); } BLARGG_EXPORT int gme_track_ended ( Music_Emu const* me ) { return me->track_ended(); } BLARGG_EXPORT int gme_tell ( Music_Emu const* me ) { return me->tell(); } +BLARGG_EXPORT int gme_tell_samples ( Music_Emu const* me ) { return me->tell_samples(); } BLARGG_EXPORT gme_err_t gme_seek ( Music_Emu* me, int msec ) { return me->seek( msec ); } +BLARGG_EXPORT gme_err_t gme_seek_samples ( Music_Emu* me, int n ) { return me->seek_samples( n ); } BLARGG_EXPORT int gme_voice_count ( Music_Emu const* me ) { return me->voice_count(); } BLARGG_EXPORT void gme_ignore_silence ( Music_Emu* me, int disable ) { me->ignore_silence( disable != 0 ); } BLARGG_EXPORT void gme_set_tempo ( Music_Emu* me, double t ) { me->set_tempo( t ); } diff --git a/game-music-emu/gme/gme.h b/game-music-emu/gme/gme.h index 1f2a2d150..8eb952e23 100644 --- a/game-music-emu/gme/gme.h +++ b/game-music-emu/gme/gme.h @@ -47,9 +47,15 @@ int gme_track_ended( Music_Emu const* ); /* Number of milliseconds (1000 = one second) played since beginning of track */ int gme_tell( Music_Emu const* ); +/* Number of samples generated since beginning of track */ +int gme_tell_samples( Music_Emu const* ); + /* Seek to new time in track. Seeking backwards or far forward can take a while. */ gme_err_t gme_seek( Music_Emu*, int msec ); +/* Equivalent to restarting track then skipping n samples */ +gme_err_t gme_seek_samples( Music_Emu*, int n ); + /******** Informational ********/ From f239c0ea05d53be750d2dd1a91c78a9c6f0b26c3 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:27:34 +0100 Subject: [PATCH 3/9] - Game-Music-Emu: Merge commit 6e1544d. Commit title: 'Fix undefined left-shift of signed int.' --- game-music-emu/gme/Spc_Cpu.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/game-music-emu/gme/Spc_Cpu.cpp b/game-music-emu/gme/Spc_Cpu.cpp index a9746e015..db96ac390 100644 --- a/game-music-emu/gme/Spc_Cpu.cpp +++ b/game-music-emu/gme/Spc_Cpu.cpp @@ -433,9 +433,7 @@ void Snes_Spc::cpu_write( int data, int addr, rel_time_t time ) #endif // Registers other than $F2 and $F4-$F7 - //if ( reg != 2 && reg != 4 && reg != 5 && reg != 6 && reg != 7 ) - // TODO: this is a bit on the fragile side - if ( ((~0x2F00 << (bits_in_int - 16)) << reg) < 0 ) // 36% + if ( reg != 2 && (reg < 4 || reg > 7) ) // 36% cpu_write_smp_reg( data, time, reg ); } // High mem/address wrap-around From 05e77303bf103dd3319d74882090e0ca42c768b6 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:33:44 +0100 Subject: [PATCH 4/9] - Game-Music-Emu: Merge commit 12b50ee. Commit title: Honor LIB_SUFFIX with pkg-config metadata. --- game-music-emu/changes.txt | 6 ++++++ game-music-emu/gme/CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/game-music-emu/changes.txt b/game-music-emu/changes.txt index 62391ebb5..dfab7a9c0 100644 --- a/game-music-emu/changes.txt +++ b/game-music-emu/changes.txt @@ -1,6 +1,12 @@ Game_Music_Emu Change Log ------------------------- +Game_Music_Emu 0.6.1 +-------------------- + +- Packaging improvements: + - Honor $LIB_SUFFIX for installed pkg-config metadata. + Game_Music_Emu 0.6.0 -------------------- diff --git a/game-music-emu/gme/CMakeLists.txt b/game-music-emu/gme/CMakeLists.txt index d10ed2920..8d710709f 100644 --- a/game-music-emu/gme/CMakeLists.txt +++ b/game-music-emu/gme/CMakeLists.txt @@ -164,7 +164,7 @@ install(TARGETS gme LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib) # DLL platforms install(FILES ${EXPORTED_HEADERS} DESTINATION include/gme) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib/pkgconfig) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig) endif() target_link_libraries(gme) From 287fc513a22a6abb319fb564c5ddd113badbbce6 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:39:08 +0100 Subject: [PATCH 5/9] - Game-Music-Emu: Merge and change commits 9bb5ad7, bc0a473 and 2018c1b. Commit titles: 9bb5ad7 - 'Add filename param to demo app.' bc0a473 - 'Allow building a static library (-DLIBTYPE=STATIC)' 2018c1b - 'Merged in lachs0r/game-music-emu (pull request #1)' Change: ZDoom doesn't need the shared library, so disable it always. --- game-music-emu/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index fc6af33df..2e2299456 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -79,6 +79,9 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" ) SET(USE_GME_NSF 1 BOOL "Enable NES NSF music emulation") #endif() +# [ZDoom] Set always to OFF. +set(BUILD_SHARED_LIBS 0 BOOL "Build shared library (set to OFF for static library)") + # Check for GCC "visibility" support. if (CMAKE_COMPILER_IS_GNUCXX) check_cxx_compiler_flag (-fvisibility=hidden __LIBGME_TEST_VISIBILITY) From 3d3bc8e40e250387e456a672ce5e7a4915d021b4 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 21:51:53 +0100 Subject: [PATCH 6/9] - Game-Music-Emu: Merge commits b1948ac, 8af6ba4, eb5f592 and 56d43f4. Commit titles: b1948ac - 'Describe CMake addition for static libs in changelog.' 8af6ba4 - 'Bump version in CMakeLists as well.' eb5f592 - 'Update readme for repo move and next version.' 56d43f4 - 'Update readme as well now.' --- game-music-emu/CMakeLists.txt | 2 +- game-music-emu/changes.txt | 6 ++++++ game-music-emu/gme.txt | 13 +++++++------ game-music-emu/readme.txt | 30 +++++++++++++++++++++++------- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index 2e2299456..20973401b 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -4,7 +4,7 @@ project(libgme) include (CheckCXXCompilerFlag) # When version is changed, also change the one in gme/gme.h to match -set(GME_VERSION 0.6.0 CACHE INTERNAL "libgme Version") +set(GME_VERSION 0.6.1 CACHE INTERNAL "libgme Version") # 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't. # Of course, 2.4 might work, in which case you're welcome to drop diff --git a/game-music-emu/changes.txt b/game-music-emu/changes.txt index dfab7a9c0..48986756a 100644 --- a/game-music-emu/changes.txt +++ b/game-music-emu/changes.txt @@ -4,8 +4,14 @@ Game_Music_Emu Change Log Game_Music_Emu 0.6.1 -------------------- +- Moved repository to Bitbucket since Google Code announced they would + shutdown this year. + - Packaging improvements: - Honor $LIB_SUFFIX for installed pkg-config metadata. + - Support setting BUILD_SHARED_LIBS to OFF to build libgme as a static + library. (Pass -DBUILD_SHARED_LIBS=OFF when running cmake). + Thanks to lachs0r. Game_Music_Emu 0.6.0 -------------------- diff --git a/game-music-emu/gme.txt b/game-music-emu/gme.txt index d9a2452c7..baec6f4dc 100644 --- a/game-music-emu/gme.txt +++ b/game-music-emu/gme.txt @@ -1,10 +1,11 @@ -Game_Music_Emu 0.6.0 +Game_Music_Emu 0.6.1 -------------------- -Author : Shay Green -Website: http://www.slack.net/~ant/libs/ -Forum : http://groups.google.com/group/blargg-sound-libs -Source : https://code.google.com/p/game-music-emu/ -License: GNU Lesser General Public License (LGPL) +Author : Shay Green +Maintainer : Michael Pyne +Website : http://www.slack.net/~ant/libs/ +Forum : http://groups.google.com/group/blargg-sound-libs +Source : https://bitbucket.org/mpyne/game-music-emu/ +License : GNU Lesser General Public License (LGPL), see LICENSE.txt Contents -------- diff --git a/game-music-emu/readme.txt b/game-music-emu/readme.txt index 82a501dbd..b29a00797 100644 --- a/game-music-emu/readme.txt +++ b/game-music-emu/readme.txt @@ -1,4 +1,4 @@ -Game_Music_Emu 0.6.0: Game Music Emulators +Game_Music_Emu 0.6.1: Game Music Emulators ------------------------------------------ Game_Music_Emu is a collection of video game music file emulators that support the following formats and systems: @@ -38,26 +38,42 @@ Website: http://www.slack.net/~ant/ Forum : http://groups.google.com/group/blargg-sound-libs License: GNU Lesser General Public License (LGPL) +Current Maintainer: Michael Pyne Getting Started --------------- Build a program consisting of demo/basics.c, demo/Wave_Writer.cpp, and -all source files in gme/. If you have CMake 2.6 or later, execute +all source files in gme/. - run cmake - cd demo - run make +Or, if you have CMake 2.6 or later, execute at a command prompt (from the +extracted source directory): -Be sure "test.nsf" is in the same directory as the program. Running it + mkdir build + cd build + cmake ../ # <-- Pass any needed CMake flags here + make # To build the library + cd demo + make # To build the demo itself + +Be sure "test.nsf" is in the same directory as the demo program. Running it should generate the recording "out.wav". +You can use "make install" to install the library. To choose where to install +the library to, use the CMake argument "-DCMAKE_INSTALL_PREFIX=/usr/local" +(and replace /usr/local with the base path you wish to use). Alternately, you +can specify the base path to install to when you run "make install" by passing +'DESTDIR=/usr/local' on the make install command line (again, replace +/usr/local as appropriate). + +To build a static library instead of shared (the default), pass +-DBUILD_SHARED_LIBS=OFF to the cmake command when running cmake. + A slightly more extensive demo application is available in the player/ directory. It requires SDL to build. Read gme.txt for more information. Post to the discussion forum for assistance. - Files ----- gme.txt General notes about the library From dd92587841ff9bb2d579b5ec7a1af5d2e3c8c9a4 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 22:01:06 +0100 Subject: [PATCH 7/9] - Game-Music-Emu: Merge commit bf60977. Commit title: 'Fix compile failures with zlib support enabled.' --- game-music-emu/gme/Data_Reader.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/game-music-emu/gme/Data_Reader.h b/game-music-emu/gme/Data_Reader.h index acf571f67..6c22b678e 100644 --- a/game-music-emu/gme/Data_Reader.h +++ b/game-music-emu/gme/Data_Reader.h @@ -129,6 +129,8 @@ private: }; #ifdef HAVE_ZLIB_H +#include + // Gzip compressed file reader class Gzip_File_Reader : public File_Reader { public: @@ -143,7 +145,7 @@ public: long tell() const; blargg_err_t seek( long ); private: - void* file_; + gzFile file_; long size_; }; #endif From b515a034f6614fd288b428d00c56c53ecee16daa Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 22:05:45 +0100 Subject: [PATCH 8/9] - Game-Music-Emu: Merge commits dfffd2b and 2cbb70f. Commit titles: dfffd2b - 'Hide the GCC visibility option to non-GCC compilers.' 2cbb70f - 'Merged in edward_san/game-music-emu (pull request #3)' --- game-music-emu/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index 20973401b..c6472b690 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -104,10 +104,10 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif() endif() endif() # test visibility -endif() -# Cache this result -set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") + # Cache this result + set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") +endif() # Shared library defined here add_subdirectory(gme) From 88942dcc688f8da616279d0516b0e8c24e9cfc4b Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 16 Dec 2016 22:13:18 +0100 Subject: [PATCH 9/9] - Game-Music-Emu: Merge commits 87b322b and d48c1c8. Commit titles: 87b322b - 'Properly clamp SPC CPU registers and temporaries.' d48c1c8 - 'Complete bumping version to 0.6.1.' This completes the code upgrade to GME 0.6.1. --- game-music-emu/gme/Spc_Cpu.h | 2 +- game-music-emu/gme/gme.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game-music-emu/gme/Spc_Cpu.h b/game-music-emu/gme/Spc_Cpu.h index ba2ca7a81..8829e818b 100644 --- a/game-music-emu/gme/Spc_Cpu.h +++ b/game-music-emu/gme/Spc_Cpu.h @@ -77,7 +77,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define SPC_NO_SP_WRAPAROUND 0 #define SET_SP( v ) (sp = ram + 0x101 + ((uint8_t) v)) -#define GET_SP() (uint8_t) (sp - 0x101 - ram) +#define GET_SP() (uint8_t (sp - 0x101 - ram)) #if SPC_NO_SP_WRAPAROUND #define PUSH16( v ) (sp -= 2, SET_LE16( sp, v )) diff --git a/game-music-emu/gme/gme.h b/game-music-emu/gme/gme.h index 8eb952e23..cb07061b4 100644 --- a/game-music-emu/gme/gme.h +++ b/game-music-emu/gme/gme.h @@ -1,6 +1,6 @@ /* Game music emulator library C interface (also usable from C++) */ -/* Game_Music_Emu 0.6.0 */ +/* Game_Music_Emu 0.6.1 */ #ifndef GME_H #define GME_H @@ -8,7 +8,7 @@ extern "C" { #endif -#define GME_VERSION 0x000600 /* 1 byte major, 1 byte minor, 1 byte patch-level */ +#define GME_VERSION 0x000601 /* 1 byte major, 1 byte minor, 1 byte patch-level */ /* Error string returned by library functions, or NULL if no error (success) */ typedef const char* gme_err_t;