Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: New SDK with foobar2000 v2.0 features released (2022-08-10) (Read 18273 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #25
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);
*/
}
}

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #26
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...



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






Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #27
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.
Microsoft Windows: We can't script here, this is bat country.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #28
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.
Microsoft Windows: We can't script here, this is bat country.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #29
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.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #30
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


Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #32
check the References solved. ty.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #33
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

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #34
Solved simply:
$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #35
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

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #36
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;
}

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #37
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

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #38
Solved swithing to MDd.


Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #40
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.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #41
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.
Microsoft Windows: We can't script here, this is bat country.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #42
SDK 2022-10-20 released
https://www.foobar2000.org/SDK

All foobar2000 v2.0 APIs (as of current beta) are now available.
Microsoft Windows: We can't script here, this is bat country.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #43
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.



Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #46
Hi, are there SDK resources of the UPnP MediaRenderer Output plugin?

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #47
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);

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #48
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.
Microsoft Windows: We can't script here, this is bat country.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #49
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