Merge pull request #87 from bnnm/plugins

Plugin cleanup
This commit is contained in:
Christopher Snowhill 2017-05-01 21:36:34 -07:00 committed by GitHub
commit 121226c66a
49 changed files with 860 additions and 1347 deletions

19
.gitignore vendored
View File

@ -1,15 +1,24 @@
.*
!/.gitignore
*.user
*.suo
*.vspscc
*.o
*.a
# VS stuff
ipch
.vs
*.opensdf
*.pdb
*.sdf
*.suo
*.v11.suo
*.v12.suo
*.vspscc
*.VC.db
*.VC.VC.opendb
Debug
Release
ipch
/ext_libs/Debug
/ext_libs/Release
/ext_libs/*.exp
@ -26,4 +35,6 @@ ipch
/winamp/Debug
/winamp/Release
/winamp/*.dll
/xmp-vgmstream/*.dll
/xmplay/Debug
/xmplay/Release
/xmplay/*.dll

View File

@ -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*

View File

@ -14,7 +14,7 @@ sourceball:
rm -rf vgmstream-`./version.sh`
mingwbin: mingw_test mingw_winamp mingw_xmplay
zip -FS -j "vgmstream-`./version.sh`-test.zip" COPYING readme.txt test/test.exe winamp/in_vgmstream.dll xmp-vgmstream/xmp-vgmstream.dll ext_libs/*.dll
zip -FS -j "vgmstream-`./version.sh`-test.zip" COPYING readme.txt test/test.exe winamp/in_vgmstream.dll xmplay/xmp-vgmstream.dll ext_libs/*.dll
mingw_test:
$(MAKE) -C test -f Makefile.mingw test.exe
@ -23,7 +23,7 @@ mingw_winamp:
$(MAKE) -C winamp in_vgmstream.dll
mingw_xmplay:
$(MAKE) -C xmp-vgmstream xmp-vgmstream.dll
$(MAKE) -C xmplay xmp-vgmstream.dll
clean:
rm -f vgmstream-*.zip
@ -31,5 +31,5 @@ clean:
$(MAKE) -C test clean
$(MAKE) -C test -f Makefile.mingw clean
$(MAKE) -C winamp clean
$(MAKE) -C xmp-vgmstream clean
$(MAKE) -C xmplay clean
$(MAKE) -C ext_libs -f Makefile.mingw clean

8
Makefile.audacious.am Normal file
View File

@ -0,0 +1,8 @@
## audacious-vgmstream script
## Process this file with automake to produce Makefile.in
AM_MAKEFLAGS=-f Makefile.audacious
SUBDIRS = src audacious
#EXTRA_DIST = include

View File

@ -1,7 +0,0 @@
## Process this file with automake to produce Makefile.in
AM_MAKEFLAGS=-f Makefile.unix
SUBDIRS = src unix
#EXTRA_DIST = include

View File

@ -0,0 +1,14 @@
## audacious-vgmstream automake script
lib_LTLIBRARIES = libvgmstream.la
libdir = @plugindir@/@INPUT_PLUGIN_DIR@
AM_MAKEFLAGS=-f Makefile.audacious
AM_CXXFLAGS = -DVERSION=\"VGMSTREAM_VERSION\" -Wall -std=c++11 -fpermissive @CXXFLAGS@ -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ @GTK_CFLAGS@
AM_LIBS =
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libvgmstream_la_LDFLAGS = -no-undefined -module -avoid-version -export-symbols-regex get_plugin_info ../src/libvgmstream.la
libvgmstream_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

297
audacious/plugin.cc Normal file
View File

@ -0,0 +1,297 @@
/**
* vgmstream for Audacious
*/
#include <cstdlib>
#include <algorithm>
#include <string.h>
#if DEBUG
#include <ctime>
#include <sys/time.h>
#endif
#include <libaudcore/audio.h>
extern "C" {
#include "../src/formats.h"
#include "../src/vgmstream.h"
}
#include "plugin.h"
#include "vfs.h"
#ifndef VERSION
#include "../version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"
#endif
#define CFG_ID "vgmstream" // ID for storing in audacious
#define MIN_BUFFER_SIZE 576
/* internal state */
VgmstreamPlugin aud_plugin_instance;
Settings vgmstream_cfg;
VGMSTREAM *vgmstream = NULL;
const char *const VgmstreamPlugin::defaults[] = {
"loop_forever", "1",
"loop_count", "2",
"fade_length", "3",
"fade_delay", "3",
NULL
};
const char VgmstreamPlugin::about[] =
"vgmstream plugin " VERSION " " __DATE__ "\n"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n"
"\n"
"Audacious plugin:\n"
"ported to Audacious 3.6 by Brandon Whitehead\n"
"adopted from Audacious 3 port by Thomas Eppers\n"
"originally written by Todd Jeffreys (http://voidpointer.org/)\n"
"\n"
"https://github.com/kode54/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)";
const PreferencesWidget VgmstreamPlugin::widgets[] = {
WidgetLabel(N_("<b>vgmstream Config</b>")),
WidgetCheck(N_("Loop Forever:"), WidgetBool(vgmstream_cfg.loop_forever)),
WidgetSpin(N_("Loop Count:"), WidgetInt(vgmstream_cfg.loop_count), {1, 20, 1}),
WidgetSpin(N_("Fade Length:"), WidgetFloat(vgmstream_cfg.fade_length), {0, 60, 0.1}),
WidgetSpin(N_("Fade Delay:"), WidgetFloat(vgmstream_cfg.fade_delay), {0, 60, 0.1}),
};
void vgmstream_cfg_load() {
debugMessage("cfg_load called");
aud_config_set_defaults(CFG_ID, VgmstreamPlugin::defaults);
vgmstream_cfg.loop_forever = aud_get_bool(CFG_ID, "loop_forever");
vgmstream_cfg.loop_count = aud_get_int(CFG_ID, "loop_count");
vgmstream_cfg.fade_length = aud_get_double(CFG_ID, "fade_length");
vgmstream_cfg.fade_delay = aud_get_double(CFG_ID, "fade_delay");
}
void vgmstream_cfg_save() {
debugMessage("cfg_save called");
aud_set_bool(CFG_ID, "loop_forever", vgmstream_cfg.loop_forever);
aud_set_int(CFG_ID, "loop_count", vgmstream_cfg.loop_count);
aud_set_double(CFG_ID, "fade_length", vgmstream_cfg.fade_length);
aud_set_double(CFG_ID, "fade_delay", vgmstream_cfg.fade_delay);
}
const PluginPreferences VgmstreamPlugin::prefs = {
{widgets}, vgmstream_cfg_load, vgmstream_cfg_save
};
// validate extension
bool VgmstreamPlugin::is_our_file(const char *filename, VFSFile &file) {
const char * ext = strrchr(filename,'.');
if (ext==NULL)
ext = filename+strlen(filename); /* point to null, i.e. an empty string for the extension */
else
ext = ext+1; /* skip the dot */
const char ** ext_list = vgmstream_get_formats();
int ext_list_len = vgmstream_get_formats_length();
for (int i=0; i < ext_list_len; i++) {
if (!strcasecmp(ext, ext_list[i]))
return true;
}
return false;
}
bool VgmstreamPlugin::init() {
debugMessage("init");
vgmstream_cfg_load();
debugMessage("after load cfg");
return true;
}
void VgmstreamPlugin::cleanup() {
debugMessage("cleanup");
vgmstream_cfg_save();
}
// called every time the user adds a new file to playlist
bool read_data(const char * filename, Tuple & tuple) {
STREAMFILE *streamfile = open_vfs(filename);
if (!streamfile) return false;
VGMSTREAM *vgmstream = init_vgmstream_from_STREAMFILE(streamfile);
if (!vgmstream) {
close_streamfile(streamfile);
return false;
}
tuple.set_filename(filename); //may leak string???
int rate = get_vgmstream_average_bitrate(vgmstream);
tuple.set_int(Tuple::Bitrate, rate);
int ms = get_vgmstream_play_samples(vgmstream_cfg.loop_count, vgmstream_cfg.fade_length, vgmstream_cfg.fade_delay, vgmstream);
ms = ms* 1000LL / vgmstream->sample_rate;
tuple.set_int(Tuple::Length, ms);
tuple.set_str(Tuple::Codec, "vgmstream codec");//doesn't show?
// here we could call describe_vgmstream() and get substring to add tags and stuff
close_streamfile(streamfile);
close_vgmstream(vgmstream);
return true;
}
//for Audacious <= 3.7 (unused otherwise)
Tuple VgmstreamPlugin::read_tuple(const char *filename, VFSFile &file) {
debugMessage("read_tuple");
Tuple tuple;
read_data(filename, tuple);
return tuple;
}
//for Audacious >= 3.8 (unused otherwise)
bool VgmstreamPlugin::read_tag(const char * filename, VFSFile & file, Tuple & tuple, Index<char> * image) {
debugMessage("read_tag");
return read_data(filename, tuple);
}
bool VgmstreamPlugin::play(const char *filename, VFSFile &file) {
debugMessage("start play");
int current_sample_pos = 0;
int rate;
STREAMFILE *streamfile = open_vfs(filename);
if (!streamfile) {
printf("failed opening %s\n", filename);
return false;
}
vgmstream = init_vgmstream_from_STREAMFILE(streamfile);
close_streamfile(streamfile);
if (!vgmstream || vgmstream->channels <= 0) {
printf("Error::Channels are zero or couldn't init plugin\n");
if (vgmstream)
close_vgmstream(vgmstream);
vgmstream = NULL;
return false;
}
short buffer[MIN_BUFFER_SIZE * vgmstream->channels];
int max_buffer_samples = sizeof(buffer) / sizeof(buffer[0]) / vgmstream->channels;
int stream_samples_amount = get_vgmstream_play_samples(
vgmstream_cfg.loop_count, vgmstream_cfg.fade_length,
vgmstream_cfg.fade_delay, vgmstream);
rate = get_vgmstream_average_bitrate(vgmstream);
set_stream_bitrate(rate);
open_audio(FMT_S16_LE, vgmstream->sample_rate, 2);
int fade_samples = vgmstream_cfg.fade_length * vgmstream->sample_rate;
while (!check_stop()) {
int toget = max_buffer_samples;
int seek_value = check_seek();
if (seek_value > 0)
seek(seek_value, current_sample_pos);
// If we haven't configured the plugin to play forever
// or the current song is not loopable.
if (!vgmstream_cfg.loop_forever || !vgmstream->loop_flag) {
if (current_sample_pos >= stream_samples_amount)
break;
if (current_sample_pos + toget > stream_samples_amount)
toget = stream_samples_amount - current_sample_pos;
}
render_vgmstream(buffer, toget, vgmstream);
if (vgmstream->loop_flag && fade_samples > 0 &&
!vgmstream_cfg.loop_forever) {
int samples_into_fade =
current_sample_pos - (stream_samples_amount - fade_samples);
if (samples_into_fade + toget > 0) {
for (int j = 0; j < toget; j++, samples_into_fade++) {
if (samples_into_fade > 0) {
double fadedness =
(double)(fade_samples - samples_into_fade) / fade_samples;
for (int k = 0; k < vgmstream->channels; k++)
buffer[j * vgmstream->channels + k] *= fadedness;
}
}
}
}
write_audio(buffer, toget * sizeof(short) * vgmstream->channels);
current_sample_pos += toget;
}
debugMessage("finished");
if (vgmstream)
close_vgmstream(vgmstream);
vgmstream = NULL;
return true;
}
void VgmstreamPlugin::seek(int seek_value, int &current_sample_pos) {
debugMessage("seeking");
// compute from ms to samples
int seek_needed_samples = (long long)seek_value * vgmstream->sample_rate / 1000L;
short buffer[MIN_BUFFER_SIZE * vgmstream->channels];
int max_buffer_samples = sizeof(buffer) / sizeof(buffer[0]) / vgmstream->channels;
int samples_to_do = 0;
if (seek_needed_samples < current_sample_pos) {
// go back in time, reopen file
debugMessage("reopen file to seek backward");
reset_vgmstream(vgmstream);
current_sample_pos = 0;
samples_to_do = seek_needed_samples;
} else if (current_sample_pos < seek_needed_samples) {
// go forward in time
samples_to_do = seek_needed_samples - current_sample_pos;
}
// do the actual seeking
if (samples_to_do >= 0) {
debugMessage("render forward");
// render till seeked sample
while (samples_to_do > 0) {
int seek_samples = std::min(max_buffer_samples, samples_to_do);
current_sample_pos += seek_samples;
samples_to_do -= seek_samples;
render_vgmstream(buffer, seek_samples, vgmstream);
}
debugMessage("after render vgmstream");
}
}
void debugMessage(const char *str) {
#ifdef DEBUG
timeval curTime;
gettimeofday(&curTime, NULL);
int milli = curTime.tv_usec / 1000;
char buffer[80];
strftime(buffer, 80, "%H:%M:%S", localtime(&curTime.tv_sec));
char currentTime[84] = "";
sprintf(currentTime, "%s:%d", buffer, milli);
printf("[%s] Debug: %s\n", currentTime, str);
#endif
}

