Exemple #1
0
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	SpotifyPlayer *sp;
	HANDLE hSpotifyEvent;
	audio_fifo_t audioFifo;
	Visualizer *pVisualizer;

	// Setup an event to use for notification
	hSpotifyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (hSpotifyEvent == NULL) {
        return 0;
    }

	// Connect to spotify
	sp = new SpotifyPlayer(&audioFifo, hSpotifyEvent);

	// Create visualizer
	pVisualizer = new HistogramVisualizer();
	pVisualizer->SetSpotifyPlayer(sp);

	// Create window and run messageloop
	Candify app(sp, pVisualizer, hSpotifyEvent);

	if (FAILED(app.Initialize())) {
		MessageBox(NULL, "Application failed to initialize.", "Candify", MB_ICONEXCLAMATION);
		return 0;
	}

	// Initialize sound
	audio_init(&audioFifo, app.GetHWND());

	app.RunMessageLoop();

    return 0;
}