apu sortof working.

This commit is contained in:
2025-02-03 16:25:18 -07:00
parent d4c6f05fb8
commit e00b81304a
4 changed files with 396 additions and 230 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include <common.h>
#include <pa_ringbuffer.h>
typedef struct {
@ -17,16 +18,9 @@ typedef struct {
u8 volume_left;
u8 volume_right;
float sq1_freq;
u8 sq1_duty;
u8 sq1_volume;
float sq2_freq;
u8 sq2_duty;
u8 sq2_volume;
bool ready;
u8 sq1_sample;
float sq1_value;
u16 sq1_period_reset;
u16 sq1_period_timer;
bool sq1_enable;
@ -37,31 +31,61 @@ typedef struct {
u8 sq1_len;
u8 sq1_initial_volume;
bool sq1_env_direction;
bool sq1_env_direction_buffer;
u8 sq1_env_pace;
u8 sq1_env_pace_buffer;
u8 sq1_env_timer;
u8 sq1_sweep_step;
float sq1_audio_buffer[4096];
u32 sq1_write_head;
u32 sq1_read_head;
u8 sq1_sweep_timer;
bool sq1_sweep_enabled;
u16 sq1_sweep_period;
u16 sq1_calc_period;
u8 sq2_duty;
u8 sq2_volume;
u8 sq2_sample;
float sq2_value;
u16 sq2_period_reset;
u16 sq2_period_timer;
bool sq2_enable;
bool sq2_len_enable;
u8 sq2_sweep_pace;
bool sq2_sweep_direction;
u8 sq2_initial_len;
u8 sq2_len;
u8 sq2_initial_volume;
bool sq2_env_direction;
bool sq2_env_direction_buffer;
u8 sq2_env_pace;
u8 sq2_env_pace_buffer;
u8 sq2_env_timer;
u8 sq2_sweep_step;
float sq2_audio_buffer[4096];
u32 sq2_write_head;
u32 sq2_read_head;
bool ch3_enable;
u8 ch3_initial_len;
u8 ch3_len;
u8 ch3_volume;
u8 ch3_initial_volume;
u16 ch3_period_timer;
u16 ch3_period_reset;
bool ch3_len_enable;
u8 ch3_last_sample;
u8 ch3_sample;
bool ch4_enable;
u8 ch4_initial_len;
u8 ch4_len;
u8 ch4_initial_volume;
u8 ch4_volume;
u8 ch4_env_pace;
u8 ch4_env_pace_buffer;
u8 ch4_env_timer;
bool ch4_env_direction;
bool ch4_env_direction_buffer;
u8 ch4_clock_shift;
bool ch4_lfsr_width;
u8 ch4_clock_divider;
bool ch4_len_enable;
u16 ch4_lfsr;
u8 wave_ram[16];
} audio_context;