58
audacious/plugin.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef __PLUGIN__
#define __PLUGIN__
#include <libaudcore/audstrings.h>
#include <libaudcore/i18n.h>
#include <libaudcore/plugin.h>
#include <libaudcore/preferences.h>
#include <libaudcore/runtime.h>
class VgmstreamPlugin : public InputPlugin {
public:
//static const char *const exts[];
static const char *const defaults[];
static const char about[];
static const PreferencesWidget widgets[];
static const PluginPreferences prefs;
static constexpr PluginInfo info = {
N_("vgmstream Decoder"), N_("vgmstream"), about, &prefs,
};
// accepted exts are validated at runtime in is_our_file now, this is to set a static list
//static constexpr auto iinfo = InputInfo().with_exts(exts);
//constexpr VgmstreamPlugin() : InputPlugin(info, iinfo) {}
//constexpr VgmstreamPlugin() : InputPlugin (info, InputInfo().with_exts(exts)) {}
constexpr VgmstreamPlugin() : InputPlugin (info, NULL) {}
bool init();
void cleanup();
bool is_our_file(const char *filename, VFSFile &file);
Tuple read_tuple(const char *filename, VFSFile &file);
bool read_tag(const char * filename, VFSFile & file, Tuple & tuple, Index<char> * image);
bool play(const char *filename, VFSFile &file);
private:
void seek(int seek_value, int &current_sample_pos);
};
// reminder of usage, probably no more need
//const char *const VgmstreamPlugin::exts[] = { "ext1", "ext2", ..., NULL }
typedef struct {
bool loop_forever;
int loop_count;
double fade_length;
double fade_delay;
} Settings;
extern Settings vgmstream_cfg;
void debugMessage(const char *str);
void vgmstream_cfg_load();
void vgmstream_cfg_save();
#endif

View File

@ -1,5 +1,37 @@
#!/bin/sh
# audacious-vgmstream script - automake/autoconf init
# gets all files and updates .am scripts to avoid having to do manually (frowned upon by automake, whatevs)
# maybe there is a better way or place for this
VGMSTREAM_SRCS=`(cd ./src/ && ls *.c) | tr '\n' ' '`
VGMSTREAM_HDRS=`(cd ./src/ && ls *.h) | tr '\n' ' '`
CODING_SRCS=`(cd ./src/coding/ && ls *.c) | tr '\n' ' '`
CODING_HDRS=`(cd ./src/coding/ && ls *.h) | tr '\n' ' '`
LAYOUT_SRCS=`(cd ./src/layout/ && ls *.c) | tr '\n' ' '`
LAYOUT_HDRS=`(cd ./src/layout/ && ls *.h) | tr '\n' ' '`
META_SRCS=`(cd ./src/meta/ && ls *.c) | tr '\n' ' '`
META_HDRS=`(cd ./src/meta/ && ls *.h) | tr '\n' ' '`
AUDACIOUS_SRCS=`(cd ./audacious/ && ls *.cc) | tr '\n' ' '`
AUDACIOUS_HDRS=`(cd ./audacious/ && ls *.h) | tr '\n' ' '`
sed -i -e "s/libvgmstream_la_SOURCES =.*/libvgmstream_la_SOURCES = $VGMSTREAM_SRCS/g" ./src/Makefile.audacious.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $VGMSTREAM_HDRS/g" ./src/Makefile.audacious.am
sed -i -e "s/libcoding_la_SOURCES =.*/libcoding_la_SOURCES = $CODING_SRCS/g" ./src/coding/Makefile.audacious.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $CODING_HDRS/g" ./src/coding/Makefile.audacious.am
sed -i -e "s/liblayout_la_SOURCES =.*/liblayout_la_SOURCES = $LAYOUT_SRCS/g" ./src/layout/Makefile.audacious.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $LAYOUT_HDRS/g" ./src/layout/Makefile.audacious.am
sed -i -e "s/libmeta_la_SOURCES =.*/libmeta_la_SOURCES = $META_SRCS/g" ./src/meta/Makefile.audacious.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $META_HDRS/g" ./src/meta/Makefile.audacious.am
sed -i -e "s/libvgmstream_la_SOURCES =.*/libvgmstream_la_SOURCES = $AUDACIOUS_SRCS/g" ./audacious/Makefile.audacious.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $AUDACIOUS_HDRS/g" ./audacious/Makefile.audacious.am
# get version to show in about dialogs
# again, not very pretty
VGMSTREAM_VERSION=`./version.sh`
sed -i -e "s/VGMSTREAM_VERSION/$VGMSTREAM_VERSION/g" ./audacious/Makefile.audacious.am
# create fake files expected by automake and process
touch README AUTHORS NEWS ChangeLog
aclocal
autoheader

View File

@ -1,8 +1,10 @@
dnl audacious-vgmstream m4 script
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)
AC_INIT(audacious-vgmstream,1.1.0)
AM_INIT_AUTOMAKE(audacious-vgmstream, 1.1.0)
AM_CONFIG_HEADER(unix/config.h)
AC_INIT(audacious-vgmstream,1.3.0)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS(audacious/config.h)
AM_DISABLE_STATIC
AC_PROG_CC
@ -16,7 +18,7 @@ AC_PATH_X
AC_PATH_XTRA
PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 3.5.0],,
[AC_MSG_ERROR([Cannot find Audacious, have you installed audacious yet?])]
[AC_MSG_ERROR([Cannot find audacious >= 3.5.0 correctly installed])]
)
PKG_CHECK_MODULES(VORBISFILE, [vorbisfile],,
@ -27,8 +29,6 @@ PKG_CHECK_MODULES(MPG123, [libmpg123],,
[AC_MSG_ERROR([Cannot find libmpg123])]
)
dnl Check for GTK/GLib/GThread/Pango
PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.6.0 gtk+-2.0 >= 2.6.0 gthread-2.0 pango],
, [AC_MSG_ERROR([Cannot find glib2/gtk2/pango])]
)
@ -49,10 +49,10 @@ AC_PATH_X
AC_PATH_XTRA
AC_OUTPUT([
Makefile.unix
src/Makefile.unix
src/coding/Makefile.unix
src/layout/Makefile.unix
src/meta/Makefile.unix
unix/Makefile.unix
Makefile.audacious
src/Makefile.audacious
src/coding/Makefile.audacious
src/layout/Makefile.audacious
src/meta/Makefile.audacious
audacious/Makefile.audacious
])

View File

@ -209,11 +209,11 @@
>
</File>
<File
RelativePath=".\foostream.cpp"
RelativePath=".\foo_streamfile.cpp"
>
</File>
<File
RelativePath=".\in_vgmstream.cpp"
RelativePath=".\foo_vgmstream.cpp"
>
</File>
</Filter>

View File

@ -171,8 +171,8 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="foo_prefs.cpp" />
<ClCompile Include="foostream.cpp" />
<ClCompile Include="in_vgmstream.cpp" />
<ClCompile Include="foo_streamfile.cpp" />
<ClCompile Include="foo_vgmstream.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\fdk-aac\msvc\fdk-aac.vcxproj">

View File

@ -34,10 +34,10 @@
<ClCompile Include="foo_prefs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="foostream.cpp">
<ClCompile Include="foo_streamfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="in_vgmstream.cpp">
<ClCompile Include="foo_vgmstream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>

View File

