示例#1
0
文件: wasap.c 项目: Erikhht/TCPMP
static void LoadFile(HWND hWnd)
{
	HANDLE fh;
	static unsigned char module[65000];
	DWORD module_len;
	fh = CreateFile(strFile, GENERIC_READ, 0, NULL, OPEN_EXISTING,
	                FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
	if (fh == INVALID_HANDLE_VALUE)
		return;
	if (!ReadFile(fh, module, sizeof(module), &module_len, NULL)) {
		CloseHandle(fh);
		return;
	}
	CloseHandle(fh);
	WaveOut_Close();
	if (ASAP_Load(strFile, module, (unsigned int) module_len)) {
		if (!WaveOut_Open(FREQUENCY, use_16bit, ASAP_GetChannels())) {
			SetSongs(0);
			Tray_Modify(hWnd, hStopIcon);
			MessageBox(hWnd, "Error initalizing WaveOut", APP_TITLE,
					   MB_OK | MB_ICONERROR);
			return;
		}
		SetSongs(ASAP_GetSongs());
		PlaySong(hWnd, ASAP_GetDefSong());
	}
	else {
		SetSongs(0);
		Tray_Modify(hWnd, hStopIcon);
		MessageBox(hWnd, "Unsupported file format", APP_TITLE,
		           MB_OK | MB_ICONERROR);
	}
}
示例#2
0
bool OrganiseDialog::SetFilenames(const QStringList& filenames) {
  songs_future_ =
      QtConcurrent::run(this, &OrganiseDialog::LoadSongsBlocking, filenames);
  QFutureWatcher<SongList>* watcher = new QFutureWatcher<SongList>(this);
  watcher->setFuture(songs_future_);
  NewClosure(watcher, SIGNAL(finished()), [=]() {
    SetSongs(songs_future_.result());
    watcher->deleteLater();
  });

  SetLoadingSongs(true);
  return true;
}
示例#3
0
文件: wasap.c 项目: Erikhht/TCPMP
static void SetQuality(HWND hWnd, unsigned int new_16bit, unsigned int new_quality)
{
	int reopen = FALSE;
	if (songs > 0) {
		WaveOut_Stop();
		SetSongs(0);
		Tray_Modify(hWnd, hStopIcon);
		reopen = TRUE;
	}
	CheckMenuRadioItem(hQualityMenu, IDM_8BIT, IDM_16BIT,
		IDM_8BIT + new_16bit, MF_BYCOMMAND);
	CheckMenuRadioItem(hQualityMenu, IDM_QUALITY_RF, IDM_QUALITY_MB3,
		IDM_QUALITY_RF + new_quality, MF_BYCOMMAND);
	ASAP_Initialize(FREQUENCY, new_16bit, new_quality);
	use_16bit = new_16bit;
	quality = new_quality;
	if (reopen)
		LoadFile(hWnd);
}