예제 #1
0
int StopAt3(int channel)
{
	if ((channel<0)||(channel>1))
	{
		return PSPAALIB_ERROR_AT3_INVALID_CHANNEL;
	}
	if (!streamsAt3[channel].initialized)
	{
		return PSPAALIB_ERROR_AT3_UNINITIALIZED_CHANNEL;
	}
	RewindAt3(channel);
	streamsAt3[channel].paused=TRUE;
	streamsAt3[channel].stopReason=PSPAALIB_STOP_ON_REQUEST;
	return PSPAALIB_SUCCESS;
}
예제 #2
0
int AalibRewind(int channel)
{
	if ((PSPAALIB_CHANNEL_WAV_1<=channel)&&(channel<=PSPAALIB_CHANNEL_WAV_32))
	{
		return RewindWav(channel-PSPAALIB_CHANNEL_WAV_1);
	}
	if ((PSPAALIB_CHANNEL_OGG_1<=channel)&&(channel<=PSPAALIB_CHANNEL_OGG_10))
	{
		return RewindOgg(channel-PSPAALIB_CHANNEL_OGG_1);
	}
	if ((PSPAALIB_CHANNEL_SCEMP3_1<=channel)&&(channel<=PSPAALIB_CHANNEL_SCEMP3_2))
	{
		return RewindSceMp3(channel-PSPAALIB_CHANNEL_SCEMP3_1);
	}
	if ((PSPAALIB_CHANNEL_AT3_1<=channel)&&(channel<=PSPAALIB_CHANNEL_AT3_2))
	{
		return RewindAt3(channel-PSPAALIB_CHANNEL_AT3_1);
	}
	return PSPAALIB_ERROR_INVALID_CHANNEL;
}
예제 #3
0
int GetBufferAt3(short* buf,int length,float amp,int channel)
{
	if ((channel<0)||(channel>1))
	{
		return PSPAALIB_ERROR_AT3_INVALID_CHANNEL;
	}
	int byteLength=length<<2;
	if ((streamsAt3[channel].paused)||(!streamsAt3[channel].initialized))
	{
		memset(buf,0,byteLength);
		return PSPAALIB_WARNING_PAUSED_BUFFER_REQUESTED;
	}
	int num,end,remain,i;
	while (streamsAt3[channel].bufSize<byteLength)
	{
		sceAtracDecodeData(streamsAt3[channel].id,(void*)streamsAt3[channel].tempBuf,&num,&end,&remain);
		if (end)
		{
			if (!streamsAt3[channel].autoloop)
			{
				streamsAt3[channel].paused=TRUE;
				streamsAt3[channel].stopReason=PSPAALIB_STOP_END_OF_STREAM;
				memset(buf,0,byteLength);
				return PSPAALIB_WARNING_END_OF_STREAM_REACHED;
			}
			RewindAt3(channel);
		}
		streamsAt3[channel].buf=(unsigned short*)realloc(streamsAt3[channel].buf,streamsAt3[channel].bufSize+(4*num));
		memcpy((void*)streamsAt3[channel].buf+streamsAt3[channel].bufSize,streamsAt3[channel].tempBuf,4*num);
		streamsAt3[channel].bufSize+=4*num;
	}
	for (i=0;i<2*length;i++)
	{
		buf[i]=streamsAt3[channel].buf[i]*amp;
	}
	streamsAt3[channel].bufSize-=byteLength;
	memmove((void*)streamsAt3[channel].buf,(void*)streamsAt3[channel].buf+byteLength,streamsAt3[channel].bufSize);
	return PSPAALIB_SUCCESS;
}