@ -1,9 +1,6 @@
/* Winamp plugin interface for vgmstream */
/* Based on: */
/*
** Example Winamp .RAW input plug-in
** Copyright (c) 1998, Justin Frankel/Nullsoft Inc.
*/
/**
* vgmstream for foobar2000
*/
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
@ -35,10 +32,12 @@ extern "C" {
#define APP_NAME "vgmstream plugin"
#define PLUGIN_DESCRIPTION "vgmstream plugin " VERSION " " __DATE__ "\n" \
"by hcs, FastElbja, manakoAT, bxaimc and bnnm\n" \
"foobar2000 plugin by Josh W, kode54\n\n" \
"https://github.com/kode54/vgmstream\n\n" \
"http://sourceforge.net/projects/vgmstream"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n" \
"\n" \
"foobar2000 plugin by Josh W, kode54\n" \
"\n" \
"https://github.com/kode54/vgmstream/\n" \
"https://sourceforge.net/projects/vgmstream/ (original)";

View File

@ -1,24 +1,26 @@
vgmstream
This is vgmstream, a library for playing streamed audio from video games.
It is very much under development. There are multiple end-user bits: a command
line decoder called "test.exe", a Winamp plugin called "in_vgmstream", a
foobar2000 component called "foo_input_vgmstream", and an xmplay plugin
called "xmp-vgmstream".
There are multiple end-user bits:
- a command line decoder called "test.exe"
- a Winamp plugin called "in_vgmstream"
- a foobar2000 component called "foo_input_vgmstream"
- an XMPlay plugin called "xmp-vgmstream"
- an Audacious plugin called "libvgmstream"
*********** IMPORTANT!! ***********
--- needed files (for Windows) ---
Since Ogg Vorbis, MPEG audio, and other formats are now supported, you will
need to have certain DLL files.
You can get these from https://f.losno.co/vgmstream-win32-deps.zip, or in
the case of the foobar2000 component, they are all bundled for convenience.
In the case of the foobar2000 component they are all bundled for convenience,
or you can get them from here: https://github.com/kode54/vgmstream
(also here: https://f.losno.co/vgmstream-win32-deps.zip, may not be latest).
Put libvorbis.dll, libmpg123-0.dll, libg7221_decode.dll, libg719_decode.dll,
at3plusdecoder.dll, avcodec-vgmstream-57.dll, avformat-vgmstream-57.dll, and
avutil-vgmstream-55.dll somewhere Windows can find them.
For in_vgmstream this means in the directory with winamp.exe, or in a
system directory or other directory in the PATH variable. For test.exe this
means in the same directory as test.exe, or in a system directory/PATH.
For Winamp/XMPlay/test.exe this means in the directory with the .exe, or in a
system directory, or other directory in the PATH variable.
--- test.exe ---
Usage: ./test [-o outfile.wav] [-l loop count]
@ -50,6 +52,14 @@ to decode happy.adx to happy.wav.
Drop the in_vgmstream.dll in your Winamp plugins directory. Please follow
the above instructions for installing the other files needed.
--- xmp-vgmstream ---
Drop the xmp-vgmstream.dll in your XMPlay plugins directory. Please follow
the above instructions for installing the other files needed.
--- foo_input_vgmstream ---
Every should be installed automatically by the .fb2k-component bundle.
--- File types supported by this version of vgmstream ---
As manakoAT likes to say, the extension doesn't really mean anything, but it's
@ -239,8 +249,9 @@ multi:
- .strm (NDS IMA ADPCM, 8/16 bit PCM)
- .ss7 (EACS IMA ADPCM, IMA ADPCM)
- .swav (NDS IMA ADPCM, 8/16 bit PCM)
- .xwb (16 bit PCM, Xbox IMA ADPCM)
- .xwb (PCM, Xbox IMA ADPCM, MS ADPCM, XMA, XWMA, ATRAC3)
- .wav, .lwav (unsigned 8 bit PCM, 16 bit PCM, GC DSP ADPCM, MS IMA ADPCM)
- .wem (PCM, Wwise Vorbis, Wwise ADPCM, XMA, XWMA, GC DSP ADPCM)
etc:
- .2dx9 (MS ADPCM)
@ -260,9 +271,11 @@ etc:
- .hca (CRI)
- .kcey (EACS IMA ADPCM)
- .lsf (LSF ADPCM)
- .mc3 (Paradigm MC3 ADPCM)
- .mwv (Level-5 0x555 ADPCM)
- .mtaf (Konami ADPCM)
- .ogg, .logg (Ogg Vorbis)
- .ogl (Shin'en Vorbis)
- .p3d (Radical ADPCM)
- .rsf (CCITT G.721 ADPCM)
- .sab (Worms 4 soundpacks)

15
src/Makefile.audacious.am Normal file
View File

@ -0,0 +1,15 @@
## audacious-vgmstream automake script
noinst_LTLIBRARIES = libvgmstream.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.audacious
SUBDIRS = coding layout meta
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la
libvgmstream_la_SOURCES = (auto-updated)
libvgmstream_la_SOURCES += ../ext_libs/clHCA.c
EXTRA_DIST = (auto-updated)
EXTRA_DIST += ../ext_includes/clHCA.h

View File

@ -1,11 +0,0 @@
noinst_LTLIBRARIES = libvgmstream.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la
libvgmstream_la_SOURCES = vgmstream.c util.c streamfile.c formats.c ../ext_libs/clHCA.c
SUBDIRS = coding layout meta
EXTRA_DIST = pstdint.h streamfile.h streamtypes.h util.h vgmstream.h

View File

@ -0,0 +1,11 @@
## audacious-vgmstream automake script
noinst_LTLIBRARIES = libcoding.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.audacious
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libcoding_la_LDFLAGS =
libcoding_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

View File

@ -1,40 +0,0 @@
noinst_LTLIBRARIES = libcoding.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libcoding_la_LDFLAGS =
libcoding_la_SOURCES =
libcoding_la_SOURCES += adx_decoder.c
libcoding_la_SOURCES += eaxa_decoder.c
libcoding_la_SOURCES += g721_decoder.c
libcoding_la_SOURCES += ima_decoder.c
libcoding_la_SOURCES += ngc_afc_decoder.c
libcoding_la_SOURCES += ngc_dsp_decoder.c
libcoding_la_SOURCES += ngc_dtk_decoder.c
libcoding_la_SOURCES += pcm_decoder.c
libcoding_la_SOURCES += psx_decoder.c
libcoding_la_SOURCES += xa_decoder.c
libcoding_la_SOURCES += ogg_vorbis_decoder.c
libcoding_la_SOURCES += sdx2_decoder.c
libcoding_la_SOURCES += ws_decoder.c
libcoding_la_SOURCES += mpeg_decoder.c
libcoding_la_SOURCES += acm_decoder.c
libcoding_la_SOURCES += nwa_decoder.c
libcoding_la_SOURCES += aica_decoder.c
libcoding_la_SOURCES += msadpcm_decoder.c
libcoding_la_SOURCES += nds_procyon_decoder.c
libcoding_la_SOURCES += l5_555_decoder.c
libcoding_la_SOURCES += SASSC_decoder.c
libcoding_la_SOURCES += g7221_decoder.c
libcoding_la_SOURCES += lsf_decoder.c
libcoding_la_SOURCES += mtaf_decoder.c
libcoding_la_SOURCES += g719_decoder.c
libcoding_la_SOURCES += hca_decoder.c
libcoding_la_SOURCES += fsb_vorbis_decoder.c
libcoding_la_SOURCES += wwise_vorbis_decoder.c
libcoding_la_SOURCES += wwise_vorbis_utils.c
libcoding_la_SOURCES += ogl_vorbis_decoder.c
libcoding_la_SOURCES += mc3_decoder.c
EXTRA_DIST = coding.h g72x_state.h clHCA.h

207
src/coding/psv_decoder.c Normal file
View File

@ -0,0 +1,207 @@
#include <math.h>
#include "coding.h"
#include "../util.h"
/* PSVita ADPCM table */
static const int16_t HEVAG_coefs[128][4] = {
{ 0, 0, 0, 0 },
{ 7680, 0, 0, 0 },
{ 14720, -6656, 0, 0 },
{ 12544, -7040, 0, 0 },
{ 15616, -7680, 0, 0 },
{ 14731, -7059, 0, 0 },
{ 14507, -7366, 0, 0 },
{ 13920, -7522, 0, 0 },
{ 13133, -7680, 0, 0 },
{ 12028, -7680, 0, 0 },
{ 10764, -7680, 0, 0 },
{ 9359, -7680, 0, 0 },
{ 7832, -7680, 0, 0 },
{ 6201, -7680, 0, 0 },
{ 4488, -7680, 0, 0 },
{ 2717, -7680, 0, 0 },
{ 910, -7680, 0, 0 },
{ -910, -7680, 0, 0 },
{ -2717, -7680, 0, 0 },
{ -4488, -7680, 0, 0 },
{ -6201, -7680, 0, 0 },
{ -7832, -7680, 0, 0 },
{ -9359, -7680, 0, 0 },
{ -10764, -7680, 0, 0 },
{ -12028, -7680, 0, 0 },
{ -13133, -7680, 0, 0 },
{ -13920, -7522, 0, 0 },
{ -14507, -7366, 0, 0 },
{ -14731, -7059, 0, 0 },
{ 5376, -9216, 3328, -3072 },
{ -6400, -7168, -3328, -2304 },
{ -10496, -7424, -3584, -1024 },
{ -167, -2722, -494, -541 },
{ -7430, -2221, -2298, 424 },
{ -8001, -3166, -2814, 289 },
{ 6018, -4750, 2649, -1298 },
{ 3798, -6946, 3875, -1216 },
{ -8237, -2596, -2071, 227 },
{ 9199, 1982, -1382, -2316 },
{ 13021, -3044, -3792, 1267 },
{ 13112, -4487, -2250, 1665 },
{ -1668, -3744, -6456, 840 },
{ 7819, -4328, 2111, -506 },
{ 9571, -1336, -757, 487 },
{ 10032, -2562, 300, 199 },
{ -4745, -4122, -5486, -1493 },
{ -5896, 2378, -4787, -6947 },
{ -1193, -9117, -1237, -3114 },
{ 2783, -7108, -1575, -1447 },
{ -7334, -2062, -2212, 446 },
{ 6127, -2577, -315, -18 },
{ 9457, -1858, 102, 258 },
{ 7876, -4483, 2126, -538 },
{ -7172, -1795, -2069, 482 },
{ -7358, -2102, -2233, 440 },
{ -9170, -3509, -2674, -391 },
{ -2638, -2647, -1929, -1637 },
{ 1873, 9183, 1860, -5746 },
{ 9214, 1859, -1124, -2427 },
{ 13204, -3012, -4139, 1370 },
{ 12437, -4792, -256, 622 },
{ -2653, -1144, -3182, -6878 },
{ 9331, -1048, -828, 507 },
{ 1642, -620, -946, -4229 },
{ 4246, -7585, -533, -2259 },
{ -8988, -3891, -2807, 44 },
{ -2562, -2735, -1730, -1899 },
{ 3182, -483, -714, -1421 },
{ 7937, -3844, 2821, -1019 },
{ 10069, -2609, 314, 195 },
{ 8400, -3297, 1551, -155 },
{ -8529, -2775, -2432, -336 },
{ 9477, -1882, 108, 256 },
{ 75, -2241, -298, -6937 },
{ -9143, -4160, -2963, 5 },
{ -7270, -1958, -2156, 460 },
{ -2740, 3745, 5936, -1089 },
{ 8993, 1948, -683, -2704 },
{ 13101, -2835, -3854, 1055 },
{ 9543, -1961, 130, 250 },
{ 5272, -4270, 3124, -3157 },
{ -7696, -3383, -2907, -456 },
{ 7309, 2523, 434, -2461 },
{ 10275, -2867, 391, 172 },
{ 10940, -3721, 665, 97 },
{ 24, -310, -1262, 320 },
{ -8122, -2411, -2311, -271 },
{ -8511, -3067, -2337, 163 },
{ 326, -3846, 419, -933 },
{ 8895, 2194, -541, -2880 },
{ 12073, -1876, -2017, -601 },
{ 8729, -3423, 1674, -169 },
{ 12950, -3847, -3007, 1946 },
{ 10038, -2570, 302, 198 },
{ 9385, -2757, 1008, 41 },
{ -4720, -5006, -2852, -1161 },
{ 7869, -4326, 2135, -501 },
{ 2450, -8597, 1299, -2780 },
{ 10192, -2763, 360, 181 },
{ 11313, -4213, 833, 53 },
{ 10154, -2716, 345, 185 },
{ 9638, -1417, -737, 482 },
{ 3854, -4554, 2843, -3397 },
{ 6699, -5659, 2249, -1074 },
{ 11082, -3908, 728, 80 },
{ -1026, -9810, -805, -3462 },
{ 10396, -3746, 1367, -96 },
{ 10287, 988, -1915, -1437 },
{ 7953, 3878, -764, -3263 },
{ 12689, -3375, -3354, 2079 },
{ 6641, 3166, 231, -2089 },
{ -2348, -7354, -1944, -4122 },
{ 9290, -4039, 1885, -246 },
{ 4633, -6403, 1748, -1619 },
{ 11247, -4125, 802, 61 },
{ 9807, -2284, 219, 222 },
{ 9736, -1536, -706, 473 },
{ 8440, -3436, 1562, -176 },
{ 9307, -1021, -835, 509 },
{ 1698, -9025, 688, -3037 },
{ 10214, -2791, 368, 179 },
{ 8390, 3248, -758, -2989 },
{ 7201, 3316, 46, -2614 },
{ -88, -7809, -538, -4571 },
{ 6193, -5189, 2760, -1245 },
{ 12325, -1290, -3284, 253 },
{ 13064, -4075, -2824, 1877 },
{ 5333, 2999, 775, -1132 }
};
/**
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
* Evolution of the regular VAG (same flags and frames), uses 4 history samples and a bigger table.
*
* Original research and algorithm by id-daemon / daemon1.
*/
void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
uint8_t predict_nr, shift, flag, byte;
int32_t scale = 0;
int32_t sample;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int32_t hist3 = stream->adpcm_history3_32;
int32_t hist4 = stream->adpcm_history4_32;
int i, sample_count;
int framesin = first_sample / 28;
/* 4 byte header: predictor = 3rd and 1st, shift = 2nd, flag = 4th */
byte = (uint8_t)read_8bit(stream->offset+framesin*16+0,stream->streamfile);
predict_nr = byte >> 4;
shift = byte & 0x0f;
byte = (uint8_t)read_8bit(stream->offset+framesin*16+1,stream->streamfile);
predict_nr = (byte & 0xF0) | predict_nr;
flag = byte & 0x0f; /* no change in flags */
first_sample = first_sample % 28;
if (first_sample & 1) { /* if first sample is odd, read byte first */
byte = read_8bit(stream->offset+(framesin*16)+2+first_sample/2,stream->streamfile);
}
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
sample = 0;
if (flag < 7 && predict_nr < 128) {
if (i & 1) {/* odd/even nibble */
scale = byte >> 4;
} else {
byte = read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
scale = byte & 0x0f;
}
if (scale > 7) { /* sign extend */
scale = scale - 16;
}
sample = (hist1 * HEVAG_coefs[predict_nr][0] +
hist2 * HEVAG_coefs[predict_nr][1] +
hist3 * HEVAG_coefs[predict_nr][2] +
hist4 * HEVAG_coefs[predict_nr][3] ) / 32;
sample = (sample + (scale << (20 - shift)) + 128) >> 8;
}
outbuf[sample_count] = clamp16(sample);
hist4 = hist3;
hist3 = hist2;
hist2 = hist1;
hist1 = sample;
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
stream->adpcm_history3_32 = hist3;
stream->adpcm_history4_32 = hist4;
}

View File

@ -24,142 +24,11 @@ static const int8_t VAG_coefs[5][2] = {
};
#endif
/* PSVita ADPCM table */
static const int16_t HEVAG_coefs[128][4] = {
{ 0, 0, 0, 0 },
{ 7680, 0, 0, 0 },
{ 14720, -6656, 0, 0 },
{ 12544, -7040, 0, 0 },
{ 15616, -7680, 0, 0 },
{ 14731, -7059, 0, 0 },
{ 14507, -7366, 0, 0 },
{ 13920, -7522, 0, 0 },
{ 13133, -7680, 0, 0 },
{ 12028, -7680, 0, 0 },
{ 10764, -7680, 0, 0 },
{ 9359, -7680, 0, 0 },
{ 7832, -7680, 0, 0 },
{ 6201, -7680, 0, 0 },
{ 4488, -7680, 0, 0 },
{ 2717, -7680, 0, 0 },
{ 910, -7680, 0, 0 },
{ -910, -7680, 0, 0 },
{ -2717, -7680, 0, 0 },
{ -4488, -7680, 0, 0 },
{ -6201, -7680, 0, 0 },
{ -7832, -7680, 0, 0 },
{ -9359, -7680, 0, 0 },
{ -10764, -7680, 0, 0 },
{ -12028, -7680, 0, 0 },
{ -13133, -7680, 0, 0 },
{ -13920, -7522, 0, 0 },
{ -14507, -7366, 0, 0 },
{ -14731, -7059, 0, 0 },
{ 5376, -9216, 3328, -3072 },
{ -6400, -7168, -3328, -2304 },
{ -10496, -7424, -3584, -1024 },
{ -167, -2722, -494, -541 },
{ -7430, -2221, -2298, 424 },
{ -8001, -3166, -2814, 289 },
{ 6018, -4750, 2649, -1298 },
{ 3798, -6946, 3875, -1216 },
{ -8237, -2596, -2071, 227 },
{ 9199, 1982, -1382, -2316 },
{ 13021, -3044, -3792, 1267 },
{ 13112, -4487, -2250, 1665 },
{ -1668, -3744, -6456, 840 },
{ 7819, -4328, 2111, -506 },
{ 9571, -1336, -757, 487 },
{ 10032, -2562, 300, 199 },
{ -4745, -4122, -5486, -1493 },
{ -5896, 2378, -4787, -6947 },
{ -1193, -9117, -1237, -3114 },
{ 2783, -7108, -1575, -1447 },
{ -7334, -2062, -2212, 446 },
{ 6127, -2577, -315, -18 },
{ 9457, -1858, 102, 258 },
{ 7876, -4483, 2126, -538 },
{ -7172, -1795, -2069, 482 },
{ -7358, -2102, -2233, 440 },
{ -9170, -3509, -2674, -391 },
{ -2638, -2647, -1929, -1637 },
{ 1873, 9183, 1860, -5746 },
{ 9214, 1859, -1124, -2427 },
{ 13204, -3012, -4139, 1370 },
{ 12437, -4792, -256, 622 },
{ -2653, -1144, -3182, -6878 },
{ 9331, -1048, -828, 507 },
{ 1642, -620, -946, -4229 },
{ 4246, -7585, -533, -2259 },
{ -8988, -3891, -2807, 44 },
{ -2562, -2735, -1730, -1899 },
{ 3182, -483, -714, -1421 },
{ 7937, -3844, 2821, -1019 },
{ 10069, -2609, 314, 195 },
{ 8400, -3297, 1551, -155 },
{ -8529, -2775, -2432, -336 },
{ 9477, -1882, 108, 256 },
{ 75, -2241, -298, -6937 },
{ -9143, -4160, -2963, 5 },
{ -7270, -1958, -2156, 460 },
{ -2740, 3745, 5936, -1089 },
{ 8993, 1948, -683, -2704 },
{ 13101, -2835, -3854, 1055 },
{ 9543, -1961, 130, 250 },
{ 5272, -4270, 3124, -3157 },
{ -7696, -3383, -2907, -456 },
{ 7309, 2523, 434, -2461 },
{ 10275, -2867, 391, 172 },
{ 10940, -3721, 665, 97 },
{ 24, -310, -1262, 320 },
{ -8122, -2411, -2311, -271 },
{ -8511, -3067, -2337, 163 },
{ 326, -3846, 419, -933 },
{ 8895, 2194, -541, -2880 },
{ 12073, -1876, -2017, -601 },
{ 8729, -3423, 1674, -169 },
{ 12950, -3847, -3007, 1946 },
{ 10038, -2570, 302, 198 },
{ 9385, -2757, 1008, 41 },
{ -4720, -5006, -2852, -1161 },
{ 7869, -4326, 2135, -501 },
{ 2450, -8597, 1299, -2780 },
{ 10192, -2763, 360, 181 },
{ 11313, -4213, 833, 53 },
{ 10154, -2716, 345, 185 },
{ 9638, -1417, -737, 482 },
{ 3854, -4554, 2843, -3397 },
{ 6699, -5659, 2249, -1074 },
{ 11082, -3908, 728, 80 },
{ -1026, -9810, -805, -3462 },
{ 10396, -3746, 1367, -96 },
{ 10287, 988, -1915, -1437 },
{ 7953, 3878, -764, -3263 },
{ 12689, -3375, -3354, 2079 },
{ 6641, 3166, 231, -2089 },
{ -2348, -7354, -1944, -4122 },
{ 9290, -4039, 1885, -246 },
{ 4633, -6403, 1748, -1619 },
{ 11247, -4125, 802, 61 },
{ 9807, -2284, 219, 222 },
{ 9736, -1536, -706, 473 },
{ 8440, -3436, 1562, -176 },
{ 9307, -1021, -835, 509 },
{ 1698, -9025, 688, -3037 },
{ 10214, -2791, 368, 179 },
{ 8390, 3248, -758, -2989 },
{ 7201, 3316, 46, -2614 },
{ -88, -7809, -538, -4571 },
{ 6193, -5189, 2760, -1245 },
{ 12325, -1290, -3284, 253 },
{ 13064, -4075, -2824, 1877 },
{ 5333, 2999, 775, -1132 }
};
/**
* Sony's VAG ADPCM, decodes 16 bytes into 28 samples.
* The first 2 bytes are a header (shift, predictor, optional flag)
* Sony's PS ADPCM (sometimes called VAG), decodes 16 bytes into 28 samples.
* The first 2 bytes are a header (shift, predictor, optional flag).
* All variants are the same with minor differences.
*
* Flags:
* 0x0: Nothing
@ -172,6 +41,8 @@ static const int16_t HEVAG_coefs[128][4] = {
* 0x7: End marker + don't decode
* 0x8+ Not valid
*/
/* default */
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -214,6 +85,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
stream->adpcm_history2_32=hist2;
}
/* encrypted */
void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -259,8 +131,7 @@ void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
stream->adpcm_history2_32=hist2;
}
/* some TAITO games have garbage (?) in their flags, this decoder
* just ignores that byte */
/* some games have garbage (?) in their flags, this decoder just ignores that byte */
void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -295,82 +166,8 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel
}
/**
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
* Variation of the regular VAG, uses 4 history samples and a bigger table.
*
* Original research and algorithm by id-daemon / daemon1.
*/
void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
uint8_t predict_nr, shift, flag, byte;
int32_t scale = 0;
int32_t sample;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int32_t hist3 = stream->adpcm_history3_32;
int32_t hist4 = stream->adpcm_history4_32;
int i, sample_count;
int framesin = first_sample / 28;
/* 4 byte header: predictor = 3rd and 1st, shift = 2nd, flag = 4th */
byte = (uint8_t)read_8bit(stream->offset+framesin*16+0,stream->streamfile);
predict_nr = byte >> 4;
shift = byte & 0x0f;
byte = (uint8_t)read_8bit(stream->offset+framesin*16+1,stream->streamfile);
predict_nr = (byte & 0xF0) | predict_nr;
flag = byte & 0x0f; /* no change in flags */
first_sample = first_sample % 28;
if (first_sample & 1) { /* if first sample is odd, read byte first */
byte = read_8bit(stream->offset+(framesin*16)+2+first_sample/2,stream->streamfile);
}
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
sample = 0;
if (flag < 7 && predict_nr < 128) {
if (i & 1) {/* odd/even nibble */
scale = byte >> 4;
} else {
byte = read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
scale = byte & 0x0f;
}
if (scale > 7) { /* sign extend */
scale = scale - 16;
}
sample = (hist1 * HEVAG_coefs[predict_nr][0] +
hist2 * HEVAG_coefs[predict_nr][1] +
hist3 * HEVAG_coefs[predict_nr][2] +
hist4 * HEVAG_coefs[predict_nr][3] ) / 32;
sample = (sample + (scale << (20 - shift)) + 128) >> 8;
}
outbuf[sample_count] = clamp16(sample);
hist4 = hist3;
hist3 = hist2;
hist2 = hist1;
hist1 = sample;
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
stream->adpcm_history3_32 = hist3;
stream->adpcm_history4_32 = hist4;
}
/**
* PS ADPCM of configurable size, with no flag.
* Found in PS3 Afrika (SGXD type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33.
*/
/* configurable frame size, with no flag
* Found in PS3 Afrika (SGXD type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33. */
void decode_psx_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) {
uint8_t predict_nr, shift, byte;
int16_t scale = 0;

View File

@ -0,0 +1,11 @@
## audacious-vgmstream automake script
noinst_LTLIBRARIES = liblayout.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.audacious
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
liblayout_la_LDFLAGS =
liblayout_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

View File

@ -1,41 +0,0 @@
noinst_LTLIBRARIES = liblayout.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
liblayout_la_LDFLAGS =
liblayout_la_SOURCES =
liblayout_la_SOURCES += ast_blocked.c
liblayout_la_SOURCES += blocked.c
liblayout_la_SOURCES += caf_blocked.c
liblayout_la_SOURCES += ea_block.c
liblayout_la_SOURCES += halpst_blocked.c
liblayout_la_SOURCES += interleave.c
liblayout_la_SOURCES += nolayout.c
liblayout_la_SOURCES += xa_blocked.c
liblayout_la_SOURCES += wsi_blocked.c
liblayout_la_SOURCES += str_snds_blocked.c
liblayout_la_SOURCES += ws_aud_blocked.c
liblayout_la_SOURCES += interleave_byte.c
liblayout_la_SOURCES += mus_acm_layout.c
liblayout_la_SOURCES += aix_layout.c
liblayout_la_SOURCES += ims_block.c
liblayout_la_SOURCES += de2_blocked.c
liblayout_la_SOURCES += xvas_block.c
liblayout_la_SOURCES += vs_blocked.c
liblayout_la_SOURCES += emff_blocked.c
liblayout_la_SOURCES += thp_blocked.c
liblayout_la_SOURCES += gsb_blocked.c
liblayout_la_SOURCES += filp_blocked.c
liblayout_la_SOURCES += aax_layout.c
liblayout_la_SOURCES += ivaud_layout.c
liblayout_la_SOURCES += mxch_blocked.c
liblayout_la_SOURCES += psx_mgav_blocked.c
liblayout_la_SOURCES += ps2_adm_blocked.c
liblayout_la_SOURCES += bdsp_blocked.c
liblayout_la_SOURCES += tra_blocked.c
liblayout_la_SOURCES += ps2_iab_blocked.c
liblayout_la_SOURCES += ps2_strlr_blocked.c
liblayout_la_SOURCES += scd_int_layout.c
EXTRA_DIST = layout.h

View File

@ -586,10 +586,6 @@
RelativePath=".\meta\ngc_tydsp.c"
>
</File>
<File
RelativePath=".\meta\ngc_waa_wac_wad_wam.c"
>
</File>
<File
RelativePath=".\meta\ngc_ymf.c"
>
@ -1130,6 +1126,10 @@
RelativePath=".\meta\vsf.c"
>
</File>
<File
RelativePath=".\meta\waa_wac_wad_wam.c"
>
</File>
<File
RelativePath=".\meta\wii_bns.c"
>
@ -1382,6 +1382,10 @@
RelativePath=".\coding\pcm_decoder.c"
>
</File>
<File
RelativePath=".\coding\psv_decoder.c"
>
</File>
<File
RelativePath=".\coding\psx_decoder.c"
>

View File

@ -262,7 +262,6 @@
<ClCompile Include="meta\ngc_sck_dsp.c" />
<ClCompile Include="meta\ngc_ssm.c" />
<ClCompile Include="meta\ngc_tydsp.c" />
<ClCompile Include="meta\ngc_waa_wac_wad_wam.c" />
<ClCompile Include="meta\ngc_ymf.c" />
<ClCompile Include="meta\nwa.c" />
<ClCompile Include="meta\ogg_vorbis_file.c" />
@ -378,6 +377,7 @@
<ClCompile Include="meta\ubi_raki.c" />
<ClCompile Include="meta\vs.c" />
<ClCompile Include="meta\vsf.c" />
<ClCompile Include="meta\waa_wac_wad_wam.c" />
<ClCompile Include="meta\wii_bns.c" />
<ClCompile Include="meta\wii_mus.c" />
<ClCompile Include="meta\wii_smp.c" />
@ -424,6 +424,7 @@
<ClCompile Include="coding\ogg_vorbis_decoder.c" />
<ClCompile Include="coding\ogl_vorbis_decoder.c" />
<ClCompile Include="coding\pcm_decoder.c" />
<ClCompile Include="coding\psv_decoder.c" />
<ClCompile Include="coding\psx_decoder.c" />
<ClCompile Include="coding\SASSC_decoder.c" />
<ClCompile Include="coding\sdx2_decoder.c" />

View File

@ -337,9 +337,6 @@
<ClCompile Include="meta\ngc_tydsp.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ngc_waa_wac_wad_wam.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ngc_ymf.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
@ -685,6 +682,9 @@
<ClCompile Include="meta\vsf.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\waa_wac_wad_wam.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\wii_bns.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
@ -817,6 +817,9 @@
<ClCompile Include="coding\pcm_decoder.c">
<Filter>coding\Source Files</Filter>
</ClCompile>
<ClCompile Include="coding\psv_decoder.c">
<Filter>coding\Source Files</Filter>
</ClCompile>
<ClCompile Include="coding\psx_decoder.c">
<Filter>coding\Source Files</Filter>
</ClCompile>

View File

@ -0,0 +1,11 @@
## audacious-vgmstream automake script
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -Wall @CFLAGS@ -DVAR_ARRAYS -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.audacious
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libmeta_la_LDFLAGS =
libmeta_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

View File

@ -1,265 +0,0 @@
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -Wall @CFLAGS@ -DVAR_ARRAYS -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libmeta_la_LDFLAGS =
libmeta_la_SOURCES =
libmeta_la_SOURCES += Cstr.c
libmeta_la_SOURCES += adx.c
libmeta_la_SOURCES += afc_header.c
libmeta_la_SOURCES += agsc.c
libmeta_la_SOURCES += ast.c
libmeta_la_SOURCES += brstm.c
libmeta_la_SOURCES += ea_header.c
libmeta_la_SOURCES += gcsw.c halpst.c
libmeta_la_SOURCES += nds_strm.c
libmeta_la_SOURCES += ngc_adpdtk.c
libmeta_la_SOURCES += ngc_caf.c
libmeta_la_SOURCES += ngc_dsp_std.c
libmeta_la_SOURCES += ps2_ads.c
libmeta_la_SOURCES += ps2_exst.c
libmeta_la_SOURCES += ps2_ild.c
libmeta_la_SOURCES += ps2_int.c
libmeta_la_SOURCES += ps2_mib.c
libmeta_la_SOURCES += ps2_mic.c
libmeta_la_SOURCES += ps2_npsf.c
libmeta_la_SOURCES += ps2_pnb.c
libmeta_la_SOURCES += ps2_rxw.c
libmeta_la_SOURCES += ps2_str.c
libmeta_la_SOURCES += ps2_svag.c
libmeta_la_SOURCES += ps2_vag.c
libmeta_la_SOURCES += ps2_vpk.c
libmeta_la_SOURCES += psx_cdxa.c
libmeta_la_SOURCES += raw.c
libmeta_la_SOURCES += rs03.c
libmeta_la_SOURCES += rsf.c
libmeta_la_SOURCES += rwsd.c
libmeta_la_SOURCES += psx_gms.c
libmeta_la_SOURCES += xbox_xwav.c
libmeta_la_SOURCES += xbox_wavm.c
libmeta_la_SOURCES += genh.c
libmeta_la_SOURCES += ogg_vorbis_file.c
libmeta_la_SOURCES += ps2_bmdx.c
libmeta_la_SOURCES += aifc.c
libmeta_la_SOURCES += str_snds.c
libmeta_la_SOURCES += ws_aud.c
libmeta_la_SOURCES += ahx.c
libmeta_la_SOURCES += ivb.c
libmeta_la_SOURCES += svs.c
libmeta_la_SOURCES += riff.c
libmeta_la_SOURCES += pos.c
libmeta_la_SOURCES += nwa.c
libmeta_la_SOURCES += ps2_rws.c
libmeta_la_SOURCES += ps2_hgc1.c
libmeta_la_SOURCES += xss.c
libmeta_la_SOURCES += ps2_sl3.c
libmeta_la_SOURCES += ps2_aus.c
libmeta_la_SOURCES += fsb.c
libmeta_la_SOURCES += fsb5.c
libmeta_la_SOURCES += rsd.c
libmeta_la_SOURCES += rwx.c
libmeta_la_SOURCES += xwb.c
libmeta_la_SOURCES += ea_old.c
libmeta_la_SOURCES += ps2_xa30.c
libmeta_la_SOURCES += musc.c
libmeta_la_SOURCES += ps2_leg.c
libmeta_la_SOURCES += ps2_filp.c
libmeta_la_SOURCES += ps2_ikm.c
libmeta_la_SOURCES += musx.c
libmeta_la_SOURCES += ps2_sfs.c
libmeta_la_SOURCES += sat_dvi.c
libmeta_la_SOURCES += ps2_bg00.c
libmeta_la_SOURCES += dc_kcey.c
libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c
libmeta_la_SOURCES += ps2_psh.c
libmeta_la_SOURCES += mus_acm.c
libmeta_la_SOURCES += sli.c
libmeta_la_SOURCES += sfl.c
libmeta_la_SOURCES += pcm.c
libmeta_la_SOURCES += ps2_psw.c
libmeta_la_SOURCES += rkv.c
libmeta_la_SOURCES += ps2_vas.c
libmeta_la_SOURCES += ps2_tec.c
libmeta_la_SOURCES += ps2_enth.c
libmeta_la_SOURCES += sdt.c
libmeta_la_SOURCES += aix.c
libmeta_la_SOURCES += ngc_tydsp.c
libmeta_la_SOURCES += wvs.c
libmeta_la_SOURCES += xbox_stma.c
libmeta_la_SOURCES += xbox_ims.c
libmeta_la_SOURCES += de2.c
libmeta_la_SOURCES += dc_str.c
libmeta_la_SOURCES += xbox_xmu.c
libmeta_la_SOURCES += ngc_bh2pcm.c
libmeta_la_SOURCES += sat_sap.c
libmeta_la_SOURCES += dc_idvi.c
libmeta_la_SOURCES += ps2_rnd.c
libmeta_la_SOURCES += xbox_xvas.c
libmeta_la_SOURCES += kraw.c
libmeta_la_SOURCES += ps2_xa2.c
libmeta_la_SOURCES += idsp.c
libmeta_la_SOURCES += ngc_ymf.c
libmeta_la_SOURCES += nds_sad.c
libmeta_la_SOURCES += ps2_ccc.c
libmeta_la_SOURCES += psx_fag.c
libmeta_la_SOURCES += ps2_mihb.c
libmeta_la_SOURCES += ngc_pdt.c
libmeta_la_SOURCES += wii_mus.c
libmeta_la_SOURCES += dc_asd.c
libmeta_la_SOURCES += naomi_spsd.c
libmeta_la_SOURCES += bgw.c
libmeta_la_SOURCES += ps2_ass.c
libmeta_la_SOURCES += ngc_waa_wac_wad_wam.c
libmeta_la_SOURCES += seg.c
libmeta_la_SOURCES += str_asr.c
libmeta_la_SOURCES += zwdsp.c
libmeta_la_SOURCES += gca.c
libmeta_la_SOURCES += ish_isd.c
libmeta_la_SOURCES += spt_spd.c
libmeta_la_SOURCES += ydsp.c
libmeta_la_SOURCES += gsp_gsb.c
libmeta_la_SOURCES += ngc_ssm.c
libmeta_la_SOURCES += msvp.c
libmeta_la_SOURCES += ps2_joe.c
libmeta_la_SOURCES += vs.c
libmeta_la_SOURCES += vgs.c
libmeta_la_SOURCES += dc_dcsw_dcs.c
libmeta_la_SOURCES += wii_smp.c
libmeta_la_SOURCES += ss_stream.c
libmeta_la_SOURCES += emff.c
libmeta_la_SOURCES += thp.c
libmeta_la_SOURCES += wii_sts.c
libmeta_la_SOURCES += capdsp.c
libmeta_la_SOURCES += wii_sng.c
libmeta_la_SOURCES += aax.c
libmeta_la_SOURCES += ps2_p2bt.c
libmeta_la_SOURCES += ps2_gbts.c
libmeta_la_SOURCES += ngc_ffcc_str.c
libmeta_la_SOURCES += sat_baka.c
libmeta_la_SOURCES += nds_swav.c
libmeta_la_SOURCES += vsf.c
libmeta_la_SOURCES += nds_rrds.c
libmeta_la_SOURCES += ps2_tk5.c
libmeta_la_SOURCES += ads.c
libmeta_la_SOURCES += wii_str.c
libmeta_la_SOURCES += zsd.c
libmeta_la_SOURCES += ps2_mcg.c
libmeta_la_SOURCES += redspark.c
libmeta_la_SOURCES += ivaud.c
libmeta_la_SOURCES += ps2_vgs.c
libmeta_la_SOURCES += ps2_sps.c
libmeta_la_SOURCES += nds_hwas.c
libmeta_la_SOURCES += ngc_lps.c
libmeta_la_SOURCES += ps2_snd.c
libmeta_la_SOURCES += naomi_adpcm.c
libmeta_la_SOURCES += sd9.c
libmeta_la_SOURCES += 2dx9.c
libmeta_la_SOURCES += ngc_dsp_ygo.c
libmeta_la_SOURCES += ps2_vgv.c
libmeta_la_SOURCES += ngc_gcub.c
libmeta_la_SOURCES += maxis_xa.c
libmeta_la_SOURCES += ngc_sck_dsp.c
libmeta_la_SOURCES += apple_caff.c
libmeta_la_SOURCES += pc_mxst.c
libmeta_la_SOURCES += pc_sob.c
libmeta_la_SOURCES += exakt_sc.c
libmeta_la_SOURCES += wii_bns.c
libmeta_la_SOURCES += pona.c
libmeta_la_SOURCES += xbox_hlwav.c
libmeta_la_SOURCES += stx.c
libmeta_la_SOURCES += ps2_stm.c
libmeta_la_SOURCES += myspd.c
libmeta_la_SOURCES += his.c
libmeta_la_SOURCES += ps2_ast.c
libmeta_la_SOURCES += dmsg_segh.c
libmeta_la_SOURCES += ngc_dsp_konami.c
libmeta_la_SOURCES += ps2_ster.c
libmeta_la_SOURCES += bnsf.c
libmeta_la_SOURCES += ps2_wb.c
libmeta_la_SOURCES += s14_sss.c
libmeta_la_SOURCES += ps2_gcm.c
libmeta_la_SOURCES += ps2_smpl.c
libmeta_la_SOURCES += ps2_msa.c
libmeta_la_SOURCES += pc_smp.c
libmeta_la_SOURCES += p3d.c
libmeta_la_SOURCES += ps2_adsc.c
libmeta_la_SOURCES += psx_str_mgav.c
libmeta_la_SOURCES += ngc_bo2.c
libmeta_la_SOURCES += ngc_dsp_mpds.c
libmeta_la_SOURCES += ps2_khv.c
libmeta_la_SOURCES += ps2_voi.c
libmeta_la_SOURCES += dsp_sth_str.c
libmeta_la_SOURCES += ps2_b1s.c
libmeta_la_SOURCES += ps2_wad.c
libmeta_la_SOURCES += ps2_lpcm.c
libmeta_la_SOURCES += ps2_adm.c
libmeta_la_SOURCES += dsp_bdsp.c
libmeta_la_SOURCES += ps2_vms.c
libmeta_la_SOURCES += ps2_xau.c
libmeta_la_SOURCES += gh3_bar.c
libmeta_la_SOURCES += ffw.c
libmeta_la_SOURCES += ps2_jstm.c
libmeta_la_SOURCES += ps3_xvag.c
libmeta_la_SOURCES += ps3_cps.c
libmeta_la_SOURCES += sqex_scd.c
libmeta_la_SOURCES += ngc_nst_dsp.c
libmeta_la_SOURCES += baf.c
libmeta_la_SOURCES += ps3_msf.c
libmeta_la_SOURCES += nub_vag.c
libmeta_la_SOURCES += ps3_past.c
libmeta_la_SOURCES += sgxd.c
libmeta_la_SOURCES += ngca.c
libmeta_la_SOURCES += wii_ras.c
libmeta_la_SOURCES += ps2_spm.c
libmeta_la_SOURCES += x360_tra.c
libmeta_la_SOURCES += ps2_iab.c
libmeta_la_SOURCES += ps2_strlr.c
libmeta_la_SOURCES += lsf.c
libmeta_la_SOURCES += vawx.c
libmeta_la_SOURCES += pc_snds.c
libmeta_la_SOURCES += ps2_wmus.c
libmeta_la_SOURCES += mattel_hyperscan.c
libmeta_la_SOURCES += ios_psnd.c
libmeta_la_SOURCES += pc_adp.c
libmeta_la_SOURCES += excitebots.c
libmeta_la_SOURCES += ps2_mtaf.c
libmeta_la_SOURCES += ps3_klbs.c
libmeta_la_SOURCES += tun.c
libmeta_la_SOURCES += wpd.c
libmeta_la_SOURCES += mn_str.c
libmeta_la_SOURCES += ps2_mss.c
libmeta_la_SOURCES += ps2_hsf.c
libmeta_la_SOURCES += ps3_ivag.c
libmeta_la_SOURCES += ps2_2pfs.c
libmeta_la_SOURCES += ubi_ckd.c
libmeta_la_SOURCES += otm.c
libmeta_la_SOURCES += bcstm.c
libmeta_la_SOURCES += bfwav.c
libmeta_la_SOURCES += bfstm.c
libmeta_la_SOURCES += g1l.c
libmeta_la_SOURCES += ps2_vbk.c
libmeta_la_SOURCES += mca.c
libmeta_la_SOURCES += btsnd.c
libmeta_la_SOURCES += hca.c
libmeta_la_SOURCES += ps2_svag_snk.c
libmeta_la_SOURCES += mp4.c
libmeta_la_SOURCES += xma.c
libmeta_la_SOURCES += ps2_vds_vdm.c
libmeta_la_SOURCES += x360_cxs.c
libmeta_la_SOURCES += dsp_adx.c
libmeta_la_SOURCES += bik.c
libmeta_la_SOURCES += akb.c
libmeta_la_SOURCES += x360_ast.c
libmeta_la_SOURCES += wwise.c
libmeta_la_SOURCES += ubi_raki.c
libmeta_la_SOURCES += x360_pasx.c
libmeta_la_SOURCES += x360_nub.c
libmeta_la_SOURCES += sxd.c
libmeta_la_SOURCES += ogl.c
libmeta_la_SOURCES += mc3.c
EXTRA_DIST = meta.h

View File

@ -33,7 +33,7 @@ const short wad_coef[16] =
};
/* WAC - WAD - WAM (Beyond Good & Evil GC/PS2) */
/* WAC - WAD - WAM (Beyond Good & Evil GC/PS2/Xbox/Wii) */
/* Note: A "Flat Layout" has no interleave */
VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;

