IPB

Welcome Guest ( Log In | Register )

> foobar2000 Development Forum Rules

This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).

 
Reply to this topicStart new topic
How to get the current playing file path?
lowzoom
post Oct 31 2011, 09:24
Post #1





Group: Members
Posts: 10
Joined: 31-October 11
Member No.: 94819



Which api can I use to get the playing file info such as its path ?
A snippet of code sample will be greatly appreciated !
Thx.
Go to the top of the page
+Quote Post
foosion
post Oct 31 2011, 10:37
Post #2





Group: FB2K Moderator (Donating)
Posts: 4484
Joined: 24-February 03
Member No.: 5153



See playback_control::get_now_playing() and metadb_handle::get_path(). There are also the examples in the foobar2000 SDK and my component tutorial.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
lowzoom
post Oct 31 2011, 16:03
Post #3





Group: Members
Posts: 10
Joined: 31-October 11
Member No.: 94819



QUOTE (foosion @ Oct 31 2011, 10:37) *
See playback_control::get_now_playing() and metadb_handle::get_path(). There are also the examples in the foobar2000 SDK and my component tutorial.

Thanks for your answer and your great tutorial, which're very helpful !! laugh.gif ( 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:

CODE
    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 ?

This post has been edited by lowzoom: Oct 31 2011, 16:06
Go to the top of the page
+Quote Post
lowzoom
post Nov 1 2011, 01:17
Post #4





Group: Members
Posts: 10
Joined: 31-October 11
Member No.: 94819



Well... I kept reading the sdk source and finally found a right way(at least much better than the one above) to do it:

CODE
list->playlist_remove_items(list_idx, bit_array_one(item_idx));

Cheers! beer.gif

This post has been edited by lowzoom: Nov 1 2011, 01:18
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd December 2014 - 04:46