-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmflat.h
131 lines (110 loc) · 2.99 KB
/
bmflat.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef _BMFLAT_H_
#define _BMFLAT_H_
#ifdef __cplusplus
extern "C" {
#endif
struct bm_metadata {
int player_num;
char *genre;
char *title;
char *artist;
char *subartist;
float init_tempo;
int play_level;
int judge_rank;
int gauge_total;
int difficulty;
char *stage_file;
char *banner;
char *back_bmp;
};
struct bm_tables {
#define BM_INDEX_MAX 1296
char *wav[BM_INDEX_MAX];
char *bmp[BM_INDEX_MAX];
float tempo[BM_INDEX_MAX];
short stop[BM_INDEX_MAX];
};
struct bm_note {
float beat; // In fractions of the bar
short bar:15;
short hold:1;
short value;
};
struct bm_track {
int note_count, note_cap;
struct bm_note *notes;
};
struct bm_tracks {
#define BM_BARS_COUNT 1000
unsigned char time_sig[BM_BARS_COUNT];
#define BM_BGM_TRACKS 64
int background_count;
struct bm_track background[BM_BGM_TRACKS];
struct bm_track object[60];
struct bm_track tempo;
struct bm_track bga_base;
struct bm_track bga_layer;
struct bm_track bga_poor;
struct bm_track ex_tempo;
struct bm_track stop;
};
struct bm_chart {
struct bm_metadata meta;
struct bm_tables tables;
struct bm_tracks tracks;
};
enum bm_event_type {
BM_BARLINE = 0, // value = index, value_a = time signature
BM_TEMPO_CHANGE, // value_f = BPM
BM_BGA_BASE_CHANGE, // value = index
BM_BGA_LAYER_CHANGE, // value = index
BM_BGA_POOR_CHANGE, // value = index
BM_STOP, // value = duration
BM_NOTE, // value = index
BM_NOTE_LONG, // value = index, value_a = duration
BM_NOTE_OFF, // value = index, value_a = duration
};
struct bm_event {
int pos; // beat * 48 + fraction in 48ths of a beat (192ths of a whole note)
enum bm_event_type type:8;
signed char track; // non-positive for backgrounds; 11 - 59 for objects
union {
struct {
short value;
short value_a;
};
float value_f;
};
};
struct bm_seq {
int event_count;
struct bm_event *events;
int long_note_count;
struct bm_event *long_notes;
};
#define BM_MSG_LEN 128
struct bm_log {
int line;
char message[BM_MSG_LEN];
};
extern struct bm_log *bm_logs;
int bm_load(struct bm_chart *chart, const char *source);
void bm_to_seq(struct bm_chart *chart, struct bm_seq *seq);
void bm_close_chart(struct bm_chart *chart);
void bm_close_seq(struct bm_seq *seq);
#ifdef __cplusplus
}
#endif
#endif
/*
Copyright (c) 2019 Ayu
bmflat is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/