View File

@ -38,10 +38,10 @@ enum { PATH_LIMIT = 32768 };
#endif
#ifdef VGM_USE_G7221
#include "g7221.h"
#include <g7221.h>
#endif
#ifdef VGM_USE_G719
#include "g719.h"
#include <g719.h>
#endif
#ifdef VGM_USE_MP4V2
@ -54,7 +54,7 @@ enum { PATH_LIMIT = 32768 };
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
#include "maiatrac3plus.h"
#include <maiatrac3plus.h>
#endif
#ifdef VGM_USE_FFMPEG
@ -62,10 +62,11 @@ enum { PATH_LIMIT = 32768 };
#include <libavformat/avformat.h>
#endif
#include <clHCA.h>
#include "coding/g72x_state.h"
#include "coding/acm_decoder.h"
#include "coding/nwa_decoder.h"
#include "clHCA.h"
/* The encoding type specifies the format the sound data itself takes */

View File

@ -1 +1,4 @@
rm -rf configure AUTHORS depcomp ChangeLog config.guess ltmain.sh README config.sub autom4te.cache Makefile.unix.in INSTALL missing NEWS aclocal.m4 install-sh unix/config.h.in unix/main.loT unix/Makefile.unix.in src/Makefile.unix.in src/coding/Makefile.unix.in src/meta/Makefile.unix.in src/layout/Makefile.unix.in
#!/bin/sh
# audacious-vgmstream script - reverses the actions of bootstrap
rm -rf configure AUTHORS depcomp ChangeLog config.guess ltmain.sh README config.sub autom4te.cache Makefile.audacious.in INSTALL missing NEWS aclocal.m4 install-sh audacious/config.h.in audacious/main.loT audacious/Makefile.audacious.in src/Makefile.audacious.in src/coding/Makefile.audacious.in src/meta/Makefile.audacious.in src/layout/Makefile.audacious.in

