diff mediaplayer.h @ 2482:fb8f49b0aece

Impelement partial support for DAC stream commands in VGM player
author Michael Pavone <pavone@retrodev.com>
date Sat, 30 Mar 2024 21:10:20 -0700
parents 30e59954eab9
children
line wrap: on
line diff
--- a/mediaplayer.h	Sat Mar 30 14:27:47 2024 -0700
+++ b/mediaplayer.h	Sat Mar 30 21:10:20 2024 -0700
@@ -15,6 +15,7 @@
 typedef void (*chip_scope_fun)(chip_info *chip, oscilloscope *scope);
 typedef void (*chip_noarg_fun)(void *context);
 typedef void (*chip_adjust_fun)(chip_info *chip);
+typedef void (*chip_stream_fun)(chip_info *chip, uint8_t port, uint8_t command, uint16_t sample);
 struct chip_info {
 	void            *context;
 	chip_run_fun    run;
@@ -22,13 +23,32 @@
 	chip_scope_fun  scope;
 	chip_noarg_fun  no_scope;
 	chip_noarg_fun  free;
+	chip_stream_fun stream;
 	data_block      *blocks;
 	uint32_t        clock;
 	uint32_t        samples;
 	uint8_t         cmd;
 	uint8_t         data_type;
+	uint8_t         stream_type;
 };
 
+typedef struct {
+	chip_info  *chip;
+	data_block *cur_block;
+	uint32_t   step;
+	uint32_t   block_offset;
+	uint32_t   start_offset;
+	uint32_t   cycles_per_sample;
+	uint32_t   sample_rate;
+	uint32_t   next_sample_cycle;
+	uint32_t   remaining; // sample count or command count
+	uint8_t    data_type;
+	uint8_t    port;
+	uint8_t    command;
+	uint8_t    flags;
+	uint8_t    length_mode;
+} vgm_stream;
+
 enum {
 	STATE_PLAY,
 	STATE_PAUSED
@@ -45,6 +65,7 @@
 	audio_source        *audio;
 	chip_info           *chips;
 	oscilloscope        *scope;
+	vgm_stream          *streams[256];
 	uint32_t            num_chips;
 	uint32_t            current_offset;
 	uint32_t            playback_time;