Exemplo n.º 1
0
Arquivo: mp3.c Projeto: 173210/mvspsp
void mp3_seek_start(void)
{
	if (mp3_thread >= 0)
	{
		mp3_set_volume();
		sceKernelWakeupThread(mp3_thread);
	}
}
Exemplo n.º 2
0
Arquivo: mp3.c Projeto: 173210/mvspsp
int mp3_play(const char *name)
{
	if (mp3_thread >= 0)
	{
		strcpy(MP3_file, name);

		mp3_stop();

		if ((mp3_fd = sceIoOpen(MP3_file, PSP_O_RDONLY, 0777)) >= 0)
		{
			MP3_get_filesize();

			mp3_status  = MP3_PLAY;
			mp3_newfile = 1;

			mp3_set_volume();

			sceKernelWakeupThread(mp3_thread);
			return 0;
		}
	}
	return 1;
}
void SoundManagerClass::setVolume(byte volume)
{
	mp3_set_volume(volume);
}
Exemplo n.º 4
0
static State StateInitPlayer(StateAction action) {
    scrDeclare;

    if (action == Enter) {
        PowerToPeripherals(1);
        NumTracks = 0;
        scrReset;
        return Continue;
    }
    
    if (action == Update) {
        if (BtnPlay->stateChanged && BtnPlay->state == Pressed) {
            GoToPlayTrack = 1;
        }

        if (BtnSelect->stateChanged && BtnSelect->state == Pressed) {
            RotateTrack();
            Set7SegmentDisplay(TrackNumber);
        }
        
        if (Time < StateWaitUntil) {
            return Continue;
        }
        
        scrBegin;
        scrSleep(1300);
        static u32 numFilesTimeout;
        numFilesTimeout = Time + 1000;
        mp3_set_volume(15);
        scrSleep(20);
        mp3_get_num_files_async();
               
        while (1) {
            scrReturn(Continue);
            
            if (Time > numFilesTimeout) {
                scrReturn(Sleep);
            }
            
            if (!mp3_check_for_result()) {
                continue;
            }

            NumTracks = mp3_get_result();
            
            if (TrackNumber > NumTracks) {
                TrackNumber = NumTracks;
                Set7SegmentDisplay(TrackNumber);
            }           
            
            if (NumTracks == 0) {
                scrReturn(Sleep);
            }

            if (GoToPlayTrack) {
                scrReturn(PlayTrack);
            }

            scrReturn(StandBy);
        }
        
        // Shouldn't come here
        scrFinish(None);
    }
    
    return Continue;
}