mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
Added configuration dialog, updated extension list, fixed bitrate display
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@750 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
130f1f4dff
commit
69116bbc1b
89
fb2k/foo_input_vgmstream.rc
Executable file
89
fb2k/foo_input_vgmstream.rc
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (Australia) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_CONFIG DIALOGEX 0, 0, 187, 144
|
||||||
|
STYLE DS_SETFONT | WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif", 0, 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
|
||||||
|
LTEXT "Thread Priority",IDC_STATIC,21,99,46,8
|
||||||
|
CONTROL "Slider1",IDC_THREAD_PRIORITY_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,7,107,77,10
|
||||||
|
CTEXT "DATARIFIC",IDC_THREAD_PRIORITY_TEXT,7,120,77,18
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (Australia) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
@ -4,6 +4,7 @@
|
|||||||
Version="9.00"
|
Version="9.00"
|
||||||
Name="foo_input_vgmstream"
|
Name="foo_input_vgmstream"
|
||||||
ProjectGUID="{F3739CF2-F422-4A3D-BB0A-53C5D4C5ABA0}"
|
ProjectGUID="{F3739CF2-F422-4A3D-BB0A-53C5D4C5ABA0}"
|
||||||
|
RootNamespace="foo_input_vgmstream"
|
||||||
Keyword="Win32Proj"
|
Keyword="Win32Proj"
|
||||||
TargetFrameworkVersion="0"
|
TargetFrameworkVersion="0"
|
||||||
>
|
>
|
||||||
@ -61,7 +62,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="shared.lib foobar2000_SDKd.lib foobar2000_component_clientd.lib pfcd.lib ../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib"
|
AdditionalDependencies="shared.lib foobar2000_SDKd.lib foobar2000_component_clientd.lib pfcd.lib foobar2000_sdk_helpersd.lib ../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib"
|
||||||
OutputFile="$(OutDir)\$(ProjectName).dll"
|
OutputFile="$(OutDir)\$(ProjectName).dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""
|
AdditionalLibraryDirectories=""
|
||||||
@ -135,9 +136,11 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="shared.lib foobar2000_SDK.lib foobar2000_component_client.lib pfc.lib ../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib"
|
AdditionalDependencies="shared.lib foobar2000_SDK.lib foobar2000_sdk_helpers.lib foobar2000_component_client.lib pfc.lib ../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib"
|
||||||
|
OutputFile="$(OutDir)\$(ProjectName).dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""
|
AdditionalLibraryDirectories=""
|
||||||
|
IgnoreDefaultLibraryNames=""
|
||||||
DelayLoadDLLs="libvorbis.dll;libmpg123-0.dll"
|
DelayLoadDLLs="libvorbis.dll;libmpg123-0.dll"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
@ -179,18 +182,30 @@
|
|||||||
RelativePath=".\foo_vgmstream.h"
|
RelativePath=".\foo_vgmstream.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\resource1.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\foo_input_vgmstream.rc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\foo_prefs.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\foostream.cpp"
|
RelativePath=".\foostream.cpp"
|
||||||
>
|
>
|
||||||
@ -202,5 +217,9 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
<Global
|
||||||
|
Name="RESOURCE_FILE"
|
||||||
|
Value="foo_input_vgmstream.rc"
|
||||||
|
/>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
199
fb2k/foo_prefs.cpp
Executable file
199
fb2k/foo_prefs.cpp
Executable file
@ -0,0 +1,199 @@
|
|||||||
|
#ifdef _MSC_VER
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
|
#include <foobar2000.h>
|
||||||
|
#include <helpers.h>
|
||||||
|
#include <shared.h>
|
||||||
|
#include "foo_prefs.h"
|
||||||
|
extern "C" {
|
||||||
|
#include "../src/vgmstream.h"
|
||||||
|
#include "../src/util.h"
|
||||||
|
}
|
||||||
|
#include "foo_vgmstream.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const char * priority_strings[] = {"Idle","Lowest","Below Normal","Normal","Above Normal","Highest (not recommended)","Time Critical (not recommended)"};
|
||||||
|
static const int priority_values[] = {THREAD_PRIORITY_IDLE,THREAD_PRIORITY_LOWEST,THREAD_PRIORITY_BELOW_NORMAL,THREAD_PRIORITY_NORMAL,THREAD_PRIORITY_ABOVE_NORMAL,THREAD_PRIORITY_HIGHEST,THREAD_PRIORITY_TIME_CRITICAL};
|
||||||
|
|
||||||
|
static const GUID guid_cfg_Priority = { 0x6a94e07f, 0xf565, 0x455f, { 0x87, 0x27, 0x30, 0xce, 0x81, 0x44, 0xd2, 0xf } };
|
||||||
|
static const GUID guid_cfg_LoopForever = { 0xa19e36eb, 0x72a0, 0x4077, { 0x91, 0x43, 0x38, 0xb4, 0x5, 0xfc, 0x91, 0xc5 } };
|
||||||
|
static const GUID guid_cfg_IgnoreLoop = { 0xddda7ab6, 0x7bb6, 0x4abe, { 0xb9, 0x66, 0x2d, 0xb7, 0x8f, 0xe4, 0xcc, 0xab } };
|
||||||
|
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 cfg_uint cfg_Priority(guid_cfg_Priority, DEFAULT_THREAD_PRIORITY);
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Needs to be here in rder to access the static config
|
||||||
|
void input_vgmstream::load_settings()
|
||||||
|
{
|
||||||
|
// no verification needed here, as it is done below
|
||||||
|
sscanf(cfg_FadeLength.get_ptr(),"%lf",&fade_seconds);
|
||||||
|
sscanf(cfg_LoopCount.get_ptr(),"%lf",&loop_count);
|
||||||
|
sscanf(cfg_FadeDelay.get_ptr(),"%lf",&fade_delay_seconds);
|
||||||
|
thread_priority = priority_values[cfg_Priority];
|
||||||
|
loop_forever = cfg_LoopForever;
|
||||||
|
ignore_loop = cfg_IgnoreLoop;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * vgmstream_prefs::get_name()
|
||||||
|
{
|
||||||
|
return "vgmstream";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GUID vgmstream_prefs::get_guid()
|
||||||
|
{
|
||||||
|
static const GUID guid = { 0x2b5d0302, 0x165b, 0x409c, { 0x94, 0x74, 0x2c, 0x8c, 0x2c, 0xd7, 0x6a, 0x25 } };;
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GUID vgmstream_prefs::get_parent_guid()
|
||||||
|
{
|
||||||
|
return guid_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL vgmstreamPreferences::OnInitDialog(CWindow, LPARAM)
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_LOOP_FOREVER, cfg_LoopForever?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
CheckDlgButton(IDC_IGNORE_LOOP, cfg_IgnoreLoop?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
CheckDlgButton(IDC_LOOP_NORMALLY, (!cfg_IgnoreLoop && !cfg_LoopForever)?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_LOOP_COUNT, cfg_LoopCount);
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_FADE_SECONDS, cfg_FadeLength);
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS, cfg_FadeDelay);
|
||||||
|
|
||||||
|
SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_SETRANGE, 1, MAKELONG(0, 6));
|
||||||
|
SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_SETPOS, 1, cfg_Priority);
|
||||||
|
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_THREAD_PRIORITY_TEXT, priority_strings[cfg_Priority]);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
t_uint32 vgmstreamPreferences::get_state()
|
||||||
|
{
|
||||||
|
t_uint32 state = preferences_state::resettable;
|
||||||
|
if (HasChanged()) state |= preferences_state::changed;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vgmstreamPreferences::reset()
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_LOOP_FOREVER, DEFAULT_LOOP_FOREVER?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
CheckDlgButton(IDC_IGNORE_LOOP, DEFAULT_IGNORE_LOOP?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
CheckDlgButton(IDC_LOOP_NORMALLY, (!DEFAULT_IGNORE_LOOP && !DEFAULT_LOOP_FOREVER)?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_SETRANGE, 1, MAKELONG(0, 6));
|
||||||
|
SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_SETPOS, 1, DEFAULT_THREAD_PRIORITY);
|
||||||
|
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_THREAD_PRIORITY_TEXT, priority_strings[DEFAULT_THREAD_PRIORITY]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void vgmstreamPreferences::apply()
|
||||||
|
{
|
||||||
|
cfg_LoopForever = IsDlgButtonChecked(IDC_LOOP_FOREVER)?true:false;
|
||||||
|
cfg_IgnoreLoop = IsDlgButtonChecked(IDC_IGNORE_LOOP)?true:false;
|
||||||
|
|
||||||
|
double temp_fade_seconds;
|
||||||
|
double temp_fade_delay_seconds;
|
||||||
|
double temp_loop_count;
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
pfc::string buf;
|
||||||
|
buf = uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS);
|
||||||
|
if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_seconds,&consumed)<1
|
||||||
|
|| consumed!=strlen(buf.get_ptr()) ||
|
||||||
|
temp_fade_seconds<0) {
|
||||||
|
uMessageBox(m_hWnd,
|
||||||
|
"Invalid value for Fade Length\n"
|
||||||
|
"Must be a number greater than or equal to zero",
|
||||||
|
"Error",MB_OK|MB_ICONERROR);
|
||||||
|
return;
|
||||||
|
} else cfg_FadeLength = buf.get_ptr();
|
||||||
|
|
||||||
|
buf = uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT);
|
||||||
|
if (sscanf(buf.get_ptr(),"%lf%n",&temp_loop_count,&consumed)<1
|
||||||
|
|| consumed!=strlen(buf.get_ptr()) ||
|
||||||
|
temp_loop_count<0) {
|
||||||
|
uMessageBox(m_hWnd,
|
||||||
|
"Invalid value for Loop Count\n"
|
||||||
|
"Must be a number greater than or equal to zero",
|
||||||
|
"Error",MB_OK|MB_ICONERROR);
|
||||||
|
return;
|
||||||
|
} else cfg_LoopCount = buf.get_ptr();
|
||||||
|
|
||||||
|
buf = uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS);
|
||||||
|
if (sscanf(buf.get_ptr(),"%lf%n",&temp_fade_delay_seconds,&consumed)<1
|
||||||
|
|| consumed!=strlen(buf.get_ptr()) ||
|
||||||
|
temp_fade_delay_seconds<0) {
|
||||||
|
uMessageBox(m_hWnd,
|
||||||
|
"Invalid value for Fade Delay\n"
|
||||||
|
"Must be a number",
|
||||||
|
"Error",MB_OK|MB_ICONERROR);
|
||||||
|
return;
|
||||||
|
} else cfg_FadeDelay = buf.get_ptr();
|
||||||
|
|
||||||
|
cfg_Priority = (t_uint32)SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_GETPOS, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool vgmstreamPreferences::HasChanged()
|
||||||
|
{
|
||||||
|
if(IsDlgButtonChecked(IDC_LOOP_FOREVER))
|
||||||
|
if(cfg_LoopForever != true) return true;
|
||||||
|
|
||||||
|
if(IsDlgButtonChecked(IDC_IGNORE_LOOP))
|
||||||
|
if(cfg_IgnoreLoop != true) return true;
|
||||||
|
|
||||||
|
if(IsDlgButtonChecked(IDC_LOOP_NORMALLY))
|
||||||
|
if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true;
|
||||||
|
|
||||||
|
pfc::string FadeLength(cfg_FadeLength);
|
||||||
|
pfc::string FadeDelay(cfg_FadeDelay);
|
||||||
|
pfc::string LoopCount(cfg_LoopCount);
|
||||||
|
|
||||||
|
if(FadeLength != uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS)) return true;
|
||||||
|
if(FadeDelay != uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS)) return true;
|
||||||
|
if(LoopCount != uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT)) return true;
|
||||||
|
|
||||||
|
int Priority = 6 - SendDlgItemMessage(IDC_THREAD_PRIORITY_SLIDER, TBM_GETPOS, 0, 0);
|
||||||
|
if(Priority != cfg_Priority) return true;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vgmstreamPreferences::OnEditChange(UINT, int, CWindow)
|
||||||
|
{
|
||||||
|
m_callback->on_state_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void vgmstreamPreferences::OnVScroll(UINT nSBCode, UINT nPos, CTrackBarCtrl pScrollBar)
|
||||||
|
{
|
||||||
|
int index = pScrollBar.GetPos();
|
||||||
|
uSetDlgItemText(m_hWnd, IDC_THREAD_PRIORITY_TEXT, priority_strings[index]);
|
||||||
|
m_callback->on_state_changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static preferences_page_factory_t<vgmstream_prefs> g_vgmstream_preferences_page_factory;
|
70
fb2k/foo_prefs.h
Executable file
70
fb2k/foo_prefs.h
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef _FOO_PREFS_H
|
||||||
|
#define _FOO_PREFS_H
|
||||||
|
|
||||||
|
#include <foobar2000.h>
|
||||||
|
#include <helpers.h>
|
||||||
|
#include <shared.h>
|
||||||
|
#include <ATLHelpers.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define DEFAULT_FADE_SECONDS "10.00"
|
||||||
|
#define DEFAULT_FADE_DELAY_SECONDS "0.00"
|
||||||
|
#define DEFAULT_LOOP_COUNT "2.00"
|
||||||
|
#define DEFAULT_THREAD_PRIORITY 3
|
||||||
|
#define DEFAULT_LOOP_FOREVER false
|
||||||
|
#define DEFAULT_IGNORE_LOOP false
|
||||||
|
|
||||||
|
class vgmstreamPreferences : public CDialogImpl<vgmstreamPreferences>, public preferences_page_instance {
|
||||||
|
public:
|
||||||
|
//Constructor - invoked by preferences_page_impl helpers - don't do Create() in here, preferences_page_impl does this for us
|
||||||
|
vgmstreamPreferences(preferences_page_callback::ptr callback) : m_callback(callback) {}
|
||||||
|
|
||||||
|
//Note that we don't bother doing anything regarding destruction of our class.
|
||||||
|
//The host ensures that our dialog is destroyed first, then the last reference to our preferences_page_instance object is released, causing our object to be deleted.
|
||||||
|
|
||||||
|
|
||||||
|
//dialog resource ID
|
||||||
|
enum {IDD = IDD_CONFIG};
|
||||||
|
// preferences_page_instance methods (not all of them - get_wnd() is supplied by preferences_page_impl helpers)
|
||||||
|
t_uint32 get_state();
|
||||||
|
void apply();
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
//WTL message map
|
||||||
|
BEGIN_MSG_MAP(UsfPreferences)
|
||||||
|
MSG_WM_INITDIALOG(OnInitDialog)
|
||||||
|
COMMAND_HANDLER_EX(IDC_IGNORE_LOOP, BN_CLICKED, OnEditChange)
|
||||||
|
COMMAND_HANDLER_EX(IDC_LOOP_FOREVER, BN_CLICKED, OnEditChange)
|
||||||
|
COMMAND_HANDLER_EX(IDC_LOOP_NORMALLY, BN_CLICKED, OnEditChange)
|
||||||
|
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)
|
||||||
|
MSG_WM_HSCROLL(OnVScroll)
|
||||||
|
END_MSG_MAP()
|
||||||
|
private:
|
||||||
|
BOOL OnInitDialog(CWindow, LPARAM);
|
||||||
|
void OnEditChange(UINT, int, CWindow);
|
||||||
|
void OnVScroll(UINT nSBCode, UINT nPos, CTrackBarCtrl pScrollBar);
|
||||||
|
bool HasChanged();
|
||||||
|
void OnChanged();
|
||||||
|
|
||||||
|
const preferences_page_callback::ptr m_callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class vgmstream_prefs : public preferences_page_impl<vgmstreamPreferences>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
const char * get_name();
|
||||||
|
GUID get_guid();
|
||||||
|
GUID get_parent_guid();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -37,7 +37,7 @@ class input_vgmstream {
|
|||||||
t_filestats get_file_stats(abort_callback & p_abort);
|
t_filestats get_file_stats(abort_callback & p_abort);
|
||||||
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
service_ptr_t<file> m_file;
|
service_ptr_t<file> m_file;
|
||||||
char filename[260];
|
char filename[260];
|
||||||
t_input_open_reason currentreason;
|
t_input_open_reason currentreason;
|
||||||
@ -66,6 +66,7 @@ class input_vgmstream {
|
|||||||
short sample_buffer[OUTBUF_SIZE];
|
short sample_buffer[OUTBUF_SIZE];
|
||||||
|
|
||||||
void getfileinfo(char *filename, char *title, int *length_in_ms, int *sample_rate, int *channels, abort_callback & p_abort);
|
void getfileinfo(char *filename, char *title, int *length_in_ms, int *sample_rate, int *channels, abort_callback & p_abort);
|
||||||
|
void load_settings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -29,9 +29,11 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define APP_NAME "vgmstream plugin"
|
#define APP_NAME "vgmstream plugin"
|
||||||
#define PLUGIN_DESCRIPTION "vgmstream plugin " VERSION " " __DATE__
|
#define PLUGIN_DESCRIPTION "vgmstream plugin " VERSION " " __DATE__ "\n" \
|
||||||
|
"by hcs, FastElbja, manakoAT, and bxaimc\n" \
|
||||||
|
"foobar2000 plugin by Josh W\n\n" \
|
||||||
|
"http://sourceforge.net/projects/vgmstream"
|
||||||
#define PLUGIN_VERSION VERSION " " __DATE__
|
#define PLUGIN_VERSION VERSION " " __DATE__
|
||||||
#define INI_NAME "plugin.ini"
|
|
||||||
|
|
||||||
|
|
||||||
/* format detection and VGMSTREAM setup, uses default parameters */
|
/* format detection and VGMSTREAM setup, uses default parameters */
|
||||||
@ -103,7 +105,7 @@ void input_vgmstream::get_info(file_info & p_info,abort_callback & p_abort ) {
|
|||||||
p_info.info_set_int("channels", channels);
|
p_info.info_set_int("channels", channels);
|
||||||
p_info.info_set_int("bitspersample",16);
|
p_info.info_set_int("bitspersample",16);
|
||||||
p_info.info_set("encoding","lossless");
|
p_info.info_set("encoding","lossless");
|
||||||
p_info.info_set_bitrate(samplerate * 16 * channels);
|
p_info.info_set_bitrate((samplerate * 16 * channels) >> 10);
|
||||||
|
|
||||||
p_info.set_length(((double)length_in_ms)/1000);
|
p_info.set_length(((double)length_in_ms)/1000);
|
||||||
}
|
}
|
||||||
@ -120,6 +122,10 @@ bool input_vgmstream::decode_run(audio_chunk & p_chunk,abort_callback & p_abort)
|
|||||||
Sleep(10);
|
Sleep(10);
|
||||||
decoding = true;
|
decoding = true;
|
||||||
|
|
||||||
|
int CurPriority = GetThreadPriority(GetCurrentThread());
|
||||||
|
SetThreadPriority(GetCurrentThread(), thread_priority);
|
||||||
|
|
||||||
|
|
||||||
int max_buffer_samples = sizeof(sample_buffer)/sizeof(sample_buffer[0])/vgmstream->channels;
|
int max_buffer_samples = sizeof(sample_buffer)/sizeof(sample_buffer[0])/vgmstream->channels;
|
||||||
int l = 0, samples_to_do = max_buffer_samples, t= 0;
|
int l = 0, samples_to_do = max_buffer_samples, t= 0;
|
||||||
|
|
||||||
@ -163,9 +169,11 @@ bool input_vgmstream::decode_run(audio_chunk & p_chunk,abort_callback & p_abort)
|
|||||||
decode_pos_ms=decode_pos_samples*1000LL/vgmstream->sample_rate;
|
decode_pos_ms=decode_pos_samples*1000LL/vgmstream->sample_rate;
|
||||||
|
|
||||||
decoding = false;
|
decoding = false;
|
||||||
|
SetThreadPriority(GetCurrentThread(), CurPriority);
|
||||||
return samples_to_do==max_buffer_samples;
|
return samples_to_do==max_buffer_samples;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
SetThreadPriority(GetCurrentThread(), CurPriority);
|
||||||
decoding = false;
|
decoding = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -196,6 +204,7 @@ void input_vgmstream::decode_seek(double p_seconds,abort_callback & p_abort) {
|
|||||||
decode_pos_ms=decode_pos_samples*1000LL/vgmstream->sample_rate;
|
decode_pos_ms=decode_pos_samples*1000LL/vgmstream->sample_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input_vgmstream::input_vgmstream() {
|
input_vgmstream::input_vgmstream() {
|
||||||
vgmstream = NULL;
|
vgmstream = NULL;
|
||||||
decode_thread_handle = INVALID_HANDLE_VALUE;
|
decode_thread_handle = INVALID_HANDLE_VALUE;
|
||||||
@ -213,6 +222,7 @@ input_vgmstream::input_vgmstream() {
|
|||||||
ignore_loop = 0;
|
ignore_loop = 0;
|
||||||
decoding = false;
|
decoding = false;
|
||||||
seek_pos_samples = 0;
|
seek_pos_samples = 0;
|
||||||
|
load_settings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +247,7 @@ bool input_vgmstream::g_is_our_content_type(const char * p_content_type) {return
|
|||||||
bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension) {
|
bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension) {
|
||||||
if(!stricmp_utf8(p_extension,"2dx")) return 1;
|
if(!stricmp_utf8(p_extension,"2dx")) return 1;
|
||||||
|
|
||||||
|
if(!stricmp_utf8(p_extension,"aaap")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"aax")) return 1;
|
if(!stricmp_utf8(p_extension,"aax")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"acm")) return 1;
|
if(!stricmp_utf8(p_extension,"acm")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"adpcm")) return 1;
|
if(!stricmp_utf8(p_extension,"adpcm")) return 1;
|
||||||
@ -485,12 +496,15 @@ void input_vgmstream::getfileinfo(char *filename, char *title, int *length_in_ms
|
|||||||
static input_singletrack_factory_t<input_vgmstream> g_input_vgmstream_factory;
|
static input_singletrack_factory_t<input_vgmstream> g_input_vgmstream_factory;
|
||||||
|
|
||||||
DECLARE_COMPONENT_VERSION(APP_NAME,PLUGIN_VERSION,PLUGIN_DESCRIPTION);
|
DECLARE_COMPONENT_VERSION(APP_NAME,PLUGIN_VERSION,PLUGIN_DESCRIPTION);
|
||||||
|
VALIDATE_COMPONENT_FILENAME("foo_input_vgmstream.dll");
|
||||||
|
|
||||||
// File types go down here (and in the large chunk of IFs above
|
// File types go down here (and in the large chunk of IFs above
|
||||||
// these are declared statically, and if anyone has a better idea i'd like to hear it - josh.
|
// these are declared statically, and if anyone has a better idea i'd like to hear it - josh.
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("2DX Audio File (*.2DX)", 2dx);
|
DECLARE_MULTIPLE_FILE_TYPE("2DX Audio File (*.2DX)", 2dx);
|
||||||
|
|
||||||
|
DECLARE_MULTIPLE_FILE_TYPE("AAAP Audio File (*.AAAP)", aaap);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("AAX Audio File (*.AAX)", aax);
|
DECLARE_MULTIPLE_FILE_TYPE("AAX Audio File (*.AAX)", aax);
|
||||||
|
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("ACM Audio File (*.ACM)", acm);
|
DECLARE_MULTIPLE_FILE_TYPE("ACM Audio File (*.ACM)", acm);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("ADPCM Audio File (*.ADPCM)", adpcm);
|
DECLARE_MULTIPLE_FILE_TYPE("ADPCM Audio File (*.ADPCM)", adpcm);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("ADP Audio File (*.ADP)", adp);
|
DECLARE_MULTIPLE_FILE_TYPE("ADP Audio File (*.ADP)", adp);
|
||||||
|
26
fb2k/resource.h
Executable file
26
fb2k/resource.h
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by foo_input_vgmstream.rc
|
||||||
|
//
|
||||||
|
|
||||||
|
#define IDD_CONFIG 101
|
||||||
|
#define IDC_LOOP_COUNT 1000
|
||||||
|
#define IDC_FADE_SECONDS 1001
|
||||||
|
#define IDC_FADE_DELAY_SECONDS 1002
|
||||||
|
#define IDC_LOOP_NORMALLY 1003
|
||||||
|
#define IDC_LOOP_FOREVER 1004
|
||||||
|
#define IDC_IGNORE_LOOP 1005
|
||||||
|
#define IDC_THREAD_PRIORITY_SLIDER 1006
|
||||||
|
#define IDC_THREAD_PRIORITY_TEXT 1007
|
||||||
|
#define IDC_DEFAULT_BUTTON 1008
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user