diff --git a/BUILD.md b/BUILD.md index 8dfae553..1a07d664 100644 --- a/BUILD.md +++ b/BUILD.md @@ -2,13 +2,14 @@ ## Compilation requirements -**GCC**: you need GCC and MAKE somewhere in PATH. In Windows this means one of these: +**GCC / Make**: In Windows this means one of these two somewhere in PATH: - MinGW-w64 (32bit version): https://sourceforge.net/projects/mingw-w64/ + - Use this for easier standalone executables - MSYS2 with the MinGW-w64_shell (32bit) package: https://msys2.github.io/ **MSVC / Visual Studio**: Microsoft's Visual C++ and MSBuild, bundled in either: - Visual Studio: https://www.visualstudio.com/downloads/ - Visual Studio Community 2015 should work (free, but must register after trial period). + - Visual Studio Community 2015 should work (free, but must register after trial period) - Visual C++ Build Tools (no IDE): http://landinghub.visualstudio.com/visual-cpp-build-tools **Git**: optional, to generate version numbers: @@ -16,12 +17,12 @@ ## Compiling modules -### test.exe / in_vgmstream (Winamp) / xmp-vgmstream (XMPlay) +### CLI (test.exe) / Winamp plugin (in_vgmstream) / XMPlay plugin (xmp-vgmstream) **With GCC**: use the *./Makefile* in the root folder, see inside for options. For compilation flags check the *Makefile* in each folder. You need to manually rebuild if you change a *.h* file (use *make clean*). -In Linux you may need to use *Makefile.unix.am* instead, and note that some Linux makefiles aren't up to date. +In Linux, Makefiles can be used to cross-compile with the MingW headers, but they aren't well prepared to generate native code at the moment. It should be fixable with some effort. Windows CMD example for test.exe: ``` @@ -36,10 +37,10 @@ mingw32-make.exe mingw_test -f Makefile ^ SHELL=sh.exe CC=gcc.exe AR=ar.exe STRIP=strip.exe DLLTOOL=dlltool.exe WINDRES=windres.exe ``` -**With MSVC**: open *./vgmstream_full.sln* and compile in Visual Studio, see the section below. +**With MSVC**: open *./vgmstream_full.sln* and compile in Visual Studio, or use MSBuild in the command line. See the foobar2000 section for dependencies and CMD examples. -### foo_input_vgmstream (foobar2000) +### foobar2000 plugin (foo\_input\_vgmstream) Requires MSVC (foobar/SDK only links to MSVC C++ DLLs) and these dependencies: - foobar2000 SDK, in *(vgmstream)/../foobar/*: http://www.foobar2000.org/SDK - FDK-AAC, in *(vgmstream)/../fdk-aac/*: https://github.com/kode54/fdk-aac @@ -56,7 +57,7 @@ VS2013 may not be compatible with the SDK in release mode due to compiler bugs. FDK-AAC/QAAC can be disabled by removing *VGM_USE_MP4V2* and *VGM_USE_FDKAAC* in the compiler/linker options and the project dependencies. -You can also use the command line to compile, if you don't want to touch the .vcxproj files, register VS2015 after trial, or only have VC++/MSBuild tools. +You can also use the command line to compile with MSBuild, if you don't want to touch the .vcxproj files, register VS2015 after trial, or only have VC++/MSBuild tools. Windows CMD example for foobar2000: ``` @@ -80,41 +81,83 @@ msbuild fb2k/foo_input_vgmstream.vcxproj ^ ``` ### Audacious plugin -It *should* be buildable with autoconf (support unknown). +Requires the dev version of Audacious (and dependencies), automake/autoconf, and gcc/make (C++11). +The plugin itself works with Audacious 3.5 or higher. New Audacious releases can break plugin compatibility so it may not work with the latest version unless adapted first. + +FFmpeg and other external libraries aren't enabled, thus some formats are not supported. libvorbis and libmpg123 can be disabled with -DVGM_DISABLE_VORBIS and -DVGM_DISABLE_MPEG. + +Windows builds aren't supported at the moment (should be possible but there are complex dependency chains). + + +Terminal example, assuming a Ubuntu-based Linux distribution: +``` +# get libraries +sudo apt-get update + +sudo apt-get install audacious + +sudo apt-get install git +sudo apt-get install gcc g++ make +sudo apt-get install autoconf automake libtool +sudo apt-get install audacious-dev libmpg123-dev libvorbis-dev libglib2.0-dev libgtk2.0-dev libpango1.0-dev + +# check audacious version +pkg-config --modversion audacious + +git clone https://github.com/kode54/vgmstream +cd vgmstream + + +# build +./bootstrap +./configure +make -f Makefile.audacious + +# copy to audacious plugins +sudo make -f Makefile.audacious install + + +# post-cleanup +make -f Makefile.audacious clean +find . -name ".deps" -type d -exec rm -r "{}" \; +./unbootstrap +## WARNING, removes *all* untracked files not in .gitignore +git clean -fd +``` ## Development ### Structure -vgmstream uses C (C89 when possible), except the foobar2000 plugin (C++). +vgmstream uses C89 when possible (so VS2010 can compile it), and C++ for the foobar2000 and Audacious plugins. ``` ./ docs, scripts +./audacious/ Audacious plugin ./ext_includes/ external includes for compiling ./ext_libs/ external libs/DLLs for linking ./fb2k/ foobar2000 plugin ./src/ main vgmstream code and helpers -./src/coding/ format sample decoders +./src/coding/ format data decoders ./src/layout/ format data demuxers ./src/meta/ format header parsers ./test/ test.exe CLI -./unix/ Audacious plugin ./winamp/ Winamp plugin -./xmp-vgmstream/ XMPlay plugin +./xmplay/ XMPlay plugin ``` ### Overview vgmstream works by parsing a music stream header (*meta/*), reading/demuxing data or looping (*layout/*) and decoding the compressed data into listenable PCM samples (*coding/*). Very simplified it goes like this: -- player (test.exe, winamp plugin, etc) inits the stream *[main]* +- player (test.exe, plugin, etc) inits the stream *[main]* - init tries all parsers (metas) until one works *[init_vgmstream]* - parser reads header (channels, sample rate, loop points) and set ups a VGMSTREAM struct + layout/coding, if the format is correct *[init_vgmstream_(format-name)]* - player gets total_samples to play, based on the number of loops and other settings *[get_vgmstream_play_samples]* - player asks to fill a small sample buffer *[render_vgmstream]* - layout prepares bytes to read from the stream *[render_vgmstream_(layout)]* - decoder decodes bytes into PCM samples *[decode_vgmstream_(coding)]* -- player plays those samples, asks to fill sample buffer, repeats until total_samples +- player plays those samples, asks to fill sample buffer, repeats (until total_samples) - layout moves back to loop_start when loop_end is reached *[vgmstream_do_loop]* ### Adding new formats @@ -122,10 +165,8 @@ For new simple formats, assuming existing layout/coding: - *src/meta/(format-name).c*: create new format parser that reads all needed info from the stream header and inits VGMSTREAM - *src/meta/meta.h*: register parser's init - *src/vgmstream.h*: register new meta -- *src/vgmstream.c*: add parser init to search list +- *src/vgmstream.c*: add parser init to the init list - *src/formats.c*: add new extension to the format list, add meta description - *fb2k/in_vgmstream.cpp*: add new extension to the file associations list -- *src/Makefile* - *src/meta/Makefile.unix.am* - *src/libvgmstream.vcproj/vcxproj/filters*: to compile new (format-name).c parser -- if the format needs an external library don't forget to make it optional with: *#ifdef VGM_USE_X ... #endif* +- *fb2k/foo_vgmstream.cpp*: add new extension to the file register list (optional) +- *src/libvgmstream.vcproj/vcxproj/filters*: add to compile new (format-name).c parser in VS +- if the format needs an external library don't forget to mark optional parts with: *#ifdef VGM_USE_X ... #endif*