PS2SDK
PS2 Homebrew Libraries
|
#include <stdio.h>
#include <thbase.h>
#include <thsemap.h>
#include <loadcore.h>
#include <sysmem.h>
#include <intrman.h>
#include <sifcmd.h>
#include <libsd.h>
#include <cdvdman.h>
#include <sysclib.h>
#include <audsrv.h>
#include "cdrom.h"
#include "common.h"
#include "rpc_server.h"
#include "rpc_client.h"
#include "upsamplers.h"
#include "spu.h"
#include "hw.h"
#include "debug_printf.h"
Go to the source code of this file.
Functions | |
static u8 cd_ringbuf[SECTOR_SIZE *8] | __attribute__ ((aligned(16))) |
static int | audsrv_cd_init () |
static int | cd_transfer_complete (void *arg) |
int | audsrv_get_cd_type () |
int | audsrv_get_cd_status () |
static int | process_toc () |
static int | initialize_cdda () |
int | audsrv_get_numtracks () |
int | audsrv_get_track_offset (int track) |
static int | read_sectors (void *dest, int sector, int count) |
static void | audsrv_stop_cd_stream () |
int | audsrv_cd_pause () |
int | audsrv_cd_resume () |
static void | cdda_procedure (void *arg) |
int | audsrv_get_cdpos () |
int | audsrv_get_trackpos () |
int | audsrv_cd_play_sectors (int start, int end) |
int | audsrv_play_cd (int track) |
int | audsrv_stop_cd () |
Variables | |
static int | cdda_initialized = 0 |
static int | cd_playing = 0 |
static volatile int | cd_paused = 0 |
static int | cdda_play_tid = -1 |
static volatile int | cdda_pos = 0 |
static int | cdda_play_start = 0 |
static int | cdda_play_end = 0 |
static cdda_toc | toc |
static unsigned char | raw_toc [3000] |
static int | cd_transfer_sema = -1 |
static short | cd_rendered_left [512] |
static short | cd_rendered_right [512] |
cdsrv IOP server.
Definition in file cdrom.c.
|
static |
cdda ring buffer
used upon overflow
|
static |
Transfer complete callback for cdda
arg | not used |
Generated by SPU2, when a block was transmitted and now putting to upload a second block to the other buffer.
Definition at line 91 of file cdrom.c.
References cd_transfer_sema.
Referenced by cdda_procedure().
int audsrv_get_cd_type | ( | ) |
Returns the type of disc in drive
Definition at line 102 of file cdrom.c.
References call_rpc_1(), and sceCdGetDiskType().
Referenced by rpc_command().
int audsrv_get_cd_status | ( | ) |
Returns CD drive status
Definition at line 118 of file cdrom.c.
References call_rpc_1(), and sceCdStatus().
Referenced by rpc_command().
|
static |
Internal function to process raw toc loaded from disc
Definition at line 126 of file cdrom.c.
References sceCdlLOCCD::minute, raw_toc, sceCdGetToc(), sceCdlLOCCD::second, sceCdlLOCCD::sector, toc, and sceCdlLOCCD::track.
int audsrv_get_numtracks | ( | ) |
Returns the number of tracks available on the CD in tray
Definition at line 205 of file cdrom.c.
References call_rpc_1(), and toc.
Referenced by rpc_command().
int audsrv_get_track_offset | ( | int | track | ) |
Returns the first sector for the given track
track | track index, must be between 1 and the trackcount |
Definition at line 220 of file cdrom.c.
References call_rpc_1(), sceCdlLOCCD::minute, sceCdlLOCCD::second, sceCdlLOCCD::sector, and toc.
Referenced by audsrv_play_cd(), and rpc_command().
|
static |
Reads several sectors from CDDA track
dest | output buffer, must be atleast count*2352 bytes long |
sector | first sector |
count | amount of sectors to read |
Definition at line 247 of file cdrom.c.
References count, sceCdDiskReady(), SCECdSpinNom, and sceCdSync().
Referenced by cdda_procedure().
|
static |
Stops cd SPU transmission
Definition at line 283 of file cdrom.c.
References cd_playing, cdda_play_end, cdda_play_start, and cdda_pos.
Referenced by audsrv_stop_cd().
int audsrv_cd_pause | ( | ) |
Pauses CD playing
Definition at line 298 of file cdrom.c.
References AUDSRV_ERR_NOERROR, and cd_paused.
Referenced by rpc_command().
int audsrv_cd_resume | ( | ) |
Resumes CD playing
Definition at line 307 of file cdrom.c.
References AUDSRV_ERR_NOERROR, and cd_paused.
Referenced by rpc_command().
|
static |
Internal cdda feeding thread
arg | (not used) |
Definition at line 316 of file cdrom.c.
References audsrv_stop_cd(), cd_paused, cd_transfer_complete(), cd_transfer_sema, cdda_play_end, cdda_play_start, cdda_pos, CpuResumeIntr(), CpuSuspendIntr(), find_upsampler(), and read_sectors().
Referenced by audsrv_cd_play_sectors().
int audsrv_get_cdpos | ( | ) |
Returns the current sector being played
Definition at line 438 of file cdrom.c.
References call_rpc_1(), cd_playing, and cdda_pos.
Referenced by rpc_command().
int audsrv_get_trackpos | ( | ) |
Returns the current sector being played, relative to first sector in track
Definition at line 452 of file cdrom.c.
References call_rpc_1(), cd_playing, cdda_play_start, and cdda_pos.
Referenced by rpc_command().
int audsrv_cd_play_sectors | ( | int | start, |
int | end | ||
) |
Starts playing cdda sectors from disc
start | first sector to play |
end | stop playing at this sector |
Starts the cdda feeding thread at the given sector. Any previously set up playback is stopped. If a callback was set, it will NOT be called, as the thread is stopped abnormally.
Definition at line 472 of file cdrom.c.
References AUDSRV_ERR_NOERROR, audsrv_stop_cd(), cd_playing, cdda_play_end, cdda_play_start, cdda_play_tid, cdda_pos, cdda_procedure(), and create_thread().
Referenced by audsrv_play_cd(), and rpc_command().
int audsrv_play_cd | ( | int | track | ) |
Plays CD audio track
track | segment to play [1 .. 99] |
Definition at line 508 of file cdrom.c.
References audsrv_cd_play_sectors(), audsrv_get_track_offset(), AUDSRV_PLAY_CD, call_rpc_1(), MAX_VOLUME, sceCdGetDiskType(), and toc.
Referenced by rpc_command().
int audsrv_stop_cd | ( | ) |
Stops CD play
Stops CD from being played; this has no effect on other music audsrv is currently playing
Definition at line 564 of file cdrom.c.
References audsrv_stop_cd_stream(), call_rpc_1(), and cdda_play_tid.
Referenced by audsrv_cd_play_sectors(), audsrv_quit(), cdda_procedure(), and rpc_command().
|
static |
cd status
Definition at line 40 of file cdrom.c.
Referenced by audsrv_cd_play_sectors(), audsrv_get_cdpos(), audsrv_get_trackpos(), and audsrv_stop_cd_stream().
|
static |
cd is paused (but playing)
Definition at line 42 of file cdrom.c.
Referenced by audsrv_cd_pause(), audsrv_cd_resume(), and cdda_procedure().
|
static |
thread id for cdda player
Definition at line 44 of file cdrom.c.
Referenced by audsrv_cd_play_sectors(), and audsrv_stop_cd().
|
static |
current sector being played
Definition at line 46 of file cdrom.c.
Referenced by audsrv_cd_play_sectors(), audsrv_get_cdpos(), audsrv_get_trackpos(), audsrv_stop_cd_stream(), and cdda_procedure().
|
static |
first sector played
Definition at line 48 of file cdrom.c.
Referenced by audsrv_cd_play_sectors(), audsrv_get_trackpos(), audsrv_stop_cd_stream(), and cdda_procedure().
|
static |
last sector to be played
Definition at line 50 of file cdrom.c.
Referenced by audsrv_cd_play_sectors(), audsrv_stop_cd_stream(), and cdda_procedure().
|
static |
toc for cdda
Definition at line 52 of file cdrom.c.
Referenced by audsrv_get_numtracks(), audsrv_get_track_offset(), audsrv_play_cd(), process_toc(), and sceCdGetToc().
|
static |
|
static |
SPU2 cd transfer complete semaphore
Definition at line 57 of file cdrom.c.
Referenced by cd_transfer_complete(), and cdda_procedure().