Example #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);
}
Example #2
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];
}
Example #3
0
static ASAPInfo *asap_get_info(const char *filename)
{
	ASAPInfo *info;
	if (!asap_load_file(filename))
		return NULL;
	info = ASAPInfo_New();
	if (info == NULL)
		return NULL;
	if (!ASAPInfo_Load(info, filename, module, module_len)) {
		ASAPInfo_Delete(info);
		return NULL;
	}
	return info;
}
Example #4
0
static void asap_file_info_box(char *filename)
{
	ASAP_ModuleInfo module_info;
	char info[512];
	char *p;
	if (!asap_load_file(filename))
		return;
	if (!ASAP_GetModuleInfo(&module_info, filename, module, module_len))
		return;
	p = asap_stpcpy(info, "Author: ");
	p = asap_stpcpy(p, module_info.author);
	p = asap_stpcpy(p, "\nName: ");
	p = asap_stpcpy(p, module_info.name);
	p = asap_stpcpy(p, "\nDate: ");
	p = asap_stpcpy(p, module_info.date);
	*p = '\0';
	asap_show_message("File information", info);
}
Example #5
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);
}