aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-28 21:29:04 +0200
committerBad Diode <bd@badd10de.dev>2021-05-28 21:29:04 +0200
commit9c61e2e75220439e917fa5fba9d59014a2a5c43a (patch)
treeb9b4a4a535163238bd50707c05139a560cc92f71 /src
parent1fabc50056826ba54ad2a613e5509f3047414cae (diff)
downloaduxngba-9c61e2e75220439e917fa5fba9d59014a2a5c43a.tar.gz
uxngba-9c61e2e75220439e917fa5fba9d59014a2a5c43a.zip
Update README
Diffstat (limited to 'src')
-rw-r--r--src/apu.c3
-rw-r--r--src/main.c29
2 files changed, 4 insertions, 28 deletions
diff --git a/src/apu.c b/src/apu.c
index eb898c1..d107e1e 100644
--- a/src/apu.c
+++ b/src/apu.c
@@ -17,6 +17,7 @@ WITH REGARD TO THIS SOFTWARE.
17// the pitch table is multiplied by the sampling rate of the original sample, 17// the pitch table is multiplied by the sampling rate of the original sample,
18// the resulting value will be the increment per VSYNC, which must be shifted 18// the resulting value will be the increment per VSYNC, which must be shifted
19// AUDIO_INC_PRECISION to obtain a (20.12) fixed-point increment value. 19// AUDIO_INC_PRECISION to obtain a (20.12) fixed-point increment value.
20//
20#if defined(AUDIO_HIFI) 21#if defined(AUDIO_HIFI)
21#define AUDIO_FREQ 40137 22#define AUDIO_FREQ 40137
22#define AUDIO_BUF_LEN 672 23#define AUDIO_BUF_LEN 672
@@ -44,7 +45,7 @@ static u16 pitch_table[120] = {
44#define AUDIO_BUF_LEN 96 45#define AUDIO_BUF_LEN 96
45#define AUDIO_TIMER 62610 46#define AUDIO_TIMER 62610
46#define AUDIO_INC_PRECISION 4 47#define AUDIO_INC_PRECISION 4
47static u16 pitch_table[120] = { 48static u32 pitch_table[120] = {
48 93, 98, 104, 111, 117, 124, 132, 139, 49 93, 98, 104, 111, 117, 124, 132, 139,
49 148, 157, 166, 176, 186, 197, 209, 222, 50 148, 157, 166, 176, 186, 197, 209, 222,
50 235, 249, 264, 279, 296, 314, 332, 352, 51 235, 249, 264, 279, 296, 314, 332, 352,
diff --git a/src/main.c b/src/main.c
index 35bc0cf..7a2c397 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,12 +16,9 @@ WITH REGARD TO THIS SOFTWARE.
16#include "filesystem.c" 16#include "filesystem.c"
17 17
18#include "rom.c" 18#include "rom.c"
19#include "uxn/uxn.h" 19#include "uxn.c"
20#include "uxn/uxn.c" 20#include "ppu.c"
21#include "uxn/devices/ppu.h"
22#include "uxn/devices/ppu.c"
23#include "apu.c" 21#include "apu.c"
24
25#include "text.h" 22#include "text.h"
26 23
27// 24//
@@ -391,34 +388,12 @@ int main(void) {
391 init_sound(); 388 init_sound();
392 389
393 // Main loop. 390 // Main loop.
394 int frame_counter = 0;
395 evaluxn(&u, 0x0100); 391 evaluxn(&u, 0x0100);
396 u32 flip_cycles = 0;
397 u32 eval_cycles = 0;
398 u32 input_cycles = 0;
399 u32 mix_cycles = 0;
400 while(true) { 392 while(true) {
401 bios_vblank_wait(); 393 bios_vblank_wait();
402 profile_start();
403 handle_input(&u); 394 handle_input(&u);
404 input_cycles = MAX(profile_stop(), input_cycles);
405 profile_start();
406 evaluxn(&u, mempeek16(devscreen->dat, 0)); 395 evaluxn(&u, mempeek16(devscreen->dat, 0));
407 eval_cycles = MAX(profile_stop(), eval_cycles);
408 txt_position(0, 8);
409 profile_start();
410 flip_cycles = profile_stop();
411 frame_counter++;
412 profile_start();
413 sound_mix(); 396 sound_mix();
414 mix_cycles = MAX(profile_stop(), mix_cycles);
415
416 txt_position(0, 15);
417 txt_printf("INPUT: %lu \n", input_cycles);
418 txt_printf("EVAL: %lu \n", eval_cycles);
419 txt_printf("FLIP: %lu \n", flip_cycles);
420 txt_printf("MIX: %lu \n", mix_cycles);
421 txt_printf("FRAME: %lu \n", frame_counter);
422 flipbuf(&ppu); 397 flipbuf(&ppu);
423 } 398 }
424 399