See playback_control::get_now_playing() (http://foosion.foobar2000.org/doxygen/latest/classplayback__control.html#acff581271588017c802fc51acfa8f318) and metadb_handle::get_path() (http://foosion.foobar2000.org/doxygen/latest/classmetadb__handle.html#ad0a42fb64297c961da9e2d2a5df3230d). There are also the examples in the foobar2000 SDK and my component tutorial (http://foosion.foobar2000.org/components/?id=tutorial1).
See playback_control::get_now_playing() (http://foosion.foobar2000.org/doxygen/latest/classplayback__control.html#acff581271588017c802fc51acfa8f318) and metadb_handle::get_path() (http://foosion.foobar2000.org/doxygen/latest/classmetadb__handle.html#ad0a42fb64297c961da9e2d2a5df3230d). There are also the examples in the foobar2000 SDK and my component tutorial (http://foosion.foobar2000.org/components/?id=tutorial1).
Thanks for your answer and your great tutorial, which're very helpful !! ( And so are the sdk comments )
I have achieved what I want but there's one thing left which I'm not sure I've done correctly ( or elegantly ).
It's about removing an item from a playlist.
I can't find an api for removing a single item.
Instead I find one - playlist_remove_items() - which can remove items ( of course including a item ).
So I use it to remove an item in a playlist like this:
t_size list_idx; // playlist index, assinged somewhere before
t_size item_idx; // item index being removed, assinged somewhere before
static_api_ptr_t<playlist_manager> list;
int item_count = list->playlist_get_item_count(list_idx);
t_size* list_bit = new t_size[item_count];
for (int i=0; i<item_count; ++i)
list_bit[i] = i;
list_bit[item_idx] = -1;
list->playlist_remove_items(list_idx, bit_array_wrapper_permutation(list_bit, item_count));
delete [] list_bit;
It looks, however, so verbose and inefficient...
Is there a better way to remove an item in a playlist ?
Well... I kept reading the sdk source and finally found a right way(at least much better than the one above) to do it:
list->playlist_remove_items(list_idx, bit_array_one(item_idx));
Cheers!