HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: Peter on 2022-08-10 14:25:37

Title: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-08-10 14:25:37
https://foobar2000.org/SDK
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Development:SDK_2022-08-10_Release_Notes

You can start preparing 64bit versions of your components already.

foobar2000 v2.0 beta will be released within the next two weeks, immediately after 1.6.12 stable.

Have fun.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2022-08-10 19:45:09
Wow, great job! It couldn't have been easy
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2022-08-10 21:09:13
PS: since SDK uses v143, "Included project files are for Visual Studio 2019" note on SDK page is no longer valid.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-11 04:03:34
Yay, I was able to make my Preferences go dark with 5 lines of code. Great stuff!

(https://i.imgur.com/nqJQQ13.png)

I had to comment out line 104 of DarkMode.h though...

Code: [Select]
void SubclassDialog(HWND);

If present, it won't compile.

Code: [Select]
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003: not enough arguments for function-like macro invocation 'SubclassDialog'
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003: void SubclassDialog(HWND);
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003:      ^
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059: syntax error: 'constant'
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059: void SubclassDialog(HWND);
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059:

VS2022 17.4 Preview 1, v143, stdcpplatest if it makes any difference
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-11 09:57:21
Just to follow on from the error I posted  above, I didn't have any issue with a different project using a modeless dialog. It worked just fine without changes.

(https://i.imgur.com/wc4FhYp.png)

I just need to figure out if I can change the text colour of the SysLink control on the bottom left.

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Florian on 2022-08-11 13:04:26
Yay, I was able to make my Preferences go dark with 5 lines of code. Great stuff!
Noticed that the surrounding preferences dialog is rendered in light mode in your screenshot. I've observed the same for my component and just learned that (also) returning preferences_state::dark_mode_supported from your get_state() is the way to tell foobar2000 to stay in dark mode there.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-11 14:57:10
I'm still slumming it with the publicly available v1.6.12 so the rest of the preferences being light was expected. I had to hardcode wanting dark mode rather than using fb2k APIs which will be available with v2.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: koupa on 2022-08-11 15:53:23
Please don't make these statements. You just release the SW. We are people with anxiety problems. Don't add more to us.

I'll wait for it.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Fabcore on 2022-08-11 17:38:57
Great!
Now time to let them devs of the old plugins to know this
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mudlord on 2022-08-12 10:48:07
Please don't make these statements. You just release the SW. We are people with anxiety problems. Don't add more to us.

I'll wait for it.

X
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-12 13:11:36
I had to comment out line 104 of DarkMode.h though...

Code: [Select]
void SubclassDialog(HWND);

If present, it won't compile.

Code: [Select]
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003: not enough arguments for function-like macro invocation 'SubclassDialog'
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003: void SubclassDialog(HWND);
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): warning C4003:      ^
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059: syntax error: 'constant'
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059: void SubclassDialog(HWND);
3>Z:\Git\foo_jscript_panel3\foobar2000-sdk\libPPUI\DarkMode.h(104,7): error C2059:

I've isolated the cause of this. Including windowsx.h for the Columns UI SDK is the problem.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: koupa on 2022-08-12 16:06:38
Please don't make these statements. You just release the SW. We are people with anxiety problems. Don't add more to us.

I'll wait for it.

[attach type=image]23039[/attach]

You didn't get the irony. We love that software despite the rising of alternative solutions like Roon and Plex. And of course the streaming services. Although I use the above programs F2K is my absolute best for local listening. It's an excellent program with very little flaws.

But we want it to come to a more modern era with 64bit support and maybe new tricks. When Peter wrote that he would release it in a few days we can't wait. We want it NOW. So it would be better not to dad it announced.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: lvqcl on 2022-08-12 17:20:46
We?

"Only kings, presidents, editors, and people with tapeworms have the right to use the editorial ‘we’." (С) probably Mark Twain
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: koupa on 2022-08-12 18:04:43
WOW!!!

The first guy called me an idiot and the second megalomaniac. I'm old enough to care if Iget offended from an anonymous guy on the internet.

BUT I DON'T CHANGE MY WORDS. I'm still excited like a small child waiting for Christmas when there are updates on software I use everyday. F2K is one of that. It's like Swiss army knife. It can do anything with music. From playing to tagging and file management.

And WE are a lot of people to understand how a computer works and what are the benefits of evolution. If WE weren't aware of that, WE would still be on 640KB of RAM maximum as Bill Gates suggested back in the 80's.

A few days ago Winamp team released a "new" version. You can test it and see what I mean. It has a lot of old code which is not optimized for the new OS's. If you load a ton of music it is very slow. But F2K which is actively maintained and upgraded to the newest OS system calls is very responsive. Peter gave some information about the new version which may clear why I used the word WE.

I have many examples of people denying that WE. In computing things run so fast that a slight delay of releasing may be catastrophic for the project. A few years ago some guy insisted on 32bit video processing. He thought that it was enough. But when Blu-Ray's finally were decrypted and we jumped from 8.5GB DVDrip to 85 Remux he changed his mind. The competitors had worse SW but it was already 64bit and the processing was very easy. So he changed his mind and finally released a 64bit version.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Chibisteven on 2022-08-12 18:09:15
I do have a question for @Peter : Is it possible to switch between 32-bit floats and 64-bit floats internally in the 64-bit version or is 64-bit version only 64-bit float?  Moving stuff between some effect and conversion DSPs and certain freeware DAWs that top out at 32-bits floats comes to mind.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-12 21:16:57
So these dark mode helpers have it ridiculously easy to implement dark mode for all my dialogs so huge thanks to Peter for that.

But I'm a bit stumped with this menu/toolbar because it doesn't appear as any kind of window when checking it out with Spy++?? I don't even what kind of control it is??? It's fair to say I have no idea what I'm doing....  :))  :))

(https://i.imgur.com/i5OfxzF.png)

Bits of code...

Code: [Select]
IDR_MENU MENU
BEGIN
    POPUP "DUMMY"
    BEGIN
        MENUITEM "DUMMY", IDC_STATIC
    END
END

It's a modal dialog...

Code: [Select]
class CDialogConfigure : public CDialogImpl<CDialogConfigure>, public fb2k::CDarkModeHooks
{
};

Then I'm using GetMenu in my OnInitDialog

Code: [Select]
auto menu = wil::unique_hmenu(GetMenu());
auto file = wil::unique_hmenu(CreateMenu());
auto samples = wil::unique_hmenu(CreateMenu());
auto licenses = wil::unique_hmenu(CreateMenu());
auto help = wil::unique_hmenu(CreateMenu());

// append stuff goes here

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: ThutLotMax on 2022-08-12 22:01:45
Does this effect the current state of Visual Studio Compatibility at all?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: ThutLotMax on 2022-08-12 22:03:06
Perhaps a stupid question but Is there a ""Docker"" Or VM available with the development environment ready to go?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mudlord on 2022-08-12 22:18:45
Well in my source tree I had the FB2K SDK already in it.

I most likely will update it with the *public* code tree.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Melchior on 2022-08-13 15:35:58
thx Peter for the timetable update.
I can't wait to test out Foobar2000 (v2.0.0).
now its just a wait till all my favorite videogame music components are hopefully updated for 64bit.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mudlord on 2022-08-13 23:24:13
I do have a question for @Peter : Is it possible to switch between 32-bit floats and 64-bit floats internally in the 64-bit version or is 64-bit version only 64-bit float?  Moving stuff between some effect and conversion DSPs and certain freeware DAWs that top out at 32-bits floats comes to mind.

No. 64bit builds are hard coded to use audio_sample which is defined as a double. DSPs would need to be ported or rewritten to take advantage of doubles. My SoundTouch based stuff comes to mind, rest were easily ported, minus the Windows DMO stuff, though I can use DMO/EAX emulation for those in future.

You could internally do 32bit > 64bit and back I suppose.

I want to at some point lean further and assume SSE2 to SSE4/AVX, even.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-08-14 10:58:21
I do have a question for @Peter : Is it possible to switch between 32-bit floats and 64-bit floats internally in the 64-bit version or is 64-bit version only 64-bit float?  Moving stuff between some effect and conversion DSPs and certain freeware DAWs that top out at 32-bits floats comes to mind.
It's the format used to transfer data between different components, a part of the specification - changing it breaks all components that touch it.
Since this is the last historical opportunity to make such change (64bit foobar2000 can't load old components), I opted for changing the format to be futureproof, as there will not be another new major release that needs new components.
If your specific audio processing library needs 32bit float, that's cool, conversion is practically free compared to any other kind of audio workload, especially now that SSE2 or ARM Neon available on every machine running foobar2000.

So these dark mode helpers have it ridiculously easy to implement dark mode for all my dialogs so huge thanks to Peter for that.

But I'm a bit stumped with this menu/toolbar because it doesn't appear as any kind of window when checking it out with Spy++?? I don't even what kind of control it is??? It's fair to say I have no idea what I'm doing....  :))  :))
Heh, I don't use normal menus anywhere, only rebar control with text-only toolbar... Will investigate this for the next SDK update.

Does this effect the current state of Visual Studio Compatibility at all?
VS2017 with Windows 10 SDK works, after manually setting proper toolchain & SDK versions in all projects.
Dark mode stuff needs declarations from the Windows 10 SDK.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: DJ Graco on 2022-08-15 22:47:12
Hello,
very interesting info!
I can't wait! :)
I will test and if I notice any bugs, I will of course report them.
One more question. Did I understand correctly that foobar2000 v2.0 will only be 64-bit without a separate 32-bit build, or will be maintained in two separate versions as some other programs are distributed?
Kind regards
DJ Graco
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-16 00:18:12
IIUC, there will be 3 builds. 32bit, 64bit and ARM64.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Melchior on 2022-08-16 02:28:32
IIUC, there will be 3 builds. 32bit, 64bit and ARM64.
nice.
I have been looking forward to a native 64bit Windows version for some time.. lol
all that is left is to see to updates to the videogame music components I use everyday.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-23 05:07:56
Stupid question time because I am stupid....  :P

If iterating a handle list in a threaded_process_callback, is there any point in using metadb_v2::get()->queryMultiSimple up front??

Code: [Select]
	void run(threaded_process_status& status, abort_callback& abort) override
{
auto recs = metadb_v2::get()->queryMultiSimple(m_handles);
const size_t count = m_handles.get_count();

for (size_t i = 0; i < count; ++i)
{
do_something_new(handles[i], recs[i]);

/*
or nuke the auto recs...
and

auto rec = handles[i]->query_v2_();
do_something_new(handles[i], rec);
*/
}
}
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-23 05:49:53
And back to Dark Mode again. How can I style my list view control so it has no border.

edit: solved with ::SetWindowLongPtrW(m_list, GWL_EXSTYLE, 0);

Your Properties dialog looks great...

(https://i.imgur.com/BPVMCwb.png)

I'd like to lose the border too....

(https://i.imgur.com/G47bsds.png)



Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-08-26 11:26:42
If iterating a handle list in a threaded_process_callback, is there any point in using metadb_v2::get()->queryMultiSimple up front??
queryMultiSimple() will be somewhat faster (access the database using batch queries instead of one by one) but load all affected track infos into memory at the same time.
In such cases, it's recommended to use queryMulti() methods with callbacks and doing your info processing from the callbacks, avoiding loading all the info at once. And finally, queryMultiParallel() schedules multiple worker threads for you, which is even faster with thousands of items.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-08-26 11:40:41
Re listview dark mode,

My implementation of this is even crazier than the rest of dark mode stuff -
MS listview outright defies proper darkening, so instead of rewriting every use case to use something else, I wrote a wrapper to drop CListControl in place of each one... and make it interop with listview API. So, issues are to be expected. I just had to add basic custom draw support to it because spectrogram colors dialog needed it.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-26 12:00:12
I'll look at the other queryMulti methods, thanks.

Not sure if it's been reported/you know yourself but I had an issue with yesterdays v2 SDK where this code won't compile

Code: [Select]
for (auto ptr : track_property_provider::enumerate())
{
ptr->enumerate_properties_helper(m_handles, nullptr, callback, fb2k::noAbort);
}

You can't pass nullptr as the 2nd arg as it's ambiguous.

Lines 59-65 of track_property.h

Quote
   //! Helper; calls modern versions of this API where appropriate.
   //! @param items List of tracks to enumerate properties on.
   //! @param info Callback object to fetch info from. Pass null to use a generic implementation querying the metadb.
   //! @param callback Callback interface receiving enumerated properties.
   //! @param abort The aborter for this operation.
   void enumerate_properties_helper(trackListRef items, track_property_provider_v3_info_source * info, track_property_callback_v2 & callback, abort_callback & abort);
   void enumerate_properties_helper(trackListRef items, track_property_provider_v5_info_source* info, track_property_callback_v2& callback, abort_callback& abort);

I updated mine to use a v5 source - just thought I'd mention it.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-27 22:34:57
I'm porting a old component. I get this error, how to solve?
Code: [Select]
Severity	Code	Description	Project	File	Line	Suppression State
Error LNK1120 5 unresolved externals foo_ext K:\foo_ext\foobar2000\foo_ext\Release\foo_ext.dll 1
Error LNK2001 unresolved external symbol "bool __cdecl listview_helper::select_single_item(struct HWND__ *,unsigned int)" (?select_single_item@listview_helper@@YA_NPAUHWND__@@I@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "bool __cdecl listview_helper::set_item_text(struct HWND__ *,unsigned int,unsigned int,char const *)" (?set_item_text@listview_helper@@YA_NPAUHWND__@@IIPBD@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "unsigned int __cdecl listview_helper::insert_column(struct HWND__ *,unsigned int,char const *,unsigned int)" (?insert_column@listview_helper@@YAIPAUHWND__@@IPBDI@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "unsigned int __cdecl listview_helper::insert_item(struct HWND__ *,unsigned int,char const *,long)" (?insert_item@listview_helper@@YAIPAUHWND__@@IPBDJ@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "void __cdecl WIN32_OP_FAIL(void)" (?WIN32_OP_FAIL@@YAXXZ) foo_ext K:\foo_ext\foobar2000\foo_ext\foobar2000_sdk_helpers.lib(win32_dialog.obj) 1
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-28 04:35:26
Assuming you have all projects added to the same solution in Visual Studio, you probably need to check the References are all enabled like this...

(https://i.imgur.com/cbuAHhb.png)
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-28 05:41:49
check the References solved. ty.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-28 06:35:53
x32 compile fine.
x64 have 177 errors, as:
Code: [Select]
Severity	Code	Description	Project	File	Line	Suppression State
Error LNK1120 169 unresolved externals foo_ext K:\foo_ext\foobar2000\foo_ext\x64\Release\foo_ext.dll 1
Error LNK2001 unresolved external symbol "bool __cdecl __ExceptionPtrToBool(void const *)" (?__ExceptionPtrToBool@@YA_NPEBX@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\foobar2000_SDK.lib(input.obj) 1
Error LNK2001 unresolved external symbol "class ATL::CAtlBaseModule ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@) foo_ext K:\foo_ext\foobar2000\foo_ext\config.obj 1
Error LNK2001 unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z) foo_ext K:\foo_ext\foobar2000\foo_ext\foo_ext.obj 1
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-31 00:29:47
Solved simply:
$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-31 06:47:53
Got my first crash report (yay) and it pointed towards to this...

Code: [Select]
class MetadbDisplayFieldProvider : public metadb_display_field_provider_v2
{
public:
bool process_field_v2(uint32_t index, metadb_handle* handle, const metadb_v2::rec_t& rec, titleformat_text_out* out)
{
// rec.info was empty so I added a check but is this expected?? if (rec.info.is_empty()) return false;
const auto hash = get_hash(rec, handle->get_location());
...
}

bool process_field(uint32_t index, metadb_handle* handle, titleformat_text_out* out) override
{
return process_field_v2(index, handle, handle->query_v2_(), out);
}
}

My get_hash method..

Code: [Select]
metadb_index_hash get_hash(const metadb_v2::rec_t& rec, const playable_location& location)
{
return g_client->transform(rec.info->info(), location);
}

All surrounding code is here: https://github.com/marc2k3/foo_lastfm_playcount_sync/blob/1bf24fd972cf62e313641d3026e7f985449e56f7/src/DB.cpp#L79
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-08-31 07:54:49
Just as a follow up to the above, I also had a report that this was failing too...

Code: [Select]
	HashSet get_hashes(metadb_handle_list_cref handles)
{
HashSet hashes; // std::set<metadb_index_hash>
auto recs = metadb_v2::get()->queryMultiSimple(handles);
const size_t count = handles.get_count();

for (size_t i = 0; i < count; ++i)
{
// recs[i].info was null again - this method is only triggered after running menu commands so sometime after startup
const auto hash = get_hash(recs[i], handles[i]->get_location());
hashes.emplace(hash);
}
return hashes;
}
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-31 18:11:28
I am trying to port foo_bpm to x64.
I have a block. How to solve?
Code: [Select]
Severity	Code	Description	Project	File	Line	Suppression State
Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in bpm_auto_analysis.obj foo_bpm e:\foobar2000\foo_bpm\pfc.lib(threads.obj) 1
Error LNK2001 unresolved external symbol __imp__lround foo_bpm e:\foobar2000\foo_bpm\pfc.lib(other.obj) 1
Error LNK2001 unresolved external symbol __imp__llround foo_bpm e:\foobar2000\foo_bpm\pfc.lib(other.obj) 1
Error LNK2001 unresolved external symbol __imp___aligned_malloc foo_bpm e:\foobar2000\foo_bpm\pfc.lib(other.obj) 1
Error LNK2001 unresolved external symbol __imp___aligned_realloc foo_bpm e:\foobar2000\foo_bpm\pfc.lib(other.obj) 1
Error LNK2001 unresolved external symbol __imp___aligned_free foo_bpm e:\foobar2000\foo_bpm\pfc.lib(other.obj) 1
Error LNK2001 unresolved external symbol __imp___strdup foo_bpm e:\foobar2000\foo_bpm\pfc.lib(string_base.obj) 1
Error LNK2001 unresolved external symbol __imp__rand foo_bpm e:\foobar2000\foo_bpm\pfc.lib(sort.obj) 1
Error LNK2001 unresolved external symbol __imp__srand foo_bpm e:\foobar2000\foo_bpm\pfc.lib(sort.obj) 1
Error LNK2001 unresolved external symbol __imp__strcat_s foo_bpm e:\foobar2000\foo_bpm\foobar2000_SDK.lib(file_info.obj) 1
Error LNK2001 unresolved external symbol __imp___wfopen foo_bpm e:\foobar2000\foo_bpm\foobar2000_SDK.lib(filesystem.obj) 1
Error LNK2001 unresolved external symbol __imp__llroundf foo_bpm e:\foobar2000\foo_bpm\foobar2000_SDK.lib(audio_chunk.obj) 1
Error LNK2001 unresolved external symbol __imp__lroundf foo_bpm e:\foobar2000\foo_bpm\foobar2000_SDK.lib(audio_chunk.obj) 1
Error LNK2001 unresolved external symbol __except_handler4_common foo_bpm e:\foobar2000\foo_bpm\MSVCRT.lib(chandler4gs.obj) 1

Severity Code Description Project File Line Suppression State
Error LNK1120 13 unresolved externals foo_bpm E:\foobar2000\foo_bpm\Release\foo_bpm.dll 1
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Forfit on 2022-08-31 19:51:33
Solved swithing to MDd.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-09-09 06:22:31
Is library_index::get()->search more optimised v2 or is it just a convenience wrapper that is easier to use than get_all_items/test_multi/filter_mask?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-09-24 00:47:53
Feature request: Would it be possible to have a p_fromhook arg for library_callback::on_items_modified(or v2) like we have with metadb_io_callback::on_changed_sorted.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-10-20 21:22:45
Late reply.
library_index search uses search index and should in most cases be faster (or much faster) than filtering all library content.
Unfortunately not every query can be translated to search index operations (avoiding title formatting helps).
Also, if your query looks like: "cond1 AND cond2 AND cond3 ...", and some of the conditions (but not all of them) are supported by search index, a hybrid lookup is used - filtering is applied to results of index search by these conditions. So, if you have "rating IS 5 AND <insert some evil query here>", tracks with rating of 5 are fetched efficiently and the inefficient part will only run on these instead of the whole library.

p_fromhook arg, noted.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-10-20 21:24:21
SDK 2022-10-20 released
https://www.foobar2000.org/SDK

All foobar2000 v2.0 APIs (as of current beta) are now available.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-10-26 13:14:44
Thanks for the latest release but I think the forward slash replacement in pathUtils charReplaceModern is a typo - you've just replaced the old unicode char with bog standard forward slash. Because it's still illegal, it now gets replaced with an underscore because of the extra sanity check in replaceIllegalNameChars

And it doesn't match the behaviour of the modern replacements in file operations or the converter either. Forward slashes there are hyphens which means the same code is not being used. It would be nice if the behaviour was aligned.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Topia on 2022-10-29 08:48:51
SDK 2022-10-20 released
https://www.foobar2000.org/SDK
I can't find ARM64 shared library (shared-ARM64.lib) in that SDK archive. Could you confirm it or is something wrong on my side?
Thanks,
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-11-16 20:19:27
p_fromhook arg, noted.

Thanks for this. It's much appreciated.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: HPecina on 2022-11-30 03:20:20
Hi, are there SDK resources of the UPnP MediaRenderer Output plugin?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: oblikoamorale on 2022-12-01 18:39:55
A component is compiled against 2022-08-10 SDK.

Autoplaylist is created with autoplaylist_manager's add_client_simple(). Consequent calling of remove_client() on said playlist completely removes search results (empties playlist) in 2.0 beta 15, while in 1.6.14 (and before, for as far as I remember) search results stay in playlist, and it's just gets stripped of autoplaylist status.

Is this the intended change and I should adopt a different strategy? Thanks.

Sample code:
Code: [Select]
auto apm = autoplaylist_manager::get();
auto plm = playlist_manager::get();
playlist = plm->get_active_playlist();
apm->add_client_simple(query, sort_pattern, playlist, autoplaylist_flag_sort);
if (apm->is_client_present(playlist))
    apm->remove_client(playlist);
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-12-02 12:31:47
Wrong.

It doesn't clear results. It now searches asynchronously, and by the time you drop the client it hasn't even fetched the results.

If you just want to add search results to a playlist, use library_index to fetch results if available, run whole library content via search_filter otherwise.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-12-11 16:31:41
Feature request: would it possible to get playback stat values via the SDK without title formatting. Since the changes in Beta 16, %rating% now falls back to metadata from tags which is not desirable. I'd rather know the playback stats value is not set.

I realise this would be super low priority with all the other projects you have on the go but it would be nice at some point in the future.

Thanks again for all the updates.

edit: thinking about it, I might be able to abuse track_property_callback_v2 to get what I want. scratch that, could work for single items, not so good for a playlist
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-12-29 10:44:42
I'm having an issue where using cfg_window_placement_v2 is causing crashes on shutdown.

It works perfectly fine when the target version is 81 for fb2k v2 only. It seems to be problematic if the target version is set to 80 for compatibility with fb2k v1. Using the latest 2022-11-16.

Code: [Select]
class CDialogBlah : public CDialogImpl<CDialogReport>, public cfg_window_placement_v2
{
public:
CDialogBlah() : cfg_window_placement_v2(guids::window_placement) {}

BEGIN_MSG_MAP_EX(CDialogBlah)
MSG_WM_INITDIALOG(OnInitDialog)
COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
END_MSG_MAP()

enum { IDD = IDD_DIALOG_BLAH };

BOOL OnInitDialog(CWindow, LPARAM)
{
apply_to_window(*this, false);
return TRUE;
}

void OnCancel(uint32_t, int nID, CWindow)
{
read_from_window(*this);
EndDialog(nID);
}
};

Crash report is pointing here...

(https://i.imgur.com/fDfGAXc.png)
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2022-12-30 13:13:53
Documentation error, should make it more clear how this class works.
Basically, do not derive from cfg_window_placement.
It's a cfg_var class meant for static objects.
Just have a static instance and use it from your dialog object.
What you did works by accident in new fb2k config system but wasn't really meant to.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2022-12-30 13:41:28
Thanks for the correction. I've updated one of my projects here... :-X

https://github.com/marc2k3/foo_playlist_fix/commit/acccefc82fdebbb0b5d0758eb2ce33f53d778e04

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mmote on 2023-01-02 14:16:15
Re listview dark mode,

My implementation of this is even crazier than the rest of dark mode stuff -
MS listview outright defies proper darkening, so instead of rewriting every use case to use something else, I wrote a wrapper to drop CListControl in place of each one... and make it interop with listview API. So, issues are to be expected. I just had to add basic custom draw support to it because spectrogram colors dialog needed it.

I've got a listview with multiple columns. The list gets populated using ListView_InsertItem and ListView_SetItemText. When dark mode has been applied, it won't show the text that was added using ListView_SetItemText. Any chance for a fix?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: MordredKLB on 2023-02-12 19:46:41
@Peter  I've got a component that adds a search to an autoplaylist and does:
Code: [Select]
apm->add_client_simple(param1.toString(), cfg.query.sortpattern, playlist, autoplaylist_flag_sort);
// force sort so results are always returned sorted, and then clear so user can reorder if needed
apm->set_client_flags(playlist, 0);
This works <2.0 because the search isn't async, but now that it is, the force_sort flag is cleared before any results are returned. Is there a way to make it wait for the autoplaylist search/update to finish?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-02-12 20:53:35
 cfg.query.sortpattern infers you have a preference for the sort pattern. Add a new force sort checkbox next to and you don't need to change the flags.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: MordredKLB on 2023-02-13 00:07:59
cfg.query.sortpattern infers you have a preference for the sort pattern. Add a new force sort checkbox next to and you don't need to change the flags.
Yeah, that's probably a better idea.

On an unrelated issue, I've been trying to update to using the latest SDK and rebuild some of my old components. I was able to get everything working for x32, but completely stymied on x64. Getting dozens of these errors:
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in contextmenu.obj

It goes away if I change the configuration type of the main component (https://github.com/kbuffington/foo_musicbrainz/tree/x64) to static lib, but obviously that's not useful when trying to create .dll components. I've double checked the settings of all the required SDK components, with another component (not of mine) that does build in x64 and they're identical. All of the SDK projects build static libs, and then the component builds a DLL without the linker complaining at all. No idea what I could possibly be missing, and why I can easily build a .dll in x86 but not x64 with seemingly identical settings.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-02-13 00:36:56
Double check your settings under the properties page>C/C++/Code Generation

Make sure the configuration is Release and platform combo box is set to all platforms because you want the same for 32bit/64bit.

Then check Runtime Library and make sure it's Multi-Threaded DLL (/MD). This corresponds with the default settings of the current SDK.

edit: also double check the configuration manager and make sure the platform for all projects matches the solution platform.

edit2: not sure how much it matters but you should also check your PFC project is Release FB2K and not just Release here...

(https://i.imgur.com/eTTYTPI.png)




Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: MordredKLB on 2023-02-13 01:02:16
Make sure the configuration is Release and platform combo box is set to all platforms because you want the same for 32bit/64bit.

Then check Runtime Library and make sure it's Multi-Threaded DLL (/MD). This corresponds with the default settings of the current SDK.
THANK YOU! Somehow I had checked every dependency and they were all correct, but the main component was set to Multi-Threaded and not Multi-Threaded DLL. I swear I checked every property multiple times and somehow missed that one. Building perfectly in x64 now. I owe you a beer. :)
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-02-22 18:44:31
@Peter, I think there's a bug with get_sort_priority in contextmenu_item_lambda . It should return m_sortPriority but currently returns 0.

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-02-23 09:08:24
Minor doc nit. acquireTransactionScope is marked as obsolete in configStore but the example at the bottom of the page still uses it...

https://github.com/marc2k3/foobar2000-sdk-2/blob/4f0efa3d624b4fc0a4680a07b127cf6d0135bf2c/foobar2000/SDK/configStore.h#L118

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-04-08 14:31:14
I'd like to request the ability to bulk add playlist queue items. It seems the only way to re-order the current queue or insert new items at a given point is to flush the queue and then add them back one at a time which triggers the callback more than is necessary. If I missed a way to do this, I'll take any pointers.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: MordredKLB on 2023-05-05 07:08:03
I updated to the latest SDK and now I'm seeing weird NuGet errors:
Code: [Select]
1>D:\Source\foo_httpcontrol\foo_httpcontrol\lib\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj(607,5): error : 
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\wtl.10.0.10320\build\native\wtl.targets.
and same for LibPPUI. If I do NuGet Package Restore though on the solution, I get "All packages are already installed and there is nothing to restore."

It feels like the relative path is wrong, but I'm not sure what it's relative to. If I delete the packages folder in the project and rerun NuGet restore it gets added back so it definitely thinks it goes there.

Edit: Nevermind, it was the relative paths from the SDK projects. They'd originally been altered but overwriting the SDK caused those changes to get screwed up. All working now.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-05-27 15:17:32
2023-05-10 SDK, small typo:
SDK/library_callbacks.h: 18 :
`cycle called due to actual tags changed or dispaly hook operations?`
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-05-27 15:37:53
What's the difference between `inWorkerThread` and `inCpuWorkerThread` in SDK 2023-05-10/SDK/threadPool.h?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mmote on 2023-05-31 14:02:49
I've got a listview with multiple columns. The list gets populated using ListView_InsertItem and ListView_SetItemText. When dark mode has been applied, it won't show the text that was added using ListView_SetItemText. Any chance for a fix?

I'm attaching a sample project built using the latest SDK that demonstrates this issue. All the relevant code is located in CMyPreferences::OnInitDialog
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-05-31 14:43:22
Implementing list views with libPPUI ensures dark mode works. Look at the three files prefixed with listcontrol in the foo_sample folder.

BTW, you typically want m_hooks.AddDialogWithControls(*this); as the last line before the return statement in your OnInitDialog.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mmote on 2023-05-31 16:07:00
Implementing list views with libPPUI ensures dark mode works. Look at the three files prefixed with listcontrol in the foo_sample folder.
Thanks, I'll check that out!

Quote
BTW, you typically want m_hooks.AddDialogWithControls(*this); as the last line before the return statement in your OnInitDialog.
That's the way it was in the official sample code. I also had problems putting that call at the end of the function, because it would re-create some controls that I had previously initialized.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-05-31 16:47:51
Well here's a real world example from one of my components...

(https://i.imgur.com/tZ85ZIF.png)

I've attached the source code. It contains 2 list control instanaces (one CListControlSimple, one CListControlOwnerData).

Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: mmote on 2023-05-31 18:02:01
Well here's a real world example from one of my components...

Thanks! Switching to CListControlSimple was actually very straightforward  :)
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-03 20:47:22
@Peter I've tried using built-in thread pool and encountered a weird behaviour: it seems that thread is not initialized with `CoInitialize` on creation and `CoInitialize` is invoked only later on. This means that COM calls can't be used in worker threads reliably.

Problem is, only thread owner knows arguments for CoInitialize (and must call CoUninitialize before thread destruction as well), so it shouldn't be called by thread user (unless they want to risk breaking the rest of fb2k).

Could you add CoInitialize during worker thread creation to prevent this issue?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: Peter on 2023-06-04 10:18:39
You should call CoInitialize() + CoUninitialize() yourself if you need COM. As far as I can see, everything in my code matches CoInitialize() with CoUninitialize(), so you worker thread clients should always assume that COM hasn't been initialized on entry.

If I change it now and you rely on prior COM init, your code no longer works under foobar2000 v2.0, so you need a workaround on your side anyway.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-04 19:32:42
You should call CoInitialize() + CoUninitialize() yourself if you need COM. As far as I can see, everything in my code matches CoInitialize() with CoUninitialize(), so you worker thread clients should always assume that COM hasn't been initialized on entry.
Oh, you mean CoInitialize() + CoUninitialize() in the task? Right, that works, thanks :)
But, still, it seems that some fb2k tasks are 'leaking', because otherwise my tasks (without explicit CoInitialize) should've always failed, but they work after GUI is fully initialized. This is reliably reproduceable on latest non-preview version of fb2k with zero 3rd-party components installed (except for mine, of course).
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: musicmusic on 2023-06-04 21:03:39
There is only one multi-threaded apartment per process, and you can end up implicitly using it if another thread initialised it. See https://devblogs.microsoft.com/oldnewthing/20130419-00/?p=4613.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-04 22:08:32
You learn something new every day... Thanks!
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-17 17:39:03
@Peter I'm trying to use new search api, but either I'm doing something wrong or there are missing definitions in SDK.

The following code fails to compile (on `as_list_of` line)
Code: [Select]
const auto pSearchFilter = search_filter_manager_v3::get()->create( query.c_str() );
const auto pSearchIndex = search_index_manager::get()->get_library_index();
const auto pArray = pSearchIndex->search( pSearchFilter, nullptr, 0, fb2k::mainAborter() );
// Per docs: "Safe to use arr->as_list_of<metadb_handle>() to get a pfc::list_base_const_t<metadb_handle_ptr>"
auto handles = pArray->as_list_of<metadb_handle>();

Error:
Spoiler (click to show/hide)
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-17 21:30:32
It is safe to call metadb_handles methods off-thread? E.g. `get_subsong_index` or `format_title`
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-17 21:39:28
@Peter I'm trying to use new search api, but either I'm doing something wrong or there are missing
I've figured out this one: `as_list_of` does not return `metadb_handle_list`, but rather a reference.
Hence `auto` does not work here, `metadb_handle_list handles = pArray->as_list_of<metadb_handle>();` should be used instead
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: fbuser on 2023-06-17 22:14:52
Hence `auto` does not work here, `metadb_handle_list handles = pArray->as_list_of<metadb_handle>();` should be used instead
Or
Code: [Select]
auto& handles = pArray->as_list_of<metadb_handle>();
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: TheQwertiest on 2023-06-19 00:25:14
is there a way to load only external album art (i.e. ignore embedded)?
I've found `album_art_manager_config`, but it requires to supply search patterns for all the types. And since fb2k search patterns are not exposed via API, it makes it unusable for my scenario.

[EDIT] On that note: is it possible to distinguish if the loaded art source was external or embedded?
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-06-19 09:40:53
as_list_of returns a const ref so it's either metadb_handle_list_cref or const auto&.

If you want a normal handle list then...

Code: [Select]
metadb_handle_list handles;
handles.add_items(arr->as_list_of....)

As for embedded art, it should be down to user choice as per the advanced preferences. I don't think there is a way to ignore it.

And you can check if it's embedded yourself. The album art methods you inherited from WSH/JSP already show how to get the image path. It will match the handle path if it's embedded.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-09-11 09:40:56
@Peter, I think there's a bug with get_sort_priority in contextmenu_item_lambda . It should return m_sortPriority but currently returns 0.

This bug I reported several months ago is still present in the latest SDK from a few days ago.

Viewable on musicmusic's copy of the SDK here...

https://github.com/reupen/foobar2000-sdk-unmodified/blob/128badc9aedcca6b569ca8a31d0b2b629f74e8b7/foobar2000/SDK/contextmenu.h#L361
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2023-09-14 11:48:25
I see the above issue is fixed now. Thanks.
Title: Re: New SDK with foobar2000 v2.0 features released (2022-08-10)
Post by: marc2k3 on 2024-01-30 16:12:09
I see the changelog for 2.1.2 has this entry...

Quote
Fixed poor performance of adding lots of items to Playback Queue.

I tested with the native context menu item and see playback_queue_callback::on_changed only gets called once which is nice but still no difference for 3rd parties. I've posted about that before...

I'd like to request the ability to bulk add playlist queue items. It seems the only way to re-order the current queue or insert new items at a given point is to flush the queue and then add them back one at a time which triggers the callback more than is necessary. If I missed a way to do this, I'll take any pointers.

Will this be available for us mere mortals? :P