Use CDDA on PSX

This commit is contained in:
jaby 2022-07-20 22:12:25 +02:00
parent 48aba6f5df
commit 82c69d27bc
3 changed files with 63 additions and 6 deletions

View File

@ -1,7 +1,20 @@
{
"folders": [
{
"name": "JabyEngine",
"path": "."
},
{
"name": "PSYQ",
"path": "..\\..\\PSYQ\\Converted\\Include"
},
{
"name": "NEXTGPU",
"path": "..\\..\\..\\..\\PSX\\projects\\NEXTGPU"
},
{
"name": "CDPLAYER",
"path": "..\\..\\..\\..\\PSX\\projects\\CDPLAYER"
}
],
"tasks": {
@ -120,6 +133,9 @@
"C_Cpp.default.compilerArgs": [
],
"C_Cpp.default.defines": [
]
],
"files.associations": {
"CDDADEMO.C": "cpp"
}
}
}

View File

@ -18,6 +18,6 @@
<dummy sectors="1024"/>
</directory_tree>
</track>
<!--<track type="audio" source="..\Ressources\fox.wav"/>-->
<!--<track type="audio" source="..\Ressources\shark.wav"/>-->
<track type="audio" source="D:\PSX\projects\NEXTGPU\data\Burg.wav"/>
<track type="audio" source="D:\PSX\projects\VS2019\JabyPhew\JabyPhew\Ressources\shark.wav"/>-->
</iso_project>

View File

@ -1,8 +1,49 @@
#include "JabyEngine.h"
#include <types.h>
#include <libcd.h>
#include <libetc.h>
#include <libgte.h>
#include <libgpu.h>
#include <stdio.h>
int main()
{
printf("Hello Planschi!\n");
static CdlLOC TOC[100] = {0};
static void setup() {
ResetCallback();
//ResetGraph(0);
CdInit();
CdSetDebug(0);
//SetDispMask(1);
}
static int fill_toc() {
u_char param[4] = {0};
param[0] = CdlModeRept|CdlModeDA; // report ON / CD-DA ON
CdControlB(CdlSetmode, param, 0);
return CdGetToc(TOC); // TOC
}
static void play_track(int track) {
for(int n = 0; n < 100; n++) {
const auto& cur_toc = TOC[n];
printf("Now playing %i.) %x:%x:%x\n", n, cur_toc.minute, cur_toc.second, cur_toc.sector);
}
CdControlB(CdlSetloc, reinterpret_cast<u_char*>(&TOC[track]), 0); // seek to start of track "track"
CdControlB(CdlPlay, 0, 0); // play track
}
int main() {
setup();
const int track_count = fill_toc();
printf("Hello Planschi!\nI found %i tracks\n", track_count);
play_track(2);
while(true);
return 0;
}