diff --git a/fb2k/foo_input_vgmstream.rc b/fb2k/foo_input_vgmstream.rc index 3a211e79..96edda9a 100755 --- a/fb2k/foo_input_vgmstream.rc +++ b/fb2k/foo_input_vgmstream.rc @@ -24,7 +24,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL // Dialog // -IDD_CONFIG DIALOGEX 0, 0, 187, 144 +IDD_CONFIG DIALOGEX 0, 0, 187, 156 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN @@ -39,6 +39,7 @@ BEGIN 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 END diff --git a/fb2k/foo_prefs.cpp b/fb2k/foo_prefs.cpp index cba88f67..5cb81cd3 100755 --- a/fb2k/foo_prefs.cpp +++ b/fb2k/foo_prefs.cpp @@ -23,12 +23,14 @@ static const GUID guid_cfg_IgnoreLoop = { 0xddda7ab6, 0x7bb6, 0x4abe, { 0xb9, 0x static const GUID guid_cfg_LoopCount = { 0xfc8dfd72, 0xfae8, 0x44cc, { 0xbe, 0x99, 0x1c, 0x7b, 0x27, 0x7a, 0xb6, 0xb9 } }; static const GUID guid_cfg_FadeLength = { 0x61da7ef1, 0x56a5, 0x4368, { 0xae, 0x6, 0xec, 0x6f, 0xd7, 0xe6, 0x15, 0x5d } }; 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 cfg_bool cfg_LoopForever(guid_cfg_LoopForever, DEFAULT_LOOP_FOREVER); static cfg_bool cfg_IgnoreLoop(guid_cfg_IgnoreLoop, DEFAULT_IGNORE_LOOP); static cfg_string cfg_LoopCount(guid_cfg_LoopCount, DEFAULT_LOOP_COUNT); 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); // Needs to be here in rder to access the static config void input_vgmstream::load_settings() @@ -39,6 +41,7 @@ void input_vgmstream::load_settings() sscanf(cfg_FadeDelay.get_ptr(),"%lf",&fade_delay_seconds); loop_forever = cfg_LoopForever; ignore_loop = cfg_IgnoreLoop; + disable_subsongs = cfg_DisableSubsongs; } const char * vgmstream_prefs::get_name() @@ -70,6 +73,8 @@ BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM) uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, cfg_FadeLength); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, cfg_FadeDelay); + CheckDlgButton(IDC_DISABLE_SUBSONGS, cfg_DisableSubsongs?BST_CHECKED:BST_UNCHECKED); + return TRUE; } @@ -91,6 +96,8 @@ void vgmstreamPreferences::reset() uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, DEFAULT_LOOP_COUNT); uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, DEFAULT_FADE_SECONDS); uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, DEFAULT_FADE_DELAY_SECONDS); + + CheckDlgButton(IDC_DISABLE_SUBSONGS, DEFAULT_DISABLE_SUBSONGS?BST_CHECKED:BST_UNCHECKED); } @@ -99,6 +106,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; double temp_fade_seconds; double temp_fade_delay_seconds; @@ -152,6 +160,9 @@ bool vgmstreamPreferences::HasChanged() if(IsDlgButtonChecked(IDC_LOOP_NORMALLY)) if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true; + bool current_cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false; + if(cfg_DisableSubsongs != current_cfg_DisableSubsongs) 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 42bc923b..c44c5a0e 100755 --- a/fb2k/foo_prefs.h +++ b/fb2k/foo_prefs.h @@ -14,6 +14,7 @@ #define DEFAULT_LOOP_COUNT "2.00" #define DEFAULT_LOOP_FOREVER false #define DEFAULT_IGNORE_LOOP false +#define DEFAULT_DISABLE_SUBSONGS false class vgmstreamPreferences : public CDialogImpl, public preferences_page_instance { public: @@ -40,6 +41,7 @@ public: COMMAND_HANDLER_EX(IDC_FADE_SECONDS, EN_CHANGE, OnEditChange) COMMAND_HANDLER_EX(IDC_FADE_DELAY_SECONDS, EN_CHANGE, OnEditChange) COMMAND_HANDLER_EX(IDC_LOOP_COUNT, EN_CHANGE, OnEditChange) + COMMAND_HANDLER_EX(IDC_DISABLE_SUBSONGS, BN_CLICKED, OnEditChange) END_MSG_MAP() private: BOOL OnInitDialog(CWindow, LPARAM); diff --git a/fb2k/foo_vgmstream.cpp b/fb2k/foo_vgmstream.cpp index 87ce7b8c..203f19c2 100644 --- a/fb2k/foo_vgmstream.cpp +++ b/fb2k/foo_vgmstream.cpp @@ -58,7 +58,7 @@ input_vgmstream::input_vgmstream() { loop_count = 2.0f; loop_forever = false; ignore_loop = 0; - disable_subsongs = true; + disable_subsongs = false; load_settings(); } @@ -134,7 +134,11 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal pfc::string8 description; pfc::string8_fast temp; - get_subsong_info(p_subsong, NULL, &length_in_ms, &total_samples, &loop_start, &loop_end, &samplerate, &channels, &bitrate, description, p_abort); + get_subsong_info(p_subsong, temp, &length_in_ms, &total_samples, &loop_start, &loop_end, &samplerate, &channels, &bitrate, description, p_abort); + + if (get_subsong_count() > 1) { + p_info.meta_set("TITLE",temp); + } p_info.info_set_int("samplerate", samplerate); p_info.info_set_int("channels", channels); @@ -343,8 +347,9 @@ void input_vgmstream::setup_vgmstream(abort_callback & p_abort) { fade_samples = (int)(fade_seconds * vgmstream->sample_rate); } -void input_vgmstream::get_subsong_info(t_uint32 p_subsong, char *title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort) { +void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort) { VGMSTREAM * infostream = NULL; + char temp[1024]; // reuse current vgmstream if not querying a new subsong if (subsong != p_subsong) { @@ -376,9 +381,23 @@ void input_vgmstream::get_subsong_info(t_uint32 p_subsong, char *title, int *len } if (title) { - const char *p=filename+strlen(filename); + const char *p = filename + strlen(filename); while (*p != '\\' && p >= filename) p--; - strcpy(title,++p); + p++; + const char *e = filename + strlen(filename); + while (*e != '.' && e >= filename) e--; + + title.set_string(p, e - p); + + if (!disable_subsongs && infostream && infostream->num_streams > 1) { + sprintf(temp,"#%d",p_subsong); + title += temp; + + if (infostream->stream_name[0] != '\0') { + sprintf(temp," (%s)",infostream->stream_name); + title += temp; + } + } } // and only close if was querying a new subsong diff --git a/fb2k/foo_vgmstream.h b/fb2k/foo_vgmstream.h index 1dbf972f..55a0d5d7 100644 --- a/fb2k/foo_vgmstream.h +++ b/fb2k/foo_vgmstream.h @@ -60,7 +60,7 @@ class input_vgmstream { VGMSTREAM * init_vgmstream_foo(t_uint32 p_subsong, const char * const filename, abort_callback & p_abort); void setup_vgmstream(abort_callback & p_abort); void load_settings(); - void get_subsong_info(t_uint32 p_subsong, char *title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort); + void get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort); bool get_description_tag(pfc::string_base & temp, pfc::string_base & description, const char *tag, char delimiter = '\n'); }; diff --git a/fb2k/resource.h b/fb2k/resource.h index c80b0510..ec646540 100755 --- a/fb2k/resource.h +++ b/fb2k/resource.h @@ -13,6 +13,7 @@ #define IDC_THREAD_PRIORITY_SLIDER 1006 #define IDC_THREAD_PRIORITY_TEXT 1007 #define IDC_DEFAULT_BUTTON 1008 +#define IDC_DISABLE_SUBSONGS 1009 // Next default values for new objects //