ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
testcd.c File Reference
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <sifrpc.h>
#include <loadfile.h>
#include <tamtypes.h>
#include <audsrv.h>
+ Include dependency graph for testcd.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file testcd.c.

24 {
25  int ret;
26  int n, track;
27  int lastpos;
28 
29  SifInitRpc(0);
30 
31  printf("sample: kicking IRXs\n");
32  ret = SifLoadModule("rom0:LIBSD", 0, NULL);
33  printf("libsd loadmodule %d\n", ret);
34 
35  printf("sample: loading audsrv\n");
36  ret = SifLoadModule("host:audsrv.irx", 0, NULL);
37  printf("audsrv loadmodule %d\n", ret);
38 
39  ret = audsrv_init();
40  if (ret != 0)
41  {
42  printf("sample: failed to initialize audsrv\n");
43  printf("audsrv returned error string: %s\n", audsrv_get_error_string());
44  return 1;
45  }
46 
48  printf("There are %d tracks on this disc\n", n);
49 
50  lastpos = 0;
51  for (track=0; track<=n; track++)
52  {
53  int pos = audsrv_get_track_offset(track);
54 
55  if (track > 0)
56  {
57  int length = pos - lastpos;
58 
59  printf("Track %02d: sector 0x%x, length: %02d:%02d:%02d\n",
60  track, pos, length / (75*60), (length / 75) % 60, length % 75);
61  }
62 
63  lastpos = pos;
64  }
65 
66  audsrv_quit();
67  printf("sample: ended\n");
68  return 0;
69 }
int audsrv_get_numtracks()
Definition: audsrv_rpc.c:198
const char * audsrv_get_error_string()
Definition: audsrv_rpc.c:438
int audsrv_init()
Definition: audsrv_rpc.c:296
int audsrv_get_track_offset(int track)
Definition: audsrv_rpc.c:203
int audsrv_quit()
Definition: audsrv_rpc.c:117
int SifLoadModule(const char *path, int arg_len, const char *args)
struct @29::@30 pos
void SifInitRpc(int mode)
#define NULL
Definition: tamtypes.h:91

References audsrv_get_error_string(), audsrv_get_numtracks(), audsrv_get_track_offset(), audsrv_init(), audsrv_quit(), NULL, pos, SifInitRpc(), and SifLoadModule().