exec("Makscript.cs");

EditActionMap("playMap.sae");
$pref::cdMusic = "true";

function CD_Init()
{
	if(!$CurrCDTrack)
		$CurrCDTrack = 1;
	rbStop(CD);
 	$cdPlayMode = 0;
	$pref::userCDOverride = "True";
	$pref::cdMusic = "True";
	rbStop(CD);
	rbSetPlayMode(CD, $cdPlayMode);
}

function CD_Play()
{

	rbPlay(CD, $CurrCDTrack);
}

function CD_Next()
{
	$CurrCDTrack++;
	echo("Current Track: " @ $CurrCDTrack);
	rbStop(CD);
	rbPlay(CD, $CurrCDTrack);
}

function CD_Prev()
{
	$CurrCDTrack--;
	echo("Current Track: " @ $CurrCDTrack);
	rbStop(CD);
	rbSetPlayMode(CD, $cdPlayMode);
	rbPlay(CD, $CurrCDTrack);
}

CD_Init();
bindCommand(keyboard0, make, "up", to, "CD_Play();");
bindCommand(keyboard0, make, "down", to, "rbStop(CD);");
bindCommand(keyboard0, make, "right", to, "CD_Next();");
bindCommand(keyboard0, make, "left", to, "CD_Prev();");