View File

@ -1,10 +0,0 @@
lib_LTLIBRARIES = libvgmstream.la
libdir = @plugindir@/@INPUT_PLUGIN_DIR@
AM_MAKEFLAGS=-f Makefile.unix
AM_CXXFLAGS = -Wall -std=c++11 -fpermissive @CXXFLAGS@ -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/in_cube @GTK_CFLAGS@
AM_LIBS =
libvgmstream_la_LDFLAGS = -no-undefined -module -avoid-version -export-symbols-regex get_plugin_info ../src/libvgmstream.la
libvgmstream_la_SOURCES = exts.cc plugin.cc vfs.cc

View File

@ -1,285 +0,0 @@
#include <cstdlib>
#include "plugin.h"
const char *const VgmStreamPlugin::exts[] =
{
"2dx9",
"2pfs",
"aax",
"acm",
"adm",
"adp",
"adpcm",
"ads",
"adx",
"afc",
"agsc",
"ahx",
"aifc",
"aix",
"amts",
"as4",
"asd",
"asf",
"asr",
"ass",
"ast",
"aud",
"aus",
"baka",
"baf",
"bar",
"bcstm",
"bcwav",
"bfwav",
"bfwavnsmbu",
"bg00",
"bgw",
"bh2pcm",
"bmdx",
"bms",
"bns",
"bnsf",
"bo2",
"brstm",
"brstmspm",
"btsnd",
"bvg",
"caf",
"capdsp",
"cbd2",
"ccc",
"cfn",
"ckd",
"cnk",
"cps",
"dcs",
"de2",
"ddsp",
"dmsg",
"dsp",
"dspw",
"dtk",
"dvi",
"dxh",
"eam",
"emff",
"enth",
"fag",
"filp",
"fsb",
"fwav",
"gbts",
"gca",
"gcm",
"gcub",
"gcw",
"genh",
"gms",
"gsb",
"hgc1",
"his",
"hlwav",
"hps",
"hsf",
"hwas",
"iab",
"idsp",
"idvi",
"ikm",
"ild",
"int",
"isd",
"ivaud",
"ivag",
"ivb",
"joe",
"jstm",
"kces",
"kcey",
"khv",
"klbs",
"kovs",
"kraw",
"leg",
"logg",
"lpcm",
"lps",
"lsf",
"lwav",
"matx",
"mca",
"mcg",
"mi4",
"mib",
"mic",
"mihb",
"mpdsp",
"mpds",
"msa",
"msf",
"mss",
"msvp",
"mtaf",
"mus",
"musc",
"musx",
"mwv",
"mxst",
"myspd",
"ndp",
"ngca",
"npsf",
"nus3bank",
"nwa",
"omu",
"otm",
"p2bt",
"p3d",
"past",
"pcm",
"pdt",
"pnb",
"pos",
"ps2stm",
"psh",
"psnd",
"psw",
"ras",
"raw",
"rkv",
"rnd",
"rrds",
"rsd",
"rsf",
"rstm",
"rvws",
"rwar",
"rwav",
"rws",
"rwsd",
"rwx",
"rxw",
"s14",
"sab",
"sad",
"sap",
"sc",
"scd",
"sck",
"sd9",
"sdt",
"seg",
"sf0",
"sfl",
"sfs",
"sfx",
"sgb",
"sgd",
"sgx",
"sl3",
"sli",
"smp",
"smpl",
"snd",
"snds",
"sng",
"sns",
"spd",
"spm",
"sps",
"spsd",
"spw",
"ss2",
"ss3",
"ss7",
"ssm",
"sss",
"ster",
"stma",
"str",
"strm",
"sts",
"stx",
"svag",
"svs",
"swav",
"swd",
"tec",
"thp",
"tk1",
"tk5",
"tra",
"tun",
"tydsp",
"um3",
"vag",
"vas",
"vawx",
"vb",
"vbk",
"vgs",
"vgv",
"vig",
"vms",
"voi",
"vpk",
"vs",
"vsf",
"waa",
"wac",
"wad",
"wam",
"wavm",
"wb",
"wii",
"wmus",
"wp2",
"wpd",
"wsd",
"wsi",
"wvs",
"xa",
"xa2",
"xa30",
"xau",
"xmu",
"xnb",
"xsf",
"xss",
"xvag",
"xvas",
"xwav",
"xwb",
"ydsp",
"ymf",
"zsd",
"zwdsp",
/* terminator */
NULL
};

