From a81cb6ef5f6bc68f22a118aeaf56c6985c78895b Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 4 Nov 2018 00:36:28 +0100 Subject: [PATCH] Add option to disable default TITLE in foobar to allow custom formatting Exports STREAM_NUMBER/STREAM_COUNT/STREAM_NAME as tags for that config --- fb2k/foo_input_vgmstream.rc | 2 ++ fb2k/foo_prefs.cpp | 9 +++++++++ fb2k/foo_prefs.h | 2 ++ fb2k/foo_vgmstream.cpp | 9 ++++++++- fb2k/foo_vgmstream.h | 1 + fb2k/resource.h | 1 + 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/fb2k/foo_input_vgmstream.rc b/fb2k/foo_input_vgmstream.rc index 37500433..1fef7288 100755 --- a/fb2k/foo_input_vgmstream.rc +++ b/fb2k/foo_input_vgmstream.rc @@ -50,6 +50,8 @@ BEGIN 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 "Override title",IDC_OVERRIDE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,147,97,10 END diff --git a/fb2k/foo_prefs.cpp b/fb2k/foo_prefs.cpp index dc5abe08..a70ca2e3 100755 --- a/fb2k/foo_prefs.cpp +++ b/fb2k/foo_prefs.cpp @@ -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_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_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_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_string cfg_DownmixChannels(guid_cfg_DownmixChannels, DEFAULT_DOWNMIX_CHANNELS); 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 void input_vgmstream::load_settings() @@ -44,6 +46,7 @@ void input_vgmstream::load_settings() disable_subsongs = cfg_DisableSubsongs; sscanf(cfg_DownmixChannels.get_ptr(),"%d",&downmix_channels); tagfile_disable = cfg_TagfileDisable; + override_title = cfg_OverrideTitle; } const char * vgmstream_prefs::get_name() @@ -79,6 +82,7 @@ BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM) uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, cfg_DownmixChannels); CheckDlgButton(IDC_TAGFILE_DISABLE, cfg_TagfileDisable?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(IDC_OVERRIDE_TITLE, cfg_OverrideTitle?BST_CHECKED:BST_UNCHECKED); return TRUE; } @@ -107,6 +111,7 @@ void vgmstreamPreferences::reset() uSetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS, DEFAULT_DOWNMIX_CHANNELS); 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_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?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_delay_seconds; @@ -189,6 +195,9 @@ bool vgmstreamPreferences::HasChanged() bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; 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 FadeDelay(cfg_FadeDelay); pfc::string LoopCount(cfg_LoopCount); diff --git a/fb2k/foo_prefs.h b/fb2k/foo_prefs.h index 2c72e0ad..ac2108ea 100755 --- a/fb2k/foo_prefs.h +++ b/fb2k/foo_prefs.h @@ -17,6 +17,7 @@ #define DEFAULT_DISABLE_SUBSONGS false #define DEFAULT_DOWNMIX_CHANNELS "8" #define DEFAULT_TAGFILE_DISABLE false +#define DEFAULT_OVERRIDE_TITLE false class vgmstreamPreferences : public CDialogImpl, public preferences_page_instance { public: @@ -46,6 +47,7 @@ public: 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) + COMMAND_HANDLER_EX(IDC_OVERRIDE_TITLE, BN_CLICKED, OnEditChange) END_MSG_MAP() private: BOOL OnInitDialog(CWindow, LPARAM); diff --git a/fb2k/foo_vgmstream.cpp b/fb2k/foo_vgmstream.cpp index 2d77d685..763c7a90 100644 --- a/fb2k/foo_vgmstream.cpp +++ b/fb2k/foo_vgmstream.cpp @@ -61,6 +61,7 @@ input_vgmstream::input_vgmstream() { downmix_channels = 0; tagfile_disable = false; tagfile_name = "!tags.m3u"; //todo make configurable + override_title = false; 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) */ - 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); } + 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 */ //todo could optimize or save tags but foobar should cache this (or must check p_info.get_meta_count() == 0?) diff --git a/fb2k/foo_vgmstream.h b/fb2k/foo_vgmstream.h index 83862124..52933247 100644 --- a/fb2k/foo_vgmstream.h +++ b/fb2k/foo_vgmstream.h @@ -76,6 +76,7 @@ class input_vgmstream : public input_stubs { int downmix_channels; bool tagfile_disable; pfc::string8 tagfile_name; + bool override_title; /* song config */ foobar_song_config config; diff --git a/fb2k/resource.h b/fb2k/resource.h index 464fc170..07e5dbaf 100755 --- a/fb2k/resource.h +++ b/fb2k/resource.h @@ -16,6 +16,7 @@ #define IDC_DISABLE_SUBSONGS 1009 #define IDC_DOWNMIX_CHANNELS 1010 #define IDC_TAGFILE_DISABLE 1011 +#define IDC_OVERRIDE_TITLE 1012 // Next default values for new objects //