コード例 #1
0
ファイル: pmp_play.c プロジェクト: DavisDev/pmplayer-advance
void pmp_play_close(struct pmp_play_struct *p, int usePos, int pspType)
	{
	if (!(p->audio_reserved < 0)) {
		while(sceAudioGetChannelRestLen(0) > 0 );
		sceAudioChRelease(0);
	}
	cooleyesAudioSetFrequency(sceKernelDevkitVersion(), 44100);

	if (!(p->semaphore_can_get   < 0)) sceKernelDeleteSema(p->semaphore_can_get);
	if (!(p->semaphore_can_put   < 0)) sceKernelDeleteSema(p->semaphore_can_put);
	if (!(p->semaphore_can_show  < 0)) sceKernelDeleteSema(p->semaphore_can_show);
	if (!(p->semaphore_show_done < 0)) sceKernelDeleteSema(p->semaphore_show_done);

	if (!(p->output_thread < 0)) sceKernelDeleteThread(p->output_thread);
	if (!(p->show_thread   < 0)) sceKernelDeleteThread(p->show_thread);

	pmp_decode_close(&p->decoder, pspType);

	int i = 0;
	for (i=0; i<p->subtitle_count; i++)
		subtitle_parse_close( &subtitle_parser[i] );
	
	//if (usePos) pmp_stat_save( p );
	pmp_stat_save( p );
	
	pmp_play_safe_constructor(p);
	}
コード例 #2
0
ファイル: pspaalib.c プロジェクト: libcg/XtreamLua-Player
int PlayThread(SceSize argsize, void* args)
{
	if (argsize!=sizeof(int))
	{
		sceKernelExitThread(0);
	}
	int hardwareChannel=*((int*)args);
	int channel=hardwareChannels[hardwareChannel];
	int stopReason;
	void *mainBuf,*backBuf,*tempBuf;
	mainBuf=malloc(4096);
	backBuf=malloc(4096);
	sceAudioChReserve(hardwareChannel,1024,PSP_AUDIO_FORMAT_STEREO);
	while(TRUE)
	{
		stopReason=AalibGetStopReason(channel);
		if (!stopReason)
		{
			goto Play;
		}
		else if (stopReason<0)
		{
			sceKernelDelayThread(10);
			continue;
		}
		else
		{
			goto Release;
		}
	}
Play:
	GetProcessedBuffer(mainBuf,1024,channel);
	while (!AalibGetStopReason(channel))
	{
		sceAudioOutputPanned(hardwareChannel,(unsigned int)(channels[channel].volume.left*channels[channel].audioStrength*PSP_AUDIO_VOLUME_MAX),(unsigned int)(channels[channel].volume.right*channels[channel].audioStrength*PSP_AUDIO_VOLUME_MAX),mainBuf);
		GetProcessedBuffer(backBuf,1024,channel);
		while (sceAudioGetChannelRestLen(hardwareChannel))
			sceKernelDelayThread(100);
		
		tempBuf=mainBuf;
		mainBuf=backBuf;
		backBuf=tempBuf;
	}
Release:
	FreeHardwareChannel(channel);
	AalibStop(channel);
	sceKernelExitThread(0);
	return 0;
}