Repository navigation
Expand file tree
/
Copy pathsc55.h
More file actions
68 lines (56 loc) · 2.01 KB
/
Copy pathsc55.h
File metadata and controls
68 lines (56 loc) · 2.01 KB
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
/*
* Roland SC-55 emulation: a C89 single-file port of the Nuked-SC55
* backend. See sc55.c for the copyright notices.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*/
#ifndef SC55_H
#define SC55_H
#include <stddef.h>
#include <stdint.h>
typedef struct sc55 sc55_t;
enum
{
SC55_MODEL_MK2, /* SC-55mkII */
SC55_MODEL_MK1, /* SC-55 */
SC55_MODEL_ST, /* SC-55ST */
SC55_MODEL_SC155, /* SC-155 */
SC55_MODEL_CM300, /* CM-300, SCC-1 */
SC55_MODEL_SCB55, /* SCB-55 */
SC55_MODEL_RLP3237, /* RLP-3237 */
SC55_MODEL_COUNT
};
enum
{
SC55_ROM_ROM1,
SC55_ROM_ROM2,
SC55_ROM_SMROM, /* sub-MCU: mkII and ST */
SC55_ROM_WAVEROM1,
SC55_ROM_WAVEROM2,
SC55_ROM_WAVEROM3,
SC55_ROM_COUNT
};
/* NULL if the allocation fails. */
sc55_t *sc55_new(int model);
void sc55_free(sc55_t *s);
/* `data` is the dump as it is on disk; wave ROMs are unscrambled here.
* Returns 0 if the image does not fit the slot. */
int sc55_load_rom(sc55_t *s, int slot, const unsigned char *data, size_t len);
/* Call once every ROM the model needs is loaded. */
void sc55_reset(sc55_t *s);
/* Queue MIDI bytes for the unit's serial input. The queue holds
* sc55_midi_room() more bytes; anything past that overwrites what has
* not been read yet. */
void sc55_midi(sc55_t *s, const unsigned char *data, size_t len);
size_t sc55_midi_room(const sc55_t *s);
/* One bit per voice the firmware has keyed on in the PCM chip. */
uint32_t sc55_voices(const sc55_t *s);
/* Native output rate in Hz: 66207 for the mkII, 64000 for the mk1. */
unsigned sc55_rate(const sc55_t *s);
/* Run the unit until it has produced `count` stereo frames and store
* them in `frames` as left/right pairs. Full scale is +-2^29. */
size_t sc55_run(sc55_t *s, int32_t *frames, size_t count);
#endif