View File

@ -1,235 +0,0 @@
#include <cstdlib>
#include <algorithm>
#if DEBUG
#include <ctime>
#include <sys/time.h>
#endif
extern "C" {
#include "../src/vgmstream.h"
}
#include "plugin.h"
#include "vfs.h"
#include <libaudcore/audio.h>
VgmStreamPlugin aud_plugin_instance;
Settings vgmstream_cfg;
VGMSTREAM *vgmstream = NULL;
#define CFG_ID "vgmstream" // ID for storing in audacious
const char *const VgmStreamPlugin::defaults[] = {
"loop_forever", "1", "loop_count", "2", "fade_length",
"3", "fade_delay", "3", NULL};
const char VgmStreamPlugin::about[] =
"audacious-vgmstream version: " AUDACIOUSVGMSTREAM_VERSION "\n\n"
"ported to audacious 3.6 by Brandon Whitehead\n"
"adopted from audacious 3 port by Thomas Eppers\n"
"originally written by Todd Jeffreys (http://voidpointer.org/)\n"
"vgmstream written by hcs, FastElbja, manakoAT, and bxaimc "
"(http://www.sf.net/projects/vgmstream)";
const PreferencesWidget VgmStreamPlugin::widgets[] = {
WidgetLabel(N_("<b>VGMStream Config</b>")),
WidgetCheck(N_("Loop Forever:"), WidgetBool(vgmstream_cfg.loop_forever)),
WidgetSpin(N_("Loop Count:"), WidgetInt(vgmstream_cfg.loop_count),
{1, 20, 1}),
WidgetSpin(N_("Fade Length:"), WidgetFloat(vgmstream_cfg.fade_length),
{0, 60, 0.1}),
WidgetSpin(N_("Fade Delay:"), WidgetFloat(vgmstream_cfg.fade_delay),
{0, 60, 0.1}),
};
void vgmstream_cfg_load() {
debugMessage("cfg_load called");
aud_config_set_defaults(CFG_ID, VgmStreamPlugin::defaults);
vgmstream_cfg.loop_forever = aud_get_bool(CFG_ID, "loop_forever");
vgmstream_cfg.loop_count = aud_get_int(CFG_ID, "loop_count");
vgmstream_cfg.fade_length = aud_get_double(CFG_ID, "fade_length");
vgmstream_cfg.fade_delay = aud_get_double(CFG_ID, "fade_delay");
}
void vgmstream_cfg_save() {
debugMessage("cfg_save called");
aud_set_bool(CFG_ID, "loop_forever", vgmstream_cfg.loop_forever);
aud_set_int(CFG_ID, "loop_count", vgmstream_cfg.loop_count);
aud_set_double(CFG_ID, "fade_length", vgmstream_cfg.fade_length);
aud_set_double(CFG_ID, "fade_delay", vgmstream_cfg.fade_delay);
}
const PluginPreferences VgmStreamPlugin::prefs = {
{widgets}, vgmstream_cfg_load, vgmstream_cfg_save};
bool VgmStreamPlugin::init() {
debugMessage("init");
vgmstream_cfg_load();
debugMessage("after load cfg");
return true;
}
void VgmStreamPlugin::cleanup() {
debugMessage("cleanup");
vgmstream_cfg_save();
}
// called every time the user adds a new file to playlist
Tuple VgmStreamPlugin::read_tuple(const char *filename, VFSFile &file) {
debugMessage("probe for tuple");
Tuple tuple;
int ms;
int rate;
VGMSTREAM *vgmstream = NULL;
STREAMFILE *streamfile = NULL;
streamfile = open_vfs(filename);
vgmstream = init_vgmstream_from_STREAMFILE(streamfile);
tuple.set_filename(filename);
rate = vgmstream->sample_rate * 2 * vgmstream->channels;
tuple.set_int(Tuple::Bitrate, rate);
ms = get_vgmstream_play_samples(vgmstream_cfg.loop_count,
vgmstream_cfg.fade_length,
vgmstream_cfg.fade_delay, vgmstream) *
1000LL / vgmstream->sample_rate;
tuple.set_int(Tuple::Length, ms);
close_streamfile(streamfile);
close_vgmstream(vgmstream);
return tuple;
}
bool VgmStreamPlugin::play(const char *filename, VFSFile &file) {
int current_sample_pos = 0;
int rate;
debugMessage("start play");
STREAMFILE *streamfile = open_vfs(filename);
if (!streamfile) {
printf("failed opening %s\n", filename);
return false;
}
vgmstream = init_vgmstream_from_STREAMFILE(streamfile);
close_streamfile(streamfile);
if (!vgmstream || vgmstream->channels <= 0) {
printf("Error::Channels are zero or couldn't init plugin\n");
if (vgmstream)
close_vgmstream(vgmstream);
vgmstream = NULL;
return false;
}
short buffer[576 * vgmstream->channels];
int max_buffer_samples =
sizeof(buffer) / sizeof(buffer[0]) / vgmstream->channels;
int stream_samples_amount = get_vgmstream_play_samples(
vgmstream_cfg.loop_count, vgmstream_cfg.fade_length,
vgmstream_cfg.fade_delay, vgmstream);
rate = get_vgmstream_average_bitrate(vgmstream);
set_stream_bitrate(rate);
open_audio(FMT_S16_LE, vgmstream->sample_rate, 2);
int fade_samples = vgmstream_cfg.fade_length * vgmstream->sample_rate;
while (!check_stop()) {
int toget = max_buffer_samples;
int seek_value = check_seek();
if (seek_value > 0)
seek(seek_value, current_sample_pos);
// If we haven't configured the plugin to play forever
// or the current song is not loopable.
if (!vgmstream_cfg.loop_forever || !vgmstream->loop_flag) {
if (current_sample_pos >= stream_samples_amount)
break;
if (current_sample_pos + toget > stream_samples_amount)
toget = stream_samples_amount - current_sample_pos;
}
render_vgmstream(buffer, toget, vgmstream);
if (vgmstream->loop_flag && fade_samples > 0 &&
!vgmstream_cfg.loop_forever) {
int samples_into_fade =
current_sample_pos - (stream_samples_amount - fade_samples);
if (samples_into_fade + toget > 0) {
for (int j = 0; j < toget; j++, samples_into_fade++) {
if (samples_into_fade > 0) {
double fadedness =
(double)(fade_samples - samples_into_fade) / fade_samples;
for (int k = 0; k < vgmstream->channels; k++)
buffer[j * vgmstream->channels + k] *= fadedness;
}
}
}
}
write_audio(buffer, toget * sizeof(short) * vgmstream->channels);
current_sample_pos += toget;
}
debugMessage("finished");
if (vgmstream)
close_vgmstream(vgmstream);
vgmstream = NULL;
return true;
}
void VgmStreamPlugin::seek(int seek_value, int &current_sample_pos) {
debugMessage("seeking");
// compute from ms to samples
int seek_needed_samples =
(long long)seek_value * vgmstream->sample_rate / 1000L;
short buffer[576 * vgmstream->channels];
int max_buffer_samples =
sizeof(buffer) / sizeof(buffer[0]) / vgmstream->channels;
int samples_to_do = 0;
if (seek_needed_samples < current_sample_pos) {
// go back in time, reopen file
debugMessage("reopen file to seek backward");
reset_vgmstream(vgmstream);
current_sample_pos = 0;
samples_to_do = seek_needed_samples;
} else if (current_sample_pos < seek_needed_samples) {
// go forward in time
samples_to_do = seek_needed_samples - current_sample_pos;
}
// do the actual seeking
if (samples_to_do >= 0) {
debugMessage("render forward");
// render till seeked sample
while (samples_to_do > 0) {
int seek_samples = std::min(max_buffer_samples, samples_to_do);
current_sample_pos += seek_samples;
samples_to_do -= seek_samples;
render_vgmstream(buffer, seek_samples, vgmstream);
}
debugMessage("after render vgmstream");
}
}
void debugMessage(const char *str) {
#ifdef DEBUG
timeval curTime;
gettimeofday(&curTime, NULL);
int milli = curTime.tv_usec / 1000;
char buffer[80];
strftime(buffer, 80, "%H:%M:%S", localtime(&curTime.tv_sec));
char currentTime[84] = "";
sprintf(currentTime, "%s:%d", buffer, milli);
printf("[%s] Debug: %s\n", currentTime, str);
#endif
}

