Queue: move HASH_MULT and Item into the Queue class
This commit is contained in:
@@ -28,19 +28,28 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
enum {
|
/**
|
||||||
|
* A queue of songs. This is the backend of the playlist: it contains
|
||||||
|
* an ordered list of songs.
|
||||||
|
*
|
||||||
|
* Songs can be addressed in three possible ways:
|
||||||
|
*
|
||||||
|
* - the position in the queue
|
||||||
|
* - the unique id (which stays the same, regardless of moves)
|
||||||
|
* - the order number (which only differs from "position" in random mode)
|
||||||
|
*/
|
||||||
|
struct queue {
|
||||||
/**
|
/**
|
||||||
* reserve max_length * QUEUE_HASH_MULT elements in the id
|
* reserve max_length * QUEUE_HASH_MULT elements in the id
|
||||||
* number space
|
* number space
|
||||||
*/
|
*/
|
||||||
QUEUE_HASH_MULT = 4,
|
static constexpr unsigned QUEUE_HASH_MULT = 4;
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One element of the queue: basically a song plus some queue specific
|
* One element of the queue: basically a song plus some queue specific
|
||||||
* information attached.
|
* information attached.
|
||||||
*/
|
*/
|
||||||
struct queue_item {
|
struct queue_item {
|
||||||
struct song *song;
|
struct song *song;
|
||||||
|
|
||||||
/** the unique id of this item in the queue */
|
/** the unique id of this item in the queue */
|
||||||
@@ -55,19 +64,8 @@ struct queue_item {
|
|||||||
* "random" mode.
|
* "random" mode.
|
||||||
*/
|
*/
|
||||||
uint8_t priority;
|
uint8_t priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* A queue of songs. This is the backend of the playlist: it contains
|
|
||||||
* an ordered list of songs.
|
|
||||||
*
|
|
||||||
* Songs can be addressed in three possible ways:
|
|
||||||
*
|
|
||||||
* - the position in the queue
|
|
||||||
* - the unique id (which stays the same, regardless of moves)
|
|
||||||
* - the order number (which only differs from "position" in random mode)
|
|
||||||
*/
|
|
||||||
struct queue {
|
|
||||||
/** configured maximum length of the queue */
|
/** configured maximum length of the queue */
|
||||||
unsigned max_length;
|
unsigned max_length;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user