forked from canvasus/CreatorMaster2k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arrangement.h
43 lines (37 loc) · 1.11 KB
/
arrangement.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <Arduino.h>
#include "x_globals.h"
#define ARRITEM_INACTIVE 0
#define ARRITEM_ACTIVE 1
struct ArrangementItem
{
uint32_t startTick = 0;
uint32_t lengthTicks = 4 * 4 * RESOLUTION;
uint8_t patternIndex = 0;
uint8_t status = ARRITEM_INACTIVE;
bool muteArray[NR_TRACKS];
};
class Arrangement
{
private:
void _sortItems();
public:
Arrangement();
ArrangementItem arrangementItems_a[NR_ARRITEMS];
uint8_t newArrangementItem();
uint8_t deleteArrangementItem(uint8_t index);
void clear();
uint32_t arrangementTick;
uint8_t tick();
uint8_t getCurrentArrItem();
void setArrangementPosition(uint8_t positionId, uint16_t startBars, uint8_t patternIndex);
void updateArrangementStartPositions();
void printItemArray(uint8_t lastIndex);
void moveItemUp(uint8_t itemId);
void moveItemDown(uint8_t itemId);
// For later:
//ArrangementItem arrangementItems_b[NR_ARRITEMS];
//ArrangementItem arrangementItems_c[NR_ARRITEMS];
//ArrangementItem arrangementItems_d[NR_ARRITEMS];
};
int compareArrItems(const void *s1, const void *s2);