Esempio n. 1
0
void S_Init(int sfxVolume, int musicVolume) {
	nosfxparm = 0;
	nomusicparm = 0;
	audio_initialized = 0;
	//return;

	if (csndInit() == 0) {
		printf("csndInit ok!\n");
		audio_initialized = 1;
	}
	else {
		printf("csndInit failed!\n");
		nosfxparm = 1;
		nomusicparm = 1;
		return;
	}
	MIX_init();
	mus_init();
}
Esempio n. 2
0
void sub_music_playsel(void)
{
    struct stat statbuf;
    char *path;
    tlistitem *item = NULL;

    item = LIST_getSelected();
    if (!item)
        return;

    path = (char *) item->extra;
    if (!path)
        return;

    stat(path, &statbuf);

    if (S_ISDIR(statbuf.st_mode))
    {
        LIST_in();
        sprintf(music_path, "%s", path);
        music_levels++;
        music_stage = 1;
        music_animtimer_b = music_animtimer = SDL_GetTicks();
        sfx_play(SFXOK);
    }
    else
    {
        Mix_CloseAudio();
        music_stage = MUS_FULLSCREEN;
        xmb_activateFlag(XMB_APPFULLSCREEN);
        if (!strncasecmp(sub_music_ext(path), ".ogg", 4))
        {
            mus_init = op_init;
            mus_play = op_play;
            mus_stop = op_stop;
            mus_getpos = op_getpos;
            mus_getlength = op_getlength;
            mus_ready = op_ready;
            mus_fwd = op_fwd;
            mus_bwd = op_bwd;
            mus_eof = op_eof;
        }
        else
        {
            mus_init = mp3_init;
            mus_play = mp3_play;
            mus_stop = mp3_stop;
            mus_getpos = mp3_getpos;
            mus_getlength = mp3_getlength;
            mus_ready = mp3_ready;
            mus_fwd = mp3_fwd;
            mus_bwd = mp3_bwd;
            mus_eof = mp3_eof;
        }

        mus_init(path);
        mus_play();

        sub_music_playing = 1;
    }
}