static void expandFileSongs(HWND playlistWnd, int index) { const char *fn; fileinfo fi; int song; ASAP_ModuleInfo module_info; char *p; int j; fn = (const char *) SendMessage(mod.hMainWindow, WM_WA_IPC, index, IPC_GETPLAYLISTFILE); song = extractSongNumber(fn, fi.file); if (song >= 0 || !ASAP_IsOurFile(fi.file)) return; if (!loadModule(fi.file, module, &module_len)) return; if (!ASAP_GetModuleInfo(&module_info, fi.file, module, module_len)) return; SendMessage(playlistWnd, WM_WA_IPC, IPC_PE_DELETEINDEX, index); p = fi.file + strlen(fi.file); for (j = 0; j < module_info.songs; j++) { COPYDATASTRUCT cds; sprintf(p, "#%d", j + 1); fi.index = index + j; cds.dwData = IPC_PE_INSERTFILENAME; cds.lpData = &fi; cds.cbData = sizeof(fileinfo); SendMessage(playlistWnd, WM_COPYDATA, 0, (LPARAM) &cds); } }
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]; }
static BOOL WINAPI asapGetFileTag(LPCTSTR pszFile, MAP_PLUGIN_FILETAG *pTag) { ASAP_ModuleInfo module_info; CONVERT_FILENAME; if (!loadFile(pszFile)) return FALSE; if (!ASAP_GetModuleInfo(&module_info, ANSI_FILENAME, module, module_len)) return FALSE; getTag(&module_info, pTag); return TRUE; }
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); }
void open(service_ptr_t<file> p_filehint, const char *p_path, t_input_open_reason p_reason, abort_callback &p_abort) { if (p_reason == input_open_info_write) { int len = strlen(p_path); if (len >= MAX_PATH || !ASAP_CanSetModuleInfo(p_path)) throw exception_io_unsupported_format(); memcpy(filename, p_path, len + 1); } if (p_filehint.is_empty()) filesystem::g_open(p_filehint, p_path, filesystem::open_mode_read, p_abort); m_file = p_filehint; module_len = m_file->read(module, sizeof(module), p_abort); if (!ASAP_GetModuleInfo(&module_info, p_path, module, module_len)) throw exception_io_unsupported_format(); if (p_reason == input_open_decode) if (!ASAP_Load(&asap, p_path, module, module_len)) throw exception_io_unsupported_format(); }
BOOL __cdecl GetInfo(char *filename, int audioDataOffset, TrackInfo *trackInfo) { byte module[ASAP_MODULE_MAX]; int module_len; ASAP_ModuleInfo module_info; if (!loadModule(filename, module, &module_len)) return FALSE; if (!ASAP_GetModuleInfo(&module_info, filename, module, module_len)) return FALSE; strcpy(trackInfo->suggestedTitle, module_info.name); trackInfo->fileSize = module_len; trackInfo->seekable = TRUE; trackInfo->hasEqualizer = FALSE; int duration = getSongDuration(&module_info, module_info.default_song); trackInfo->playingTime = duration >= 0 ? duration : -1; trackInfo->bitRate = 0; trackInfo->sampleRate = ASAP_SAMPLE_RATE; trackInfo->numChannels = module_info.channels; trackInfo->bitResolution = BITS_PER_SAMPLE; strcpy(trackInfo->fileTypeDescription, "8-bit Atari music"); return TRUE; }
static void getFileInfo(char *file, char *title, int *length_in_ms) { char filename[MAX_PATH]; if (file == NULL || file[0] == '\0') file = current_filename_with_song; title_song = extractSongNumber(file, filename); if (title_song < 0) expandPlaylistSongs(); if (!loadModule(filename, module, &module_len)) return; if (!ASAP_GetModuleInfo(&title_module_info, filename, module, module_len)) return; if (title_song < 0) title_song = title_module_info.default_song; if (title != NULL) { waFormatTitle fmt_title = { NULL, NULL, title, 512, tagFunc, tagFreeFunc }; getTitle(title); // in case IPC_FORMAT_TITLE doesn't work... SendMessage(mod.hMainWindow, WM_WA_IPC, (WPARAM) &fmt_title, IPC_FORMAT_TITLE); } if (length_in_ms != NULL) *length_in_ms = getSongDuration(&title_module_info, title_song); }