summaryrefslogtreecommitdiff
path: root/dumb/dumb-kode54/src/it/itmisc.c
blob: 22e18b7872e755a7bd9e926b229f727e4039f5fd (plain)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*  _______         ____    __         ___    ___
 * \    _  \       \    /  \  /       \   \  /   /       '   '  '
 *  |  | \  \       |  |    ||         |   \/   |         .      .
 *  |  |  |  |      |  |    ||         ||\  /|  |
 *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
 *  |  |  |  |      |  |    ||         ||    |  |         .      .
 *  |  |_/  /        \  \__//          ||    |  |
 * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
 *                                                      /  \
 *                                                     / .  \
 * itmisc.c - Miscellaneous functions relating        / / \  \
 *            to module files.                       | <  /   \_
 *                                                   |  \/ /\   /
 * By entheh.                                         \_  /  > /
 *                                                      | \ / /
 *                                                      |  ' /
 *                                                       \__/
 */

#include "dumb.h"
#include "internal/it.h"



DUMB_IT_SIGDATA *duh_get_it_sigdata(DUH *duh)
{
	return duh_get_raw_sigdata(duh, 0, SIGTYPE_IT);
}



const unsigned char *dumb_it_sd_get_song_message(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->song_message : NULL;
}



int dumb_it_sd_get_n_orders(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->n_orders : 0;
}



int dumb_it_sd_get_n_samples(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->n_samples : 0;
}



int dumb_it_sd_get_n_instruments(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->n_instruments : 0;
}



const unsigned char *dumb_it_sd_get_sample_name(DUMB_IT_SIGDATA *sd, int i)
{
	ASSERT(sd && sd->sample && i >= 0 && i < sd->n_samples);
	return sd->sample[i].name;
}



const unsigned char *dumb_it_sd_get_sample_filename(DUMB_IT_SIGDATA *sd, int i)
{
	ASSERT(sd && sd->sample && i >= 0 && i < sd->n_samples);
	return sd->sample[i].filename;
}



const unsigned char *dumb_it_sd_get_instrument_name(DUMB_IT_SIGDATA *sd, int i)
{
	ASSERT(sd && sd->instrument && i >= 0 && i < sd->n_instruments);
	return sd->instrument[i].name;
}



const unsigned char *dumb_it_sd_get_instrument_filename(DUMB_IT_SIGDATA *sd, int i)
{
	ASSERT(sd && sd->instrument && i >= 0 && i < sd->n_instruments);
	return sd->instrument[i].filename;
}



int dumb_it_sd_get_initial_global_volume(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->global_volume : 0;
}



void dumb_it_sd_set_initial_global_volume(DUMB_IT_SIGDATA *sd, int gv)
{
	if (sd) sd->global_volume = gv;
}



int dumb_it_sd_get_mixing_volume(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->mixing_volume : 0;
}



void dumb_it_sd_set_mixing_volume(DUMB_IT_SIGDATA *sd, int mv)
{
	if (sd) sd->mixing_volume = mv;
}



int dumb_it_sd_get_initial_speed(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->speed : 0;
}



void dumb_it_sd_set_initial_speed(DUMB_IT_SIGDATA *sd, int speed)
{
	if (sd) sd->speed = speed;
}



int dumb_it_sd_get_initial_tempo(DUMB_IT_SIGDATA *sd)
{
	return sd ? sd->tempo : 0;
}



void dumb_it_sd_set_initial_tempo(DUMB_IT_SIGDATA *sd, int tempo)
{
	if (sd) sd->tempo = tempo;
}



int dumb_it_sd_get_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel)
{
	ASSERT(channel >= 0 && channel < DUMB_IT_N_CHANNELS);
	return sd ? sd->channel_volume[channel] : 0;
}

void dumb_it_sd_set_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel, int volume)
{
	ASSERT(channel >= 0 && channel < DUMB_IT_N_CHANNELS);
	if (sd) sd->channel_volume[channel] = volume;
}



int dumb_it_sr_get_current_order(DUMB_IT_SIGRENDERER *sr)
{
	return sr ? sr->order : -1;
}



int dumb_it_sr_get_current_row(DUMB_IT_SIGRENDERER *sr)
{
	return sr ? sr->row : -1;
}



int dumb_it_sr_get_global_volume(DUMB_IT_SIGRENDERER *sr)
{
	return sr ? sr->globalvolume : 0;
}



void dumb_it_sr_set_global_volume(DUMB_IT_SIGRENDERER *sr, int gv)
{
	if (sr) sr->globalvolume = gv;
}



int dumb_it_sr_get_tempo(DUMB_IT_SIGRENDERER *sr)
{
	return sr ? sr->tempo : 0;
}



void dumb_it_sr_set_tempo(DUMB_IT_SIGRENDERER *sr, int tempo)
{
	if (sr) sr->tempo = tempo;
}



int dumb_it_sr_get_speed(DUMB_IT_SIGRENDERER *sr)
{
	return sr ? sr->speed : 0;
}



void dumb_it_sr_set_speed(DUMB_IT_SIGRENDERER *sr, int speed)
{
	if (sr) sr->speed = speed;
}



int dumb_it_sr_get_channel_volume(DUMB_IT_SIGRENDERER *sr, int channel)
{
	return sr ? sr->channel[channel].channelvolume : 0;
}



void dumb_it_sr_set_channel_volume(DUMB_IT_SIGRENDERER *sr, int channel, int volume)
{
	if (sr) sr->channel[channel].channelvolume = volume;
}



void dumb_it_sr_set_channel_muted(DUMB_IT_SIGRENDERER *sr, int channel, int muted)
{
	if (sr) {
		if (muted)
			sr->channel[channel].flags |= IT_CHANNEL_MUTED;
		else
			sr->channel[channel].flags &= ~IT_CHANNEL_MUTED;
	}
}



int dumb_it_sr_get_channel_muted(DUMB_IT_SIGRENDERER *sr, int channel)
{
	return sr ? (sr->channel[channel].flags & IT_CHANNEL_MUTED) != 0 : 0;
}