Пример #1
0
// window procedure
long FAR PASCAL SpectrumWindowProc(HWND h, UINT m, WPARAM w, LPARAM l)
{
	switch (m) {
		case WM_LBUTTONDOWN: // set loop start
			SetLoopStart(LOWORD(l)*bpp);
			return 0;
		case WM_RBUTTONDOWN: // set loop end
			SetLoopEnd(LOWORD(l)*bpp);
			return 0;
		case WM_MOUSEMOVE:
			if (w&MK_LBUTTON) SetLoopStart(LOWORD(l)*bpp);
			if (w&MK_RBUTTON) SetLoopEnd(LOWORD(l)*bpp);
			return 0;

		case WM_TIMER:
			InvalidateRect(h,0,0); // refresh window
			return 0;
		case WM_PAINT:
			if (GetUpdateRect(h,0,0)) {
				PAINTSTRUCT p;
				HDC dc;
				if (!(dc=BeginPaint(h,&p))) return 0;
				BitBlt(dc,0,0,WIDTH,HEIGHT,wavedc,0,0,SRCCOPY); // draw peak waveform
				DrawTimeLine(dc,loop[0],0xffff00,12); // loop start
				DrawTimeLine(dc,loop[1],0x00ffff,24); // loop end
				DrawTimeLine(dc,BASS_ChannelGetPosition(chan,BASS_POS_BYTE),0xffffff,0); // current pos
				EndPaint(h,&p);
			}
			return 0;

		case WM_CREATE:
			win=h;
			// initialize BASS
			if (!BASS_Init(-1,44100,0,win,NULL)) {
				Error("Can't initialize device");
				return -1;
			}
			if (!PlayFile()) { // start a file playing
				BASS_Free();
				return -1;
			}
			SetTimer(h,0,100,0); // set update timer (10hz)
			break;

		case WM_DESTROY:
			KillTimer(h,0);
			if (scanthread) { // still scanning
				killscan=TRUE;
				WaitForSingleObject(scanthread,1000); // wait for the thread
			}
			BASS_Free();
			if (wavedc) DeleteDC(wavedc);
			if (wavebmp) DeleteObject(wavebmp);
			PostQuitMessage(0);
			break;
	}
	return DefWindowProc(h, m, w, l);
}
Пример #2
0
bool GCBanner::Load( const U8Archive &GCBannArc )
{
	// read layout data
	const u8 *brlytFile = GCBannArc.GetFile("/arc/blyt/my_GCTop_a.brlyt");
	if( !brlytFile )
		return false;

	if(!Layout::Load(brlytFile))
		return false;

	u32 length_start = 0, length_loop = 0;

	const u8 *brlan_loop = GCBannArc.GetFile("/arc/anim/my_GCTop_a_BackLoop.brlan");
	if (brlan_loop)
		length_loop = Animator::LoadAnimators((const RLAN_Header *)brlan_loop, *this, 1);

	LoadTextures(GCBannArc);
	SetLanguage("ENG");
	SetLoopStart(length_start);
	SetLoopEnd(length_start + length_loop);
	SetFrame(0);

	return true;
}