... | ... |
@@ -13,8 +13,6 @@ WITH REGARD TO THIS SOFTWARE. |
13 | 13 |
#include "uxn.h" |
14 | 14 |
#include "apu.h" |
15 | 15 |
|
16 |
-extern Device *devapu; |
|
17 |
- |
|
18 | 16 |
static Uint32 note_advances[12] = { |
19 | 17 |
0x82d01286 / (SAMPLE_FREQUENCY / 30), /* C7 */ |
20 | 18 |
0x8a976073 / (SAMPLE_FREQUENCY / 30), |
... | ... |
@@ -47,7 +45,7 @@ render_note(Apu *apu, Uxn *u, int note_i, Sint16 *samples, int n_samples) |
47 | 45 |
if(apu->queue->i == apu->queue->n) { |
48 | 46 |
apu->queue->i = apu->queue->n = 0; |
49 | 47 |
if(!apu->queue->finishes) { |
50 |
- u->ram.dat[devapu->addr + 0xa] = note_i; |
|
48 |
+ u->ram.dat[apu->channel_addr] = note_i; |
|
51 | 49 |
evaluxn(u, wv->vector); |
52 | 50 |
} |
53 | 51 |
} |
... | ... |
@@ -25,8 +25,7 @@ static SDL_Renderer *gRenderer; |
25 | 25 |
static SDL_Texture *gTexture; |
26 | 26 |
static Ppu ppu; |
27 | 27 |
static Apu apu; |
28 |
-static Device *devsystem, *devscreen, *devmouse, *devkey, *devctrl; |
|
29 |
-Device *devapu; |
|
28 |
+static Device *devsystem, *devscreen, *devmouse, *devkey, *devctrl, *devapu; |
|
30 | 29 |
|
31 | 30 |
#pragma mark - Helpers |
32 | 31 |
|
... | ... |
@@ -421,6 +420,7 @@ main(int argc, char **argv) |
421 | 420 |
devmouse = portuxn(&u, 0x06, "mouse", ppnil); |
422 | 421 |
portuxn(&u, 0x07, "file", file_poke); |
423 | 422 |
devapu = portuxn(&u, 0x08, "audio", audio_poke); |
423 |
+ apu.channel_addr = devapu->addr + 0xa; |
|
424 | 424 |
portuxn(&u, 0x09, "midi", ppnil); |
425 | 425 |
portuxn(&u, 0x0a, "datetime", datetime_poke); |
426 | 426 |
portuxn(&u, 0x0b, "---", ppnil); |