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

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 16 of file stream.c.

17 {
18  int ret;
19  /* Load LibSD (freesd will work too one day, I promise ;) */
20  ret = SifLoadModule("host:LIBSD.IRX", 0, NULL);
21  if (ret<0)
22  {
23  printf("XXXXX failed to load host:LIBSD.IRX (%d)\n", ret);
24  SleepThread();
25  }
26 
27  /* Load ps2snd */
28  ret = SifLoadModule("host:ps2snd.irx", 0, NULL);
29  if (ret<0)
30  {
31  printf("XXXXX failed to load host:ps2snd.irx (%d)\n", ret);
32  SleepThread();
33  }
34 
35  /* Start LibSD */
36  if (sceSdInit(0)<0)
37  {
38  printf("Failed to start LibSD\n");
39  SleepThread();
40  }
41 
42  /* Setup master volumes for both cores */
43  sceSdSetParam(0 | SD_PARAM_MVOLL, 0x3fff);
44  sceSdSetParam(0 | SD_PARAM_MVOLR, 0x3fff);
45  sceSdSetParam(1 | SD_PARAM_MVOLL, 0x3fff);
46  sceSdSetParam(1 | SD_PARAM_MVOLR, 0x3fff);
47 
48  /*
49  Open a stream, using voices 0:22 and 0:23
50  It's stereo and it should be closed when the end is hit.
51  The SPU buffers are at 0x6000 in spu2 ram.
52  The chunksize is 1024 blocks (16kbyte)
53  */
54  if (sndStreamOpen("host:stream.adpcm", SD_VOICE(0,22) | (SD_VOICE(0,23)<<16), STREAM_STEREO | STREAM_END_CLOSE, 0x6000, 1024)<0)
55  {
56  printf("Failed to open stream\n");
57  SleepThread();
58  }
59 
60 
61  sndStreamPlay();
62 
63  SleepThread();
64 
65  return(0);
66 }
int SifLoadModule(const char *path, int arg_len, const char *args)
s32 SleepThread(void)
#define SD_PARAM_MVOLL
Definition: libsd-common.h:35
#define SD_VOICE(_core, _v)
Definition: libsd-common.h:11
#define SD_PARAM_MVOLR
Definition: libsd-common.h:36
void sceSdSetParam(u16 entry, u16 value)
Definition: ps2snd.c:50
int sndStreamOpen(char *file, u32 voices, u32 flags, u32 bufaddr, u32 bufsize)
Definition: ps2snd.c:215
int sndStreamPlay(void)
Definition: ps2snd.c:237
int sceSdInit(int flag)
Definition: ps2snd.c:21
#define STREAM_END_CLOSE
Definition: ps2snd.h:23
#define STREAM_STEREO
Definition: ps2snd.h:22
#define NULL
Definition: tamtypes.h:91

References NULL, sceSdInit(), sceSdSetParam(), SD_PARAM_MVOLL, SD_PARAM_MVOLR, SD_VOICE, SifLoadModule(), SleepThread(), sndStreamOpen(), sndStreamPlay(), STREAM_END_CLOSE, and STREAM_STEREO.

Referenced by ps2GetStackTrace().