mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-01 01:27:20 +01:00
Merge pull request #18 from TricksterGuy/master
Update audacious plugin for audacious 3.6
This commit is contained in:
commit
5e18b99484
@ -7,4 +7,4 @@ AM_CXXFLAGS = -Wall -std=c++11 -fpermissive @CXXFLAGS@ -I$(top_builddir) -I$(top
|
||||
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 settings.cc vfs.cc
|
||||
libvgmstream_la_SOURCES = exts.cc plugin.cc vfs.cc
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include <cstdlib>
|
||||
#include "plugin.h"
|
||||
|
||||
#include "exts.h"
|
||||
|
||||
const char *vgmstream_exts[] =
|
||||
const char *const VgmStreamPlugin::exts[] =
|
||||
{
|
||||
"2dx9",
|
||||
"2pfs",
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef __EXTS__
|
||||
#define __EXTS__
|
||||
|
||||
extern const char *vgmstream_exts[];
|
||||
|
||||
#endif
|
323
unix/plugin.cc
323
unix/plugin.cc
@ -1,36 +1,74 @@
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
#include <libaudcore/input.h>
|
||||
#include <libaudcore/plugin.h>
|
||||
#include <libaudcore/runtime.h>
|
||||
#if DEBUG
|
||||
#include <ctime>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "../src/vgmstream.h"
|
||||
}
|
||||
#include "version.h"
|
||||
#include "plugin.h"
|
||||
#include "vfs.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <libaudcore/audio.h>
|
||||
|
||||
EXPORT VgmStreamPlugin aud_plugin_instance;
|
||||
Settings vgmstream_cfg;
|
||||
VGMSTREAM *vgmstream = NULL;
|
||||
#define CFG_ID "vgmstream" //ID for storing in audacious
|
||||
|
||||
// //default-values for Settings
|
||||
#define DEFAULT_LOOP_FOREVER "1"
|
||||
#define DEFAULT_FADE_LENGTH "3"
|
||||
#define DEFAULT_FADE_DELAY "3"
|
||||
#define DEFAULT_LOOP_COUNT "2"
|
||||
|
||||
static const char* const defaults[] =
|
||||
const char* const VgmStreamPlugin::defaults[] =
|
||||
{
|
||||
"loop_forever", DEFAULT_LOOP_FOREVER,
|
||||
"loop_count", DEFAULT_LOOP_COUNT,
|
||||
"fade_length", DEFAULT_FADE_LENGTH,
|
||||
"fade_delay", DEFAULT_FADE_DELAY,
|
||||
"loop_forever", "1",
|
||||
"loop_count", "2",
|
||||
"fade_length", "3",
|
||||
"fade_delay", "3",
|
||||
NULL
|
||||
};
|
||||
|
||||
bool vgmstream_init()
|
||||
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();
|
||||
@ -38,13 +76,123 @@ bool vgmstream_init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void vgmstream_cleanup()
|
||||
void VgmStreamPlugin::cleanup()
|
||||
{
|
||||
debugMessage("cleanup");
|
||||
vgmstream_cfg_save();
|
||||
}
|
||||
|
||||
void vgmstream_seek(int seek_value, int& current_sample_pos)
|
||||
// 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
|
||||
@ -84,133 +232,18 @@ void vgmstream_seek(int seek_value, int& current_sample_pos)
|
||||
}
|
||||
}
|
||||
|
||||
bool vgmstream_play(const char * filename, VFSFile * file)
|
||||
void debugMessage(const char *str)
|
||||
{
|
||||
int current_sample_pos = 0;
|
||||
int rate;
|
||||
#ifdef DEBUG
|
||||
timeval curTime;
|
||||
gettimeofday(&curTime, NULL);
|
||||
int milli = curTime.tv_usec / 1000;
|
||||
|
||||
debugMessage("start play");
|
||||
STREAMFILE* streamfile = open_vfs(filename);
|
||||
char buffer [80];
|
||||
strftime(buffer, 80, "%H:%M:%S", localtime(&curTime.tv_sec));
|
||||
|
||||
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);
|
||||
|
||||
aud_input_set_bitrate(rate);
|
||||
|
||||
if (!aud_input_open_audio(FMT_S16_LE, vgmstream->sample_rate, 2))
|
||||
return false;
|
||||
|
||||
int fade_samples = vgmstream_cfg.fade_length * vgmstream->sample_rate;
|
||||
while (!aud_input_check_stop())
|
||||
{
|
||||
int toget = max_buffer_samples;
|
||||
|
||||
int seek_value = aud_input_check_seek();
|
||||
if (seek_value > 0)
|
||||
vgmstream_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aud_input_write_audio(buffer, toget * sizeof(short) * vgmstream->channels);
|
||||
current_sample_pos += toget;
|
||||
}
|
||||
|
||||
debugMessage("finished");
|
||||
if (vgmstream)
|
||||
close_vgmstream(vgmstream);
|
||||
vgmstream = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
// called every time the user adds a new file to playlist
|
||||
Tuple vgmstream_probe_for_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(FIELD_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(FIELD_LENGTH, ms);
|
||||
|
||||
close_streamfile(streamfile);
|
||||
close_vgmstream(vgmstream);
|
||||
|
||||
return tuple;
|
||||
}
|
||||
|
||||
void vgmstream_cfg_load()
|
||||
{
|
||||
debugMessage("cfg_load called");
|
||||
aud_config_set_defaults(CFG_ID, 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);
|
||||
char currentTime[84] = "";
|
||||
sprintf(currentTime, "%s:%d", buffer, milli);
|
||||
printf("[%s] Debug: %s\n", currentTime, str);
|
||||
#endif
|
||||
}
|
||||
|
57
unix/plugin.h
Normal file
57
unix/plugin.h
Normal file
@ -0,0 +1,57 @@
|
||||
#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
|
@ -1,75 +0,0 @@
|
||||
#include "settings.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <libaudcore/plugin.h>
|
||||
#include <libaudcore/i18n.h>
|
||||
#include <libaudcore/preferences.h>
|
||||
|
||||
#include "../src/vgmstream.h"
|
||||
#include "exts.h"
|
||||
#include "version.h"
|
||||
#include "vfs.h"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Settings vgmstream_cfg;
|
||||
|
||||
bool vgmstream_init();
|
||||
void vgmstream_cleanup();
|
||||
|
||||
Tuple vgmstream_probe_for_tuple(const char *uri, VFSFile *fd);
|
||||
void vgmstream_play(const char *filename, VFSFile * file);
|
||||
|
||||
const char vgmstream_about[] =
|
||||
{
|
||||
"audacious-vgmstream version: " AUDACIOUSVGMSTREAM_VERSION "\n\n"
|
||||
"ported to audacious 3.5.1 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)"
|
||||
};
|
||||
|
||||
static const PreferencesWidget vgmstream_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}),
|
||||
};
|
||||
|
||||
static const PluginPreferences vgmstream_prefs = {
|
||||
{vgmstream_widgets},
|
||||
vgmstream_cfg_load,
|
||||
vgmstream_cfg_save
|
||||
};
|
||||
|
||||
|
||||
#define AUD_PLUGIN_NAME N_("VGMStream Decoder")
|
||||
#define AUD_PLUGIN_DOMAIN "vgmstream"
|
||||
#define AUD_PLUGIN_ABOUT vgmstream_about
|
||||
#define AUD_PLUGIN_INIT vgmstream_init
|
||||
#define AUD_PLUGIN_CLEANUP vgmstream_cleanup
|
||||
#define AUD_PLUGIN_PREFS & vgmstream_prefs
|
||||
#define AUD_INPUT_IS_OUR_FILE nullptr
|
||||
#define AUD_INPUT_PLAY vgmstream_play
|
||||
#define AUD_INPUT_READ_TUPLE vgmstream_probe_for_tuple
|
||||
#define AUD_INPUT_EXTS vgmstream_exts
|
||||
|
||||
#define AUD_DECLARE_INPUT
|
||||
#include <libaudcore/plugin-declare.h>
|
@ -1,18 +0,0 @@
|
||||
#ifndef __SETTINGS__
|
||||
#define __SETTINGS__
|
||||
|
||||
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
|
@ -1,6 +0,0 @@
|
||||
#ifndef __VERSION_H__
|
||||
#define __VERSION_H__
|
||||
|
||||
#define AUDACIOUSVGMSTREAM_VERSION "1.1.0"
|
||||
|
||||
#endif
|
15
unix/vfs.cc
15
unix/vfs.cc
@ -4,9 +4,8 @@
|
||||
#include <libaudcore/plugin.h>
|
||||
|
||||
#include "../src/vgmstream.h"
|
||||
#include "version.h"
|
||||
#include "plugin.h"
|
||||
#include "vfs.h"
|
||||
#include "settings.h"
|
||||
|
||||
typedef struct _VFSSTREAMFILE
|
||||
{
|
||||
@ -25,11 +24,11 @@ static size_t read_vfs(VFSSTREAMFILE *streamfile, uint8_t *dest, off_t offset, s
|
||||
// if the offsets don't match, then we need to perform a seek
|
||||
if (streamfile->offset != offset)
|
||||
{
|
||||
vfs_fseek(streamfile->vfsFile, offset, SEEK_SET);
|
||||
streamfile->vfsFile->fseek(offset, VFS_SEEK_SET);
|
||||
streamfile->offset = offset;
|
||||
}
|
||||
|
||||
sz = vfs_fread(dest, 1, length, streamfile->vfsFile);
|
||||
sz = streamfile->vfsFile->fread(dest, 1, length);
|
||||
// increment our current offset
|
||||
streamfile->offset += sz;
|
||||
|
||||
@ -39,13 +38,13 @@ static size_t read_vfs(VFSSTREAMFILE *streamfile, uint8_t *dest, off_t offset, s
|
||||
static void close_vfs(VFSSTREAMFILE *streamfile)
|
||||
{
|
||||
debugMessage("close_vfs");
|
||||
vfs_fclose(streamfile->vfsFile);
|
||||
free(streamfile->vfsFile);
|
||||
free(streamfile);
|
||||
}
|
||||
|
||||
static size_t get_size_vfs(VFSSTREAMFILE *streamfile)
|
||||
{
|
||||
return vfs_fsize(streamfile->vfsFile);
|
||||
return streamfile->vfsFile->fsize();
|
||||
}
|
||||
|
||||
static size_t get_offset_vfs(VFSSTREAMFILE *streamfile)
|
||||
@ -73,7 +72,7 @@ static STREAMFILE *open_vfs_impl(VFSSTREAMFILE *streamfile, const char * const f
|
||||
return open_vfs(filename);
|
||||
}
|
||||
|
||||
static STREAMFILE *open_vfs_by_VFSFILE(VFSFile *file, const char *path)
|
||||
STREAMFILE *open_vfs_by_VFSFILE(VFSFile *file, const char *path)
|
||||
{
|
||||
VFSSTREAMFILE *streamfile = (VFSSTREAMFILE*)malloc(sizeof(VFSSTREAMFILE));
|
||||
if (!streamfile)
|
||||
@ -106,7 +105,7 @@ static STREAMFILE *open_vfs_by_VFSFILE(VFSFile *file, const char *path)
|
||||
|
||||
STREAMFILE *open_vfs(const char *path)
|
||||
{
|
||||
VFSFile *vfsFile = vfs_fopen(path, "rb");
|
||||
VFSFile* vfsFile = new VFSFile(path, "rb");
|
||||
if (!vfsFile)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user