Esempio n. 1
0
static u32 sceAudioChReserve(int chan, u32 sampleCount, u32 format) {
    if (chan < 0) {
        chan = GetFreeChannel();
        if (chan < 0) {
            ERROR_LOG(SCEAUDIO, "sceAudioChReserve - no channels remaining");
            return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
        }
    }
    if ((u32)chan >= PSP_AUDIO_CHANNEL_MAX)	{
        ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - bad channel", chan, sampleCount, format);
        return SCE_ERROR_AUDIO_INVALID_CHANNEL;
    }
    if ((sampleCount & 63) != 0 || sampleCount == 0 || sampleCount > PSP_AUDIO_SAMPLE_MAX) {
        ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - invalid sample count", chan, sampleCount, format);
        return SCE_ERROR_AUDIO_OUTPUT_SAMPLE_DATA_SIZE_NOT_ALIGNED;
    }
    if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO) {
        ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - invalid format", chan, sampleCount, format);
        return SCE_ERROR_AUDIO_INVALID_FORMAT;
    }
    if (chans[chan].reserved) {
        ERROR_LOG(SCEAUDIO, "sceAudioChReserve - reserve channel failed");
        return SCE_ERROR_AUDIO_INVALID_CHANNEL;
    }

    DEBUG_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x)", chan, sampleCount, format);
    chans[chan].sampleCount = sampleCount;
    chans[chan].format = format;
    chans[chan].reserved = true;
    chans[chan].leftVolume = 0;
    chans[chan].rightVolume = 0;
    return chan;
}
Esempio n. 2
0
u32 sceAudioChReserve(u32 channel, u32 sampleCount, u32 format) //.Allocate sound channel
{
	if (channel == (u32)-1)
	{
		channel = GetFreeChannel();
	}
	else
	{
		ERROR_LOG(HLE,"sceAudioChReserve failed");
		return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
	}

	if (channel >= PSP_AUDIO_CHANNEL_MAX)
	{
		ERROR_LOG(HLE ,"sceAudioChReserve(channel = %d, sampleCount = %d, format = %d) - BAD CHANNEL", channel, sampleCount, format);
		return SCE_ERROR_AUDIO_INVALID_CHANNEL;
	}

	if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO)
	{
		ERROR_LOG(HLE, "sceAudioChReserve(channel = %d, sampleCount = %d, format = %d): invalid format", channel, sampleCount, format);
		return SCE_ERROR_AUDIO_INVALID_FORMAT;
	}

	if (chans[channel].reserved)
	{
		WARN_LOG(HLE, "WARNING: Reserving already reserved channel. Error?");
	}
	DEBUG_LOG(HLE, "sceAudioChReserve(channel = %d, sampleCount = %d, format = %d)", channel, sampleCount, format);

	chans[channel].sampleCount = sampleCount;
	chans[channel].reserved = true;
	return channel; //return handle
}
Esempio n. 3
0
u32 sceAudioChReserve(u32 chan, u32 sampleCount, u32 format) {
	if (chan == (u32)-1) {
		chan = GetFreeChannel();
	} 
	if (chan >= PSP_AUDIO_CHANNEL_MAX)	{
		ERROR_LOG(HLE ,"sceAudioChReserve(%08x, %08x, %08x) - bad channel", chan, sampleCount, format);
		return SCE_ERROR_AUDIO_INVALID_CHANNEL;
	}
	if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO) {
		ERROR_LOG(HLE, "sceAudioChReserve(%08x, %08x, %08x) - invalid format", chan, sampleCount, format);
		return SCE_ERROR_AUDIO_INVALID_FORMAT;
	}
	if (chans[chan].reserved) {
		ERROR_LOG(HLE,"sceAudioChReserve - reserve channel failed");
		return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
	}

	DEBUG_LOG(HLE, "sceAudioChReserve(%08x, %08x, %08x)", chan, sampleCount, format);
	chans[chan].sampleCount = sampleCount;
	chans[chan].reserved = true;
	return chan; 
}