Ejemplo n.º 1
0
static void asap_play_file(char *filename)
{
	const ASAPInfo *info;
	int song;
	int duration;
	char *title;
	if (asap == NULL)
		return;
	if (!asap_load_file(filename))
		return;
	if (!ASAP_Load(asap, filename, module, module_len))
		return;
	info = ASAP_GetInfo(asap);
	song = ASAPInfo_GetDefaultSong(info);
	duration = ASAPInfo_GetDuration(info, song);
	if (!ASAP_PlaySong(asap, song, duration))
		return;
	channels = ASAPInfo_GetChannels(info);
	if (!mod.output->open_audio(BITS_PER_SAMPLE == 8 ? FMT_U8 : FMT_S16_LE, ASAP_SAMPLE_RATE, channels))
		return;
	title = asap_get_title(filename, info);
	mod.set_info(title, duration, BITS_PER_SAMPLE * 1000, ASAP_SAMPLE_RATE, channels);
	g_free(title);
	seek_to = -1;
	thread_run = TRUE;
	generated_eof = FALSE;
	pthread_create(&thread_handle, NULL, asap_play_thread, NULL);
}
Ejemplo n.º 2
0
static void asap_get_song_info(char *filename, char **title, int *length)
{
	ASAPInfo *info = asap_get_info(filename);
	if (info == NULL)
		return;
	*title = asap_get_title(filename, info);
	*length = ASAPInfo_GetDuration(info, ASAPInfo_GetDefaultSong(info));
	ASAPInfo_Delete(info);
}
Ejemplo n.º 3
0
static void asap_get_song_info(char *filename, char **title, int *length)
{
	ASAP_ModuleInfo module_info;
	if (!asap_load_file(filename))
		return;
	if (!ASAP_GetModuleInfo(&module_info, filename, module, module_len))
		return;
	*title = asap_get_title(filename, &module_info);
	*length = module_info.durations[module_info.default_song];
}
Ejemplo n.º 4
0
static void asap_play_file(char *filename)
{
	int song;
	int duration;
	char *title;
	if (!asap_load_file(filename))
		return;
	if (!ASAP_Load(&asap, filename, module, module_len))
		return;
	song = asap.module_info.default_song;
	duration = asap.module_info.durations[song];
	ASAP_PlaySong(&asap, song, duration);
	channels = asap.module_info.channels;
	if (!mod.output->open_audio(BITS_PER_SAMPLE == 8 ? FMT_U8 : FMT_S16_LE,
		ASAP_SAMPLE_RATE, channels))
		return;
	title = asap_get_title(filename, &asap.module_info);
	mod.set_info(title, duration, BITS_PER_SAMPLE * 1000, ASAP_SAMPLE_RATE, channels);
	g_free(title);
	seek_to = -1;
	thread_run = TRUE;
	generated_eof = FALSE;
	pthread_create(&thread_handle, NULL, asap_play_thread, NULL);
}