aboutsummaryrefslogtreecommitdiff
path: root/libopna/s98gen.h
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2016-11-26 20:57:57 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2016-11-26 20:57:57 +0900
commit6fd10cdacb5cbe47a4fc339c20a733d4a9a384a1 (patch)
treec7f479a70c350dca0b73d76078e46db41d9c4133 /libopna/s98gen.h
initial
Diffstat (limited to 'libopna/s98gen.h')
-rw-r--r--libopna/s98gen.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/libopna/s98gen.h b/libopna/s98gen.h
new file mode 100644
index 0000000..8fa458d
--- /dev/null
+++ b/libopna/s98gen.h
@@ -0,0 +1,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