Made devapu static to emulator.c

This commit is contained in:
Andrew Alderwick 2021-04-08 21:22:27 +01:00
parent f76f8cf6ef
commit 9df5bb924b
3 changed files with 4 additions and 5 deletions

View File

@ -13,8 +13,6 @@ WITH REGARD TO THIS SOFTWARE.
#include "uxn.h" #include "uxn.h"
#include "apu.h" #include "apu.h"
extern Device *devapu;
static Uint32 note_advances[12] = { static Uint32 note_advances[12] = {
0x82d01286 / (SAMPLE_FREQUENCY / 30), /* C7 */ 0x82d01286 / (SAMPLE_FREQUENCY / 30), /* C7 */
0x8a976073 / (SAMPLE_FREQUENCY / 30), 0x8a976073 / (SAMPLE_FREQUENCY / 30),
@ -47,7 +45,7 @@ render_note(Apu *apu, Uxn *u, int note_i, Sint16 *samples, int n_samples)
if(apu->queue->i == apu->queue->n) { if(apu->queue->i == apu->queue->n) {
apu->queue->i = apu->queue->n = 0; apu->queue->i = apu->queue->n = 0;
if(!apu->queue->finishes) { if(!apu->queue->finishes) {
u->ram.dat[devapu->addr + 0xa] = note_i; u->ram.dat[apu->channel_addr] = note_i;
evaluxn(u, wv->vector); evaluxn(u, wv->vector);
} }
} }

View File

@ -40,6 +40,7 @@ typedef struct {
Queue *queue; Queue *queue;
Note *notes; Note *notes;
int n_notes; int n_notes;
Uint16 channel_addr;
} Apu; } Apu;
void apu_render(Apu *apu, Uxn *u, Sint16 *samples, int n_samples); void apu_render(Apu *apu, Uxn *u, Sint16 *samples, int n_samples);

View File

@ -25,8 +25,7 @@ static SDL_Renderer *gRenderer;
static SDL_Texture *gTexture; static SDL_Texture *gTexture;
static Ppu ppu; static Ppu ppu;
static Apu apu; static Apu apu;
static Device *devsystem, *devscreen, *devmouse, *devkey, *devctrl; static Device *devsystem, *devscreen, *devmouse, *devkey, *devctrl, *devapu;
Device *devapu;
#pragma mark - Helpers #pragma mark - Helpers
@ -421,6 +420,7 @@ main(int argc, char **argv)
devmouse = portuxn(&u, 0x06, "mouse", ppnil); devmouse = portuxn(&u, 0x06, "mouse", ppnil);
portuxn(&u, 0x07, "file", file_poke); portuxn(&u, 0x07, "file", file_poke);
devapu = portuxn(&u, 0x08, "audio", audio_poke); devapu = portuxn(&u, 0x08, "audio", audio_poke);
apu.channel_addr = devapu->addr + 0xa;
portuxn(&u, 0x09, "midi", ppnil); portuxn(&u, 0x09, "midi", ppnil);
portuxn(&u, 0x0a, "datetime", datetime_poke); portuxn(&u, 0x0a, "datetime", datetime_poke);
portuxn(&u, 0x0b, "---", ppnil); portuxn(&u, 0x0b, "---", ppnil);