Exemplo n.º 1
0
static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
{
	int i;

	cdrom->numtracks = audsrv_get_numtracks();
	for (i=0; i<cdrom->numtracks; i++)
	{
		cdrom->track[i].id = i;
		cdrom->track[i].type = SDL_AUDIO_TRACK; // FIXME;
		cdrom->track[i].offset = audsrv_get_track_offset(i);
		cdrom->track[i].length = audsrv_get_track_offset(i+1) - cdrom->track[i].offset;
	}

	return 0;
}
Exemplo n.º 2
0
/** RPC command handler.
    @param func     command (one of AUDSRV_x)
    @param data     pointer to data array
    @param size     size of data array (in bytes)
    @returns value depends on function invoked

    This is a single rpc handler, it unpacks the data array and calls
    local functions.
*/
static void *rpc_command(int func, unsigned *data, int size)
{
	int ret;

	/* printf("audsrv: rpc command %d\n", func); */
	switch(func)
	{
		case AUDSRV_INIT:
		ret = audsrv_init();
		break;

		case AUDSRV_FORMAT_OK:
		ret = audsrv_format_ok(data[0], data[1], data[2]);
		break;

		case AUDSRV_SET_FORMAT:
		ret = audsrv_set_format(data[0], data[1], data[2]);
		break;

		case AUDSRV_WAIT_AUDIO:
		ret = audsrv_wait_audio(data[0]);
		break;

		case AUDSRV_PLAY_AUDIO:
		ret = audsrv_play_audio((const char *)&data[1], data[0]);
		break;

		case AUDSRV_STOP_AUDIO:
		ret = audsrv_stop_audio();
		break;

		case AUDSRV_SET_VOLUME:
		ret = audsrv_set_volume(data[0]);
		break;

		case AUDSRV_QUIT:
		ret = audsrv_quit();
		break;

		case AUDSRV_PLAY_CD:
		ret = audsrv_play_cd(data[0]);
		break;

		case AUDSRV_STOP_CD:
		ret = audsrv_stop_cd();
		break;

		case AUDSRV_GET_CDPOS:
		ret = audsrv_get_cdpos();
		break;

		case AUDSRV_GET_TRACKPOS:
		ret = audsrv_get_trackpos();
		break;

		case AUDSRV_SET_THRESHOLD:
		ret = audsrv_set_threshold(data[0]);
		break;

		case AUDSRV_GET_NUMTRACKS:
		ret = audsrv_get_numtracks();
		break;

		case AUDSRV_GET_TRACKOFFSET:
		ret = audsrv_get_track_offset(data[0]);
		break;

		case AUDSRV_PLAY_SECTORS:
		ret = audsrv_cd_play_sectors(data[0], data[1]);
		break;

		case AUDSRV_GET_CD_STATUS:
		ret = audsrv_get_cd_status();
		break;

		case AUDSRV_GET_CD_TYPE:
		ret = audsrv_get_cd_type();
		break;

		case AUDSRV_PAUSE_CD:
		ret = audsrv_cd_pause();
		break;

		case AUDSRV_RESUME_CD:
		ret = audsrv_cd_resume();
		break;

		case AUDSRV_INIT_ADPCM:
		ret = audsrv_adpcm_init();
		break;

		case AUDSRV_LOAD_ADPCM:
		return audsrv_load_adpcm((u32*)data[0], data[1], data[2]);

		case AUDSRV_PLAY_ADPCM:
		ret = audsrv_play_adpcm(data[0]);
		break;

		default:
		ret = -1;
		break;
	}

	data[0] = ret;
	return data;
}