mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Add text/playlist tags in foobar
This commit is contained in:
parent
151ea81128
commit
e5cea34d45
@ -31,18 +31,25 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Loop Count",IDC_STATIC,7,10,44,12
|
||||
EDITTEXT IDC_LOOP_COUNT,52,7,39,14,ES_AUTOHSCROLL
|
||||
|
||||
LTEXT "Fade Length",IDC_STATIC,7,25,41,8
|
||||
EDITTEXT IDC_FADE_SECONDS,52,23,39,14,ES_AUTOHSCROLL
|
||||
LTEXT "seconds",IDC_STATIC,93,25,29,11
|
||||
|
||||
LTEXT "Fade Delay",IDC_STATIC,7,40,41,8
|
||||
EDITTEXT IDC_FADE_DELAY_SECONDS,52,38,39,14,ES_AUTOHSCROLL
|
||||
LTEXT "seconds",IDC_STATIC,93,40,29,11
|
||||
|
||||
CONTROL "Loop normally",IDC_LOOP_NORMALLY,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,57,77,10
|
||||
CONTROL "Loop forever",IDC_LOOP_FOREVER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,70,77,10
|
||||
CONTROL "Ignore looping",IDC_IGNORE_LOOP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,83,77,10
|
||||
|
||||
CONTROL "Disable subsongs",IDC_DISABLE_SUBSONGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,99,87,10
|
||||
|
||||
LTEXT "Downmix",IDC_STATIC,7,115,48,12
|
||||
EDITTEXT IDC_DOWNMIX_CHANNELS,52,112,37,14,ES_AUTOHSCROLL
|
||||
|
||||
CONTROL "Disable tagfile",IDC_TAGFILE_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,131,87,10
|
||||
END
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ static const GUID guid_cfg_FadeLength = { 0x61da7ef1, 0x56a5, 0x4368, { 0xae, 0x
|
||||
static const GUID guid_cfg_FadeDelay = { 0x73907787, 0xaf49, 0x4659, { 0x96, 0x8e, 0x9f, 0x70, 0xa1, 0x62, 0x49, 0xc4 } };
|
||||
static const GUID guid_cfg_DisableSubsongs = { 0xa8cdd664, 0xb32b, 0x4a36, { 0x83, 0x07, 0xa0, 0x4c, 0xcd, 0x52, 0xa3, 0x7c } };
|
||||
static const GUID guid_cfg_DownmixChannels = { 0x5a0e65dd, 0xeb37, 0x4c67, { 0x9a, 0xb1, 0x3f, 0xb0, 0xc9, 0x7e, 0xb0, 0xe0 } };
|
||||
static const GUID guid_cfg_TagfileDisable = { 0xc1971eb7, 0xa930, 0x4bae, { 0x9e, 0x7f, 0xa9, 0x50, 0x36, 0x32, 0x41, 0xb3 } };
|
||||
|
||||
static cfg_bool cfg_LoopForever(guid_cfg_LoopForever, DEFAULT_LOOP_FOREVER);
|
||||
static cfg_bool cfg_IgnoreLoop(guid_cfg_IgnoreLoop, DEFAULT_IGNORE_LOOP);
|
||||
@ -29,6 +30,7 @@ static cfg_string cfg_FadeLength(guid_cfg_FadeLength, DEFAULT_FADE_SECONDS);
|
||||
static cfg_string cfg_FadeDelay(guid_cfg_FadeDelay, DEFAULT_FADE_DELAY_SECONDS);
|
||||
static cfg_bool cfg_DisableSubsongs(guid_cfg_DisableSubsongs, DEFAULT_DISABLE_SUBSONGS);
|
||||
static cfg_string cfg_DownmixChannels(guid_cfg_DownmixChannels, DEFAULT_DOWNMIX_CHANNELS);
|
||||
static cfg_bool cfg_TagfileDisable(guid_cfg_TagfileDisable, DEFAULT_TAGFILE_DISABLE);
|
||||
|
||||
// Needs to be here in rder to access the static config
|
||||
void input_vgmstream::load_settings()
|
||||
@ -41,6 +43,7 @@ void input_vgmstream::load_settings()
|
||||
ignore_loop = cfg_IgnoreLoop;
|
||||
disable_subsongs = cfg_DisableSubsongs;
|
||||
sscanf(cfg_DownmixChannels.get_ptr(),"%d",&downmix_channels);
|
||||
tagfile_disable = cfg_TagfileDisable;
|
||||
}
|
||||
|
||||
const char * vgmstream_prefs::get_name()
|
||||
@ -75,6 +78,8 @@ BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM)
|
||||
|
||||
uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, cfg_DownmixChannels);
|
||||
|
||||
CheckDlgButton(IDC_TAGFILE_DISABLE, cfg_TagfileDisable?BST_CHECKED:BST_UNCHECKED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -100,6 +105,8 @@ void vgmstreamPreferences::reset()
|
||||
CheckDlgButton(IDC_DISABLE_SUBSONGS, DEFAULT_DISABLE_SUBSONGS?BST_CHECKED:BST_UNCHECKED);
|
||||
|
||||
uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, DEFAULT_DOWNMIX_CHANNELS);
|
||||
|
||||
CheckDlgButton(IDC_TAGFILE_DISABLE, DEFAULT_TAGFILE_DISABLE?BST_CHECKED:BST_UNCHECKED);
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +116,7 @@ void vgmstreamPreferences::apply()
|
||||
cfg_LoopForever = IsDlgButtonChecked(IDC_LOOP_FOREVER)?true:false;
|
||||
cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false;
|
||||
cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false;
|
||||
cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false;
|
||||
|
||||
double temp_fade_seconds;
|
||||
double temp_fade_delay_seconds;
|
||||
@ -178,6 +186,9 @@ bool vgmstreamPreferences::HasChanged()
|
||||
bool current_cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false;
|
||||
if(cfg_DisableSubsongs != current_cfg_DisableSubsongs) return true;
|
||||
|
||||
bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false;
|
||||
if(cfg_TagfileDisable != current_cfg_TagfileDisable) return true;
|
||||
|
||||
pfc::string FadeLength(cfg_FadeLength);
|
||||
pfc::string FadeDelay(cfg_FadeDelay);
|
||||
pfc::string LoopCount(cfg_LoopCount);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define DEFAULT_IGNORE_LOOP false
|
||||
#define DEFAULT_DISABLE_SUBSONGS false
|
||||
#define DEFAULT_DOWNMIX_CHANNELS "8"
|
||||
#define DEFAULT_TAGFILE_DISABLE false
|
||||
|
||||
class vgmstreamPreferences : public CDialogImpl<vgmstreamPreferences>, public preferences_page_instance {
|
||||
public:
|
||||
@ -44,6 +45,7 @@ public:
|
||||
COMMAND_HANDLER_EX(IDC_LOOP_COUNT, EN_CHANGE, OnEditChange)
|
||||
COMMAND_HANDLER_EX(IDC_DISABLE_SUBSONGS, BN_CLICKED, OnEditChange)
|
||||
COMMAND_HANDLER_EX(IDC_DOWNMIX_CHANNELS, EN_CHANGE, OnEditChange)
|
||||
COMMAND_HANDLER_EX(IDC_TAGFILE_DISABLE, BN_CLICKED, OnEditChange)
|
||||
END_MSG_MAP()
|
||||
private:
|
||||
BOOL OnInitDialog(CWindow, LPARAM);
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
extern "C" {
|
||||
#include "../src/vgmstream.h"
|
||||
#include "../src/plugins.h"
|
||||
}
|
||||
#include "foo_vgmstream.h"
|
||||
#include "foo_filetypes.h"
|
||||
@ -58,6 +59,8 @@ input_vgmstream::input_vgmstream() {
|
||||
ignore_loop = 0;
|
||||
disable_subsongs = false;
|
||||
downmix_channels = 0;
|
||||
tagfile_disable = false;
|
||||
tagfile_name = "!tags.m3u"; //todo make configurable
|
||||
|
||||
load_settings();
|
||||
}
|
||||
@ -142,12 +145,45 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
|
||||
|
||||
get_subsong_info(p_subsong, temp, &length_in_ms, &total_samples, &loop_start, &loop_end, &samplerate, &channels, &bitrate, description, p_abort);
|
||||
|
||||
|
||||
/* set tag info (metadata tab in file properties) */
|
||||
|
||||
if (get_subsong_count() > 1) {
|
||||
p_info.meta_set("TITLE",temp);
|
||||
}
|
||||
|
||||
p_info.info_set("vgmstream version",PLUGIN_VERSION);
|
||||
/* get external file tags */
|
||||
//todo could optimize or save tags but foobar should cache this (or must check p_info.get_meta_count() == 0?)
|
||||
if (!tagfile_disable) {
|
||||
//todo use foobar's fancy-but-arcane string functions
|
||||
char tagfile_path[PATH_LIMIT];
|
||||
strcpy(tagfile_path, filename);
|
||||
|
||||
char *path = strrchr(tagfile_path,'\\');
|
||||
if (path!=NULL) {
|
||||
path[1] = '\0'; /* includes "\", remove after that from tagfile_path */
|
||||
strcat(tagfile_path,tagfile_name);
|
||||
}
|
||||
else { /* ??? */
|
||||
strcpy(tagfile_path,tagfile_name);
|
||||
}
|
||||
|
||||
STREAMFILE *tagFile = open_foo_streamfile(tagfile_path, &p_abort, &stats);
|
||||
if (tagFile != NULL) {
|
||||
VGMSTREAM_TAGS tag;
|
||||
vgmstream_tags_reset(&tag, filename);
|
||||
while (vgmstream_tags_next_tag(&tag, tagFile)) {
|
||||
p_info.meta_set(tag.key,tag.val);
|
||||
}
|
||||
|
||||
close_streamfile(tagFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* set technical info (details tab in file properties) */
|
||||
|
||||
p_info.info_set("vgmstream_version",PLUGIN_VERSION);
|
||||
p_info.info_set_int("samplerate", samplerate);
|
||||
p_info.info_set_int("channels", channels);
|
||||
p_info.info_set_int("bitspersample",16);
|
||||
@ -344,8 +380,8 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* some extensionless files can be handled by vgmstream, try to play */
|
||||
if (strlen(p_extension) <= 0) {
|
||||
// Last Of Us speech files have no file extension
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class input_vgmstream : public input_stubs {
|
||||
int seek_pos_samples;
|
||||
short sample_buffer[SAMPLE_BUFFER_SIZE];
|
||||
|
||||
/* config */
|
||||
/* settings */
|
||||
double fade_seconds;
|
||||
double fade_delay_seconds;
|
||||
double loop_count;
|
||||
@ -74,7 +74,10 @@ class input_vgmstream : public input_stubs {
|
||||
int ignore_loop;
|
||||
bool disable_subsongs;
|
||||
int downmix_channels;
|
||||
bool tagfile_disable;
|
||||
pfc::string8 tagfile_name;
|
||||
|
||||
/* song config */
|
||||
foobar_song_config config;
|
||||
|
||||
/* helpers */
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define IDC_DEFAULT_BUTTON 1008
|
||||
#define IDC_DISABLE_SUBSONGS 1009
|
||||
#define IDC_DOWNMIX_CHANNELS 1010
|
||||
#define IDC_TAGFILE_DISABLE 1011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user