Ejemplo n.º 1
0
static void WaveOut_Write(LPWAVEHDR pwh)
{
	if (playing) {
		ASAP_Generate(pwh->lpData, pwh->dwBufferLength);
		if (waveOutWrite(hwo, pwh, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
			WaveOut_Stop();
	}
}
Ejemplo n.º 2
0
static void WaveOut_Close(void)
{
	if (hwo == INVALID_HANDLE_VALUE)
		return;
	WaveOut_Stop();
	if (wh[0].dwFlags & WHDR_PREPARED)
		waveOutUnprepareHeader(hwo, &wh[0], sizeof(wh[0]));
	if (wh[1].dwFlags & WHDR_PREPARED)
		waveOutUnprepareHeader(hwo, &wh[1], sizeof(wh[1]));
	waveOutClose(hwo);
	hwo = INVALID_HANDLE_VALUE;
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
                                    LPARAM lParam)
{
	UINT idc;
	POINT pt;
	PCOPYDATASTRUCT pcds;
	switch (msg) {
	case WM_COMMAND:
		if (opening)
			break;
		idc = LOWORD(wParam);
		switch (idc) {
		case IDM_OPEN:
			SelectAndLoadFile(hWnd);
			break;
		case IDM_STOP:
			WaveOut_Stop();
			Tray_Modify(hWnd, hStopIcon);
			break;
		case IDM_ABOUT:
			MessageBox(hWnd,
				ASAP_CREDITS
				"WASAP icons (C) 2005 Lukasz Sychowicz\n\n"
				ASAP_COPYRIGHT,
				APP_TITLE " " ASAP_VERSION,
				MB_OK | MB_ICONINFORMATION);
			break;
		case IDM_EXIT:
			PostQuitMessage(0);
			break;
		default:
			if (idc >= IDM_SONG1 && idc < IDM_SONG1 + songs) {
				WaveOut_Stop();
				PlaySong(hWnd, idc - IDM_SONG1);
			}
			else if (idc >= IDM_QUALITY_RF && idc <= IDM_QUALITY_MB3)
				SetQuality(hWnd, use_16bit, idc - IDM_QUALITY_RF);
			else if (idc >= IDM_8BIT && idc <= IDM_16BIT)
				SetQuality(hWnd, idc - IDM_8BIT, quality);
			break;
		}
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case MYWM_NOTIFYICON:
		if (opening) {
			SetForegroundWindow(GetLastActivePopup(hWnd));
			break;
		}
		switch (lParam) {
		case WM_LBUTTONDOWN:
			SelectAndLoadFile(hWnd);
			break;
		case WM_RBUTTONDOWN:
			GetCursorPos(&pt);
			SetForegroundWindow(hWnd);
			TrackPopupMenu(hTrayMenu,
				TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
				pt.x, pt.y, 0, hWnd, NULL);
			PostMessage(hWnd, WM_NULL, 0, 0);
			break;
		default:
			break;
		}
		break;
	case WM_COPYDATA:
		pcds = (PCOPYDATASTRUCT) lParam;
		if (pcds->dwData == 'O' && pcds->cbData <= sizeof(strFile)) {
			memcpy(strFile, pcds->lpData, pcds->cbData);
			LoadFile(hWnd);
		}
		break;
	default:
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}
	return 0;
}
Ejemplo n.º 5
0
Archivo: wasap.c Proyecto: 070499/xbmc
static void StopPlayback(void)
{
	WaveOut_Stop();
	Tray_Modify(hStopIcon);
}