View File

@ -1,51 +0,0 @@
#ifndef __PLUGIN__
#define __PLUGIN__
#include <libaudcore/audstrings.h>
#include <libaudcore/i18n.h>
#include <libaudcore/plugin.h>
#include <libaudcore/preferences.h>
#include <libaudcore/runtime.h>
class VgmStreamPlugin : public InputPlugin {
public:
static const char *const exts[];
static const char *const defaults[];
static const char about[];
static const PreferencesWidget widgets[];
static const PluginPreferences prefs;
static constexpr PluginInfo info = {
N_("VGMStream Decoder"), N_("vgmstream"), about, &prefs,
};
static constexpr auto iinfo = InputInfo().with_exts(exts);
constexpr VgmStreamPlugin() : InputPlugin(info, iinfo) {}
bool init();
void cleanup();
bool is_our_file(const char *filename, VFSFile &file) { return false; }
Tuple read_tuple(const char *filename, VFSFile &file);
bool play(const char *filename, VFSFile &file);
private:
void seek(int seek_value, int &current_sample_pos);
};
typedef struct {
bool loop_forever;
int loop_count;
double fade_length;
double fade_delay;
} Settings;
extern Settings vgmstream_cfg;
void debugMessage(const char *str);
void vgmstream_cfg_load();
void vgmstream_cfg_save();
#define AUDACIOUSVGMSTREAM_VERSION "1.2.0"
#endif

View File

@ -29,7 +29,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_component_client
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pfc", "..\foobar\pfc\pfc.vcxproj", "{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmp-vgmstream", "xmp-vgmstream\xmp-vgmstream.vcxproj", "{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmp-vgmstream", "xmplay\xmp-vgmstream.vcxproj", "{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,15 +1,11 @@
/* Winamp plugin interface for vgmstream */
/* Based on: */
/*
** Example Winamp .RAW input plug-in
** Copyright (c) 1998, Justin Frankel/Nullsoft Inc.
*/
/**
* vgmstream for Winamp
*/
/* Winamp uses wchar_t filenames when this is on, so extra steps are needed.
* To open unicode filenames it needs to use _wfopen, inside a WA_STREAMFILE to pass around */
//#define UNICODE_INPUT_PLUGIN
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#endif
@ -200,8 +196,12 @@ static void copy_title(in_char * dst, int dst_size, const in_char * src) {
void about(HWND hwndParent) {
MessageBox(hwndParent,
PLUGIN_DESCRIPTION "\n"
"by hcs, FastElbja, manakoAT, bxaimc, and snakemeat\n\n"
"http://sourceforge.net/projects/vgmstream"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n"
"\n"
"Winamp plugin by hcs, others\n"
"\n"
"https://github.com/kode54/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)"
,"about in_vgmstream",MB_OK);
}

View File

@ -1,23 +0,0 @@
# intellisense crap
ipch
# more intellisense crap
xmp-vgmstream.sdf
xmp-vgmstream.opensdf
xmp-vgmstream.suo
xmp-vgmstream.v11.suo
xmp-vgmstream.v12.suo
# output directories
Debug
Release
# and some debugging symbol crap
*.pdb
# new for Visual Studio 2015
.vs
*.VC.db
# auto generated
version.h

View File

@ -1,68 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmp-vgmstream", "xmp-vgmstream.vcxproj", "{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ext_libs", "..\ext_libs\ext_libs.vcxproj", "{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvgmstream", "..\src\libvgmstream.vcxproj", "{54A6AD11-5369-4895-A06F-E255ABB99B11}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4v2", "..\..\qaac\vcproject\mp4v2\mp4v2.vcxproj", "{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fdk-aac", "..\..\fdk-aac\msvc\fdk-aac.vcxproj", "{308E2AD5-BE31-4770-9441-A8D50F56895C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Debug|x64.ActiveCfg = Debug|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Debug|x64.Build.0 = Debug|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Debug|x86.ActiveCfg = Debug|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Debug|x86.Build.0 = Debug|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Release|x64.ActiveCfg = Release|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Release|x64.Build.0 = Release|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Release|x86.ActiveCfg = Release|Win32
{49AF76F7-CBA0-4486-9DDF-51F30DF45F33}.Release|x86.Build.0 = Release|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Debug|x64.ActiveCfg = Debug|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Debug|x64.Build.0 = Debug|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Debug|x86.ActiveCfg = Debug|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Debug|x86.Build.0 = Debug|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Release|x64.ActiveCfg = Release|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Release|x64.Build.0 = Release|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Release|x86.ActiveCfg = Release|Win32
{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}.Release|x86.Build.0 = Release|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Debug|x64.ActiveCfg = Debug|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Debug|x64.Build.0 = Debug|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Debug|x86.ActiveCfg = Debug|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Debug|x86.Build.0 = Debug|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Release|x64.ActiveCfg = Release|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Release|x64.Build.0 = Release|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Release|x86.ActiveCfg = Release|Win32
{54A6AD11-5369-4895-A06F-E255ABB99B11}.Release|x86.Build.0 = Release|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Debug|x64.ActiveCfg = Debug|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Debug|x64.Build.0 = Debug|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Debug|x86.ActiveCfg = Debug|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Debug|x86.Build.0 = Debug|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Release|x64.ActiveCfg = Release|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Release|x64.Build.0 = Release|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Release|x86.ActiveCfg = Release|Win32
{86A064E2-C81B-4EEE-8BE0-A39A2E7C7C76}.Release|x86.Build.0 = Release|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Debug|x64.ActiveCfg = Debug|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Debug|x64.Build.0 = Debug|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Debug|x86.ActiveCfg = Debug|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Debug|x86.Build.0 = Debug|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Release|x64.ActiveCfg = Release|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Release|x64.Build.0 = Release|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Release|x86.ActiveCfg = Release|Win32
{308E2AD5-BE31-4770-9441-A8D50F56895C}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -32,7 +32,7 @@ export STRIP=strip
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a libavcodec.a libavformat.a libavutil.a
xmp-vgmstream.dll: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a libavcodec.a libavformat.a libavutil.a
$(CC) -shared -static-libgcc $(CFLAGS) "-DVERSION=\"`../version.sh`\"" DllMain.c $(LDFLAGS) -o xmp-vgmstream.dll xmpin.def
$(CC) -shared -static-libgcc $(CFLAGS) "-DVERSION=\"`../version.sh`\"" xmp_vgmstream.c $(LDFLAGS) -o xmp-vgmstream.dll xmpin.def
$(STRIP) xmp-vgmstream.dll
libvgmstream.a:

View File

@ -113,7 +113,7 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DllMain.c" />
<ClCompile Include="xmp_vgmstream.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="xmpfunc.h" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="DllMain.c" />
<ClCompile Include="xmp_vgmstream.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="xmpfunc.h" />

View File

@ -15,6 +15,7 @@
#include "../src/vgmstream.h"
#include "xmpin.h"
#ifndef VERSION
#include "../version.h"
#endif
@ -26,6 +27,8 @@ static XMPFUNC_IN *xmpfin;
static XMPFUNC_MISC *xmpfmisc;
static XMPFUNC_FILE *xmpffile;
/* ************************************* */
typedef struct _XMPSTREAMFILE {
STREAMFILE sf;
XMPFILE file;
@ -69,8 +72,11 @@ static size_t xmpsf_read(XMPSTREAMFILE *this, uint8_t *dest, off_t offset, size_
static void xmpsf_close(XMPSTREAMFILE *this)
{
// The line below is what Causes this Plugin to Crash. Credits to Ian Luck to Finding this issue.
// xmpffile->Close(this->file);
// The line below is what Causes this Plugin to Crash. Credits to Ian Luck to Finding this issue.
// This closes the internal XMPFILE, which must be done by XMPlay instead.
// However vgmtream sometimes opens its own files, so it may be leaking handles.
//xmpffile->Close(this->file);
free(this);
}
@ -148,17 +154,23 @@ err1:
return NULL;
}
/* ************************************* */
/* internal state */
VGMSTREAM * vgmstream = NULL;
int32_t totalFrames, framesDone, framesLength, framesFade;
#define APP_NAME "vgmstream plugin"
#define PLUGIN_DESCRIPTION "vgmstream plugin " VERSION " " __DATE__
#define APP_NAME "vgmstream plugin" //unused?
void __stdcall XMP_About(HWND hwParent) {
MessageBox(hwParent,
PLUGIN_DESCRIPTION "\n"
"by hcs, FastElbja, manakoAT, bxaimc, kode54, and PSXGamerPro1\n\n"
"https://gitlab.kode54.net/kode54/vgmstream"
"vgmstream plugin " VERSION " " __DATE__ "\n"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n"
"\n"
"XMPlay plugin by unknownfile, PSXGamerPro1, kode54\n"
"\n"
"https://github.com/kode54/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)"
,"about xmp-vgmstream",MB_OK);
}