Add option to disable default TITLE in foobar to allow custom formatting

Exports STREAM_NUMBER/STREAM_COUNT/STREAM_NAME as tags for that config
This commit is contained in:
bnnm 2018-11-04 00:36:28 +01:00
parent 351b7ad038
commit a81cb6ef5f
6 changed files with 23 additions and 1 deletions

View File

@ -50,6 +50,8 @@ BEGIN
EDITTEXT IDC_DOWNMIX_CHANNELS,52,112,37,14,ES_AUTOHSCROLL 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 CONTROL "Disable tagfile",IDC_TAGFILE_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,131,87,10
CONTROL "Override title",IDC_OVERRIDE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,147,97,10
END END

View File

@ -22,6 +22,7 @@ static const GUID guid_cfg_FadeDelay = { 0x73907787, 0xaf49, 0x4659, { 0x96, 0x8
static const GUID guid_cfg_DisableSubsongs = { 0xa8cdd664, 0xb32b, 0x4a36, { 0x83, 0x07, 0xa0, 0x4c, 0xcd, 0x52, 0xa3, 0x7c } }; 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_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 const GUID guid_cfg_TagfileDisable = { 0xc1971eb7, 0xa930, 0x4bae, { 0x9e, 0x7f, 0xa9, 0x50, 0x36, 0x32, 0x41, 0xb3 } };
static const GUID guid_cfg_OverrideTitle = { 0xe794831f, 0xd067, 0x4337, { 0x97, 0x85, 0x10, 0x57, 0x39, 0x4b, 0x1b, 0x97 } };
static cfg_bool cfg_LoopForever(guid_cfg_LoopForever, DEFAULT_LOOP_FOREVER); static cfg_bool cfg_LoopForever(guid_cfg_LoopForever, DEFAULT_LOOP_FOREVER);
static cfg_bool cfg_IgnoreLoop(guid_cfg_IgnoreLoop, DEFAULT_IGNORE_LOOP); static cfg_bool cfg_IgnoreLoop(guid_cfg_IgnoreLoop, DEFAULT_IGNORE_LOOP);
@ -31,6 +32,7 @@ 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_bool cfg_DisableSubsongs(guid_cfg_DisableSubsongs, DEFAULT_DISABLE_SUBSONGS);
static cfg_string cfg_DownmixChannels(guid_cfg_DownmixChannels, DEFAULT_DOWNMIX_CHANNELS); static cfg_string cfg_DownmixChannels(guid_cfg_DownmixChannels, DEFAULT_DOWNMIX_CHANNELS);
static cfg_bool cfg_TagfileDisable(guid_cfg_TagfileDisable, DEFAULT_TAGFILE_DISABLE); static cfg_bool cfg_TagfileDisable(guid_cfg_TagfileDisable, DEFAULT_TAGFILE_DISABLE);
static cfg_bool cfg_OverrideTitle(guid_cfg_OverrideTitle, DEFAULT_OVERRIDE_TITLE);
// Needs to be here in rder to access the static config // Needs to be here in rder to access the static config
void input_vgmstream::load_settings() void input_vgmstream::load_settings()
@ -44,6 +46,7 @@ void input_vgmstream::load_settings()
disable_subsongs = cfg_DisableSubsongs; disable_subsongs = cfg_DisableSubsongs;
sscanf(cfg_DownmixChannels.get_ptr(),"%d",&downmix_channels); sscanf(cfg_DownmixChannels.get_ptr(),"%d",&downmix_channels);
tagfile_disable = cfg_TagfileDisable; tagfile_disable = cfg_TagfileDisable;
override_title = cfg_OverrideTitle;
} }
const char * vgmstream_prefs::get_name() const char * vgmstream_prefs::get_name()
@ -79,6 +82,7 @@ BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM)
uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, cfg_DownmixChannels); uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, cfg_DownmixChannels);
CheckDlgButton(IDC_TAGFILE_DISABLE, cfg_TagfileDisable?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_TAGFILE_DISABLE, cfg_TagfileDisable?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(IDC_OVERRIDE_TITLE, cfg_OverrideTitle?BST_CHECKED:BST_UNCHECKED);
return TRUE; return TRUE;
} }
@ -107,6 +111,7 @@ void vgmstreamPreferences::reset()
uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, DEFAULT_DOWNMIX_CHANNELS); uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, DEFAULT_DOWNMIX_CHANNELS);
CheckDlgButton(IDC_TAGFILE_DISABLE, DEFAULT_TAGFILE_DISABLE?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(IDC_TAGFILE_DISABLE, DEFAULT_TAGFILE_DISABLE?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(IDC_OVERRIDE_TITLE, DEFAULT_OVERRIDE_TITLE?BST_CHECKED:BST_UNCHECKED);
} }
@ -117,6 +122,7 @@ void vgmstreamPreferences::apply()
cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false; cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false;
cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false; cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false;
cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false;
cfg_OverrideTitle = IsDlgButtonChecked(IDC_OVERRIDE_TITLE)?true:false;
double temp_fade_seconds; double temp_fade_seconds;
double temp_fade_delay_seconds; double temp_fade_delay_seconds;
@ -189,6 +195,9 @@ bool vgmstreamPreferences::HasChanged()
bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false;
if(cfg_TagfileDisable != current_cfg_TagfileDisable) return true; if(cfg_TagfileDisable != current_cfg_TagfileDisable) return true;
bool current_cfg_OverrideTitle = IsDlgButtonChecked(IDC_OVERRIDE_TITLE)?true:false;
if(cfg_OverrideTitle != current_cfg_OverrideTitle) return true;
pfc::string FadeLength(cfg_FadeLength); pfc::string FadeLength(cfg_FadeLength);
pfc::string FadeDelay(cfg_FadeDelay); pfc::string FadeDelay(cfg_FadeDelay);
pfc::string LoopCount(cfg_LoopCount); pfc::string LoopCount(cfg_LoopCount);

View File

@ -17,6 +17,7 @@
#define DEFAULT_DISABLE_SUBSONGS false #define DEFAULT_DISABLE_SUBSONGS false
#define DEFAULT_DOWNMIX_CHANNELS "8" #define DEFAULT_DOWNMIX_CHANNELS "8"
#define DEFAULT_TAGFILE_DISABLE false #define DEFAULT_TAGFILE_DISABLE false
#define DEFAULT_OVERRIDE_TITLE false
class vgmstreamPreferences : public CDialogImpl<vgmstreamPreferences>, public preferences_page_instance { class vgmstreamPreferences : public CDialogImpl<vgmstreamPreferences>, public preferences_page_instance {
public: public:
@ -46,6 +47,7 @@ public:
COMMAND_HANDLER_EX(IDC_DISABLE_SUBSONGS, BN_CLICKED, OnEditChange) COMMAND_HANDLER_EX(IDC_DISABLE_SUBSONGS, BN_CLICKED, OnEditChange)
COMMAND_HANDLER_EX(IDC_DOWNMIX_CHANNELS, EN_CHANGE, OnEditChange) COMMAND_HANDLER_EX(IDC_DOWNMIX_CHANNELS, EN_CHANGE, OnEditChange)
COMMAND_HANDLER_EX(IDC_TAGFILE_DISABLE, BN_CLICKED, OnEditChange) COMMAND_HANDLER_EX(IDC_TAGFILE_DISABLE, BN_CLICKED, OnEditChange)
COMMAND_HANDLER_EX(IDC_OVERRIDE_TITLE, BN_CLICKED, OnEditChange)
END_MSG_MAP() END_MSG_MAP()
private: private:
BOOL OnInitDialog(CWindow, LPARAM); BOOL OnInitDialog(CWindow, LPARAM);

View File

@ -61,6 +61,7 @@ input_vgmstream::input_vgmstream() {
downmix_channels = 0; downmix_channels = 0;
tagfile_disable = false; tagfile_disable = false;
tagfile_name = "!tags.m3u"; //todo make configurable tagfile_name = "!tags.m3u"; //todo make configurable
override_title = false;
load_settings(); load_settings();
} }
@ -139,9 +140,15 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
/* set tag info (metadata tab in file properties) */ /* set tag info (metadata tab in file properties) */
if (get_subsong_count() > 1) { /* Shows a custom subsong title by default with subsong name, to simplify for average users.
* This can be overriden and extended and using the exported STREAM_x below and foobar's formatting.
* foobar defaults to filename minus extension if there is no meta "title" value. */
if (!override_title && get_subsong_count() > 1) {
p_info.meta_set("TITLE",temp); p_info.meta_set("TITLE",temp);
} }
if (get_description_tag(temp,description,"stream count: ")) p_info.meta_set("stream_count",temp);
if (get_description_tag(temp,description,"stream index: ")) p_info.meta_set("stream_index",temp);
if (get_description_tag(temp,description,"stream name: ")) p_info.meta_set("stream_name",temp);
/* get external file tags */ /* get external file tags */
//todo could optimize or save tags but foobar should cache this (or must check p_info.get_meta_count() == 0?) //todo could optimize or save tags but foobar should cache this (or must check p_info.get_meta_count() == 0?)

View File

@ -76,6 +76,7 @@ class input_vgmstream : public input_stubs {
int downmix_channels; int downmix_channels;
bool tagfile_disable; bool tagfile_disable;
pfc::string8 tagfile_name; pfc::string8 tagfile_name;
bool override_title;
/* song config */ /* song config */
foobar_song_config config; foobar_song_config config;

View File

@ -16,6 +16,7 @@
#define IDC_DISABLE_SUBSONGS 1009 #define IDC_DISABLE_SUBSONGS 1009
#define IDC_DOWNMIX_CHANNELS 1010 #define IDC_DOWNMIX_CHANNELS 1010
#define IDC_TAGFILE_DISABLE 1011 #define IDC_TAGFILE_DISABLE 1011
#define IDC_OVERRIDE_TITLE 1012
// Next default values for new objects // Next default values for new objects
// //