aboutsummaryrefslogtreecommitdiff
path: root/libopna/s98gen.h
blob: 8fa458da82e1ccfb98a561fffd635b3ac60837a8 (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
#ifndef MYON_S98GEN_H_INCLUDED
#define MYON_S98GEN_H_INCLUDED

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "opna.h"

#ifdef __cplusplus
extern "C" {
#endif

struct s98gen {
  struct opna opna;
  uint8_t *s98data;
  size_t s98data_size;
  size_t current_offset;
  uint32_t opnaclock;
  uint32_t samples_to_generate;
  uint16_t samples_to_generate_frac;
  uint32_t timer_numerator;
  uint32_t timer_denominator;
};

// returns true if initialization succeeded
// returns false without touching *s98 when initialization failed (invalid data)
bool s98gen_init(struct s98gen *s98, void *s98data, size_t s98data_size);
bool s98gen_generate(struct s98gen *s98, int16_t *buf, size_t samples);

#ifdef __cplusplus
}
#endif

#endif // MYON_S98GEN_H_INCLUDED