102 lines
2.0 KiB
C++
102 lines
2.0 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);
|
|
|
|
/**
|
|
* Removes the queue from the deck.
|
|
*
|
|
* @param queue The queue to be removed.
|
|
*/
|
|
void destroy(queue *);
|
|
|
|
/**
|
|
* Move the queue to a new location in the deck.
|
|
*
|
|
* @param queue The queue to be moved.
|
|
* @param index The new index of the queue.
|
|
*/
|
|
void move(queue *, unsigned int);
|
|
|
|
/**
|
|
* Find the index of the requested queue.
|
|
*
|
|
* @param queue The queue in question.
|
|
* @return The index of the requested queue.
|
|
*/
|
|
unsigned int index(queue *);
|
|
|
|
/**
|
|
* Access the queue at the specified index.
|
|
*
|
|
* @param index The index of the queue that should be accessed.
|
|
* @return The queue at the requested index.
|
|
*/
|
|
queue *get(unsigned int);
|
|
|
|
/**
|
|
* @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);
|
|
|
|
#endif /* OCARINA_CORE_DECK_H */
|