Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
spu-adpcm.c
Go to the documentation of this file.
1// ==========================================================================
2// Validate ADPCM decoding, filtering, loop and carry-over
3// ==========================================================================
4
5CESTER_TEST(adpcm_decode_silent, spu_tests,
6 run_voice1_with_sample(kAdpcmSilent, 0x1000);
7 SPU_ASSERT_GOLDEN(silent);
8)
9
10CESTER_MAYBE_TEST(adpcm_decode_sinewave, spu_tests,
11 run_voice1_with_sample(kAdpcmSine, 0x1000);
13)
14
15CESTER_MAYBE_TEST(adpcm_decode_sinewave_lowpitch, spu_tests,
16 run_voice1_with_sample(kAdpcmSine394Hz, 0x1000);
17 SPU_ASSERT_GOLDEN(sine_low);
18)
19
20CESTER_MAYBE_TEST(adpcm_decode_sinewave_highpitch, spu_tests,
21 run_voice1_with_sample(kAdpcmSine5512Hz, 0x1000);
22 SPU_ASSERT_GOLDEN(sine_high);
23)
24
25CESTER_MAYBE_TEST(adpcm_decode_tranglewave, spu_tests,
26 run_voice1_with_sample(kAdpcmTriangle, 0x1000);
27 SPU_ASSERT_GOLDEN(triangle);
28)
29
30CESTER_MAYBE_TEST(adpcm_decode_squarewave, spu_tests,
31 run_voice1_with_sample(kAdpcmSquare, 0x1000);
32 SPU_ASSERT_GOLDEN(square);
33)
34
35CESTER_MAYBE_TEST(adpcm_decode_with_loop, spu_tests,
36 run_voice1_with_sample(kAdpcmTriangle, 0x1000);
37 SPU_ASSERT_GOLDEN(loop_t0);
38
39 SPU_CTRL = 0x8000 | 0x4000;
40 SPU_VOL_MAIN_LEFT = 0x3fff; SPU_VOL_MAIN_RIGHT = 0x3fff;
41 SPU_KEY_OFF_LOW = 0xffff; SPU_KEY_OFF_HIGH = 0xffff;
42 spu_busy_wait(800000);
43 spu_wait_status_bit11_flip();
44
45 spu_voice1_keyon(SPU_UPLOAD_ADDR, 0x1000);
46 spu_busy_wait(15000000); // ~440 ms, the 112-sample buffer lasts ~5 ms
47 spu_wait_status_bit11_flip();
48 spu_read_sync(0x0800, s_capture, 1024);
49 SPU_ASSERT_GOLDEN(loop_t1);
50
51 SPU_KEY_OFF_LOW = 0xffff; SPU_KEY_OFF_HIGH = 0xffff;
52 muteSpu();
53)
CESTER_TEST(cdlGetLocL, test_instances, int resetDone=resetCDRom();if(!resetDone) { cester_assert_true(resetDone);return;} initializeTime();CDROM_REG0=0;CDROM_REG1=CDL_GETLOCL;uint32_t ackTime=waitCDRomIRQ();uint8_t cause1=ackCDRomCause();uint8_t ctrl1=CDROM_REG0 &~3;uint8_t response[16];uint8_t responseSize=readResponse(response);uint8_t ctrl2=CDROM_REG0 &~3;CDROM_REG0=1;uint8_t cause1b=CDROM_REG3_UC;cester_assert_uint_eq(3, cause1);cester_assert_uint_eq(0xe0, cause1b);cester_assert_uint_eq(0x38, ctrl1);cester_assert_uint_eq(0x18, ctrl2);cester_assert_uint_eq(8, responseSize);cester_assert_uint_ge(ackTime, 500);cester_assert_uint_lt(ackTime, 7000);ramsyscall_printf("Basic getlocL, ack in %ius\n", ackTime);) CESTER_TEST(cdlGetLocLafterSeekP
#define SPU_VOL_MAIN_LEFT
Definition spu.h:84
#define SPU_KEY_OFF_LOW
Definition spu.h:90
#define SPU_KEY_OFF_HIGH
Definition spu.h:91
#define SPU_CTRL
Definition spu.h:104
#define SPU_VOL_MAIN_RIGHT
Definition spu.h:85
#define CESTER_MAYBE_TEST
Definition cop0.c:34
spu_tests
Definition spu-adpcm-edge.c:189
run_voice1_with_sample(sample, 0x1000)
#define SPU_UPLOAD_ADDR
Definition spu-capamp.c:31
muteSpu()
spu_busy_wait(500000)
spu_read_sync(0x1000, s_readback, 0x80)
#define SPU_ASSERT_GOLDEN(name)
Definition spu.c:401