#pragma once
#include <string>
using namespace std;
#include "timehandling.h"

//================================================================================
class Winamp
{
public:
	void frame();
	void command(const string& subcommand, const string& arg1="", const string& arg2="", const string& arg3="");

	string title;

protected:
	HWND   hwnd;

	// volume stuff
	float crossfade; // 0..1

	void searchWindow();
	void updateTitle();

	void fadein();
	void fadeout();
	void setfracvol();

	void play ();
	void pause();

	bool paused;
	bool playing;

	EventCounter<0.1> fadeEventCounter;             // fade one tick up/down every 0.1 seconds
	EventCounter<10>  searchForWindowEventCounter;  // search for winamp window every 10 seconds
	EventCounter<2>   titleUpdateEventCounter;      // update title every 2 seconds

public:
	Winamp();
};

extern Winamp winamp;