80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
/**
|
|
* Copyright 2013 (c) Anna Schumaker.
|
|
*/
|
|
#ifndef OCARINA_CORE_DECK_H
|
|
#define OCARINA_CORE_DECK_H
|
|
|
|
extern "C" {
|
|
#include <core/queue.h>
|
|
}
|
|
#include <list>
|
|
|
|
|
|
/**
|
|
* A TempQueue is a wrapper around the Queue class that
|
|
* allows us to save the list of queues when necessary.
|
|
*/
|
|
class TempQueue : public queue
|
|
{
|
|
public:
|
|
void read(file &);
|
|
void write(file &);
|
|
|
|
unsigned int add(struct track *);
|
|
void del(struct track *);
|
|
void del(unsigned int);
|
|
};
|
|
|
|
|
|
/**
|
|
* The deck is used to hold temporary queues created by the user. This
|
|
* code is also in charge of maintaining a "recently played" queue of
|
|
* songs that have just played.
|
|
*
|
|
* When saving to disk:
|
|
* ... << deck.size() << endl;
|
|
* ... << deck[0] << endl;
|
|
* ...
|
|
* ... << deck[N] <<< endl;
|
|
*/
|
|
namespace deck
|
|
{
|
|
|
|
/**
|
|
* Save the current queues to a file on disk.
|
|
*/
|
|
void write();
|
|
void save(struct queue *, enum queue_flags);
|
|
|
|
/**
|
|
* @return A track from the first enabled queue. If no queues are
|
|
* enabled, return a track from the Library.
|
|
*/
|
|
struct track *next();
|
|
|
|
/**
|
|
* @return The deck of queues.
|
|
*/
|
|
std::list<TempQueue> &get_queues();
|
|
|
|
};
|
|
|
|
|
|
/* Called to initialize the temporary queue manager. */
|
|
void tempq_init(struct queue_ops *);
|
|
|
|
|
|
/* Called to allocate a new temporary queue. */
|
|
struct queue *tempq_alloc(struct queue_ops *, unsigned int);
|
|
|
|
/* Called to free a temporary queue. */
|
|
void tempq_free(struct queue *);
|
|
|
|
/* Called to find a temporary queue by index. */
|
|
struct queue *tempq_get(unsigned int);
|
|
|
|
/* Called to move a temporary queue to a new index in the list. */
|
|
void tempq_move(struct queue *, unsigned int);
|
|
|
|
#endif /* OCARINA_CORE_DECK_H */
|