comparison foosdk/sdk/foobar2000/SDK/tracks.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 // Special header with fb2k mobile metadb<=>trackList interop wrappers
4
5 #include "metadb.h"
6 #include "titleformat.h"
7
8 typedef metadb_handle_ptr trackRef;
9 typedef metadb_handle_list_cref trackListRef;
10 typedef metadb_handle_list trackListStore;
11 typedef metadb_info_container trackInfoContainer;
12
13 inline size_t trackCount(trackListRef l) {return l.get_size();}
14 inline trackRef trackListGetTrack(trackListRef l, size_t n) { return l[n]; }
15
16 // Returns blank info if no info is known, never null.
17 inline trackInfoContainer::ptr trackGetInfoRef(trackRef t) { return t->get_info_ref(); }
18 inline trackInfoContainer::ptr trackGetInfoRef(trackListRef l, size_t n) { return trackGetInfoRef(l[n]); }
19
20 // Returns null info if no info is known, contrary to trackGetInfoRef
21 inline trackInfoContainer::ptr trackGetInfo(trackRef t) { trackInfoContainer::ptr ret; if(!t->get_info_ref(ret)) ret = nullptr; return ret; }
22 inline trackInfoContainer::ptr trackGetInfo(trackListRef l, size_t n) { return trackGetInfo(l[n]); }
23
24 // Returns const char* or pfc::string8 depending on which fb2k!
25 inline const char * trackGetPath(trackListRef l, size_t n) { return l[n]->get_path(); }
26 inline const char * trackGetPath(trackRef t) { return t->get_path(); }
27
28 // Returns const playable_location& or playable_location_impl depending on which fb2k!
29 inline playable_location const & trackGetLocation(trackListRef l, size_t n) { return l[n]->get_location(); }
30 inline playable_location const & trackGetLocation(trackRef t) { return t->get_location(); }
31
32 inline double trackGetLength(trackListRef l, size_t n) { return l[n]->get_length(); }
33 inline double trackGetLength(trackRef t) { return t->get_length(); }
34
35 inline void trackFormatTitle(trackRef trk, titleformat_hook * hook, pfc::string_base & out, service_ptr_t<titleformat_object > script, titleformat_text_filter * filter) {
36 trk->format_title(hook, out, script, filter);
37 }