ocarina/design/deck.txt

74 lines
1.9 KiB
Plaintext

== Files ==
ocarina/include/
deck.h
ocarina/lib/
deck.cpp
$HOME/.ocarina{-debug}/
playqueue.lst
== Depends ==
playqueue
Deck: (lib/deck.cpp)
The playqueue deck is used to hold the temporary playqueues created by
the user.
This module also controls the library playqueue, which should be updated
using the on_library_track_add() and on_library_track_del() callback
functions. The library playqueue will always have PQ_ENABLED and
PQ_REPEAT set. This playlist will default to PQ_RANDOM unset.
- Deck:
list<Playqueue> deck;
Playqueue library_pq;
File << library_pq.random << deck.size() << endl;
File << deck[0] << endl;
File << deck[N] << endl;
- API
void deck :: init();
Set up callbacks used by the library.
void deck :: read(File &);
void deck :: write(File &);
Read or write the playqueue file. This will be called
from the audio layer to store state.
Playqueue *deck :: create();
Adds a new playqueue to the end of the deck and returns a
pointer to it.
void deck :: remove(N);
Remove playqueue N from the deck.
Playqueue *deck :: get(N);
Return playqueue N from the deck.
void deck :: move(M, N);
Move playqueue at index M to index N.
unsigned int deck :: next();
Iterate through the deck until you find a playqueue with the
flag PQ_ENABLED set. Call next() on this playqueue and return
the result.
If the playqueue is empty after calling next(), remove it from
the deck.
If there are no playqueues on the deck, play a song from the
library playqueue.
If there are no playable IDs, throw -EEXIST.
void deck :: reset();
This function only exists if CONFIG_TEST is enabled. Erase
all the playqueue information and reset the deck list.
void deck :: print_info();
This function only exists if CONFIG_TEST is enabled. Print
out helpful stats about the current state of the playqueue deck.
Playqueue *deck :: get_library_pq();
Return the library playqueue.