Index: /winamp-musepack/trunk/winamp-musepack/in_mpc.cpp
===================================================================
--- /winamp-musepack/trunk/winamp-musepack/in_mpc.cpp	(revision 187)
+++ /winamp-musepack/trunk/winamp-musepack/in_mpc.cpp	(revision 188)
@@ -158,6 +158,7 @@
 // point (seek_needed is -1 when no seek is needed)
 // and the decode thread checks seek_needed.
-void setoutputtime(int time_in_ms) { 
-	player->seek_offset = time_in_ms;
+void setoutputtime(int time_in_ms)
+{
+	player->setOutputTime(time_in_ms);
 }
 
@@ -181,5 +182,10 @@
 void getfileinfo(char *filename, char *title, int *length_in_ms)
 {
-	player->getFileInfo(filename, title, length_in_ms);
+	if (!filename || !*filename)
+		player->getFileInfo(title, length_in_ms);
+	else {
+		mpc_player info_play(filename, &mod);
+		info_play.getFileInfo(title, length_in_ms);
+	}
 }
 
Index: /winamp-musepack/trunk/winamp-musepack/mpc_player.cpp
===================================================================
--- /winamp-musepack/trunk/winamp-musepack/mpc_player.cpp	(revision 187)
+++ /winamp-musepack/trunk/winamp-musepack/mpc_player.cpp	(revision 188)
@@ -9,4 +9,20 @@
 mpc_player::mpc_player(In_Module * in_mod)
 {
+	init(in_mod);
+}
+
+mpc_player::mpc_player(char * fn, In_Module * in_mod)
+{
+	init(in_mod);
+	openFile(fn);
+}
+
+mpc_player::~mpc_player(void)
+{
+	closeFile();
+}
+
+void mpc_player::init(In_Module * in_mod)
+{
 	thread_handle=INVALID_HANDLE_VALUE;
 	killDecodeThread=0;
@@ -14,16 +30,12 @@
 	demux = 0;
 	mod = in_mod;
-}
-
-mpc_player::~mpc_player(void)
+	wait_event = 0;
+}
+
+int mpc_player::openFile(char * fn)
 {
 	closeFile();
-}
-
-int mpc_player::openFile(char * fn)
-{
-	mpc_status err;
-
-    err = mpc_reader_init_stdio(&reader, fn);
+
+    mpc_status err = mpc_reader_init_stdio(&reader, fn);
     if(err < 0) return 1;
 
@@ -35,4 +47,5 @@
 
     mpc_demux_get_info(demux,  &si);
+	strcpy(lastfn, fn);
 	return 0;
 }
@@ -45,4 +58,10 @@
 		mpc_reader_exit_stdio(&reader);
 	}
+}
+
+void mpc_player::setOutputTime(int time_in_ms)
+{
+	seek_offset = time_in_ms;
+	if (wait_event) SetEvent(wait_event);
 }
 
@@ -73,4 +92,6 @@
 {
 	int done = 0;
+
+	wait_event = CreateEvent(0, FALSE, FALSE, 0);
 
 	while (!killDecodeThread) 
@@ -92,5 +113,5 @@
 				break;
 			}
-			Sleep(10);		// give a little CPU time back to the system.
+			WaitForSingleObject(wait_event, 100);		// give a little CPU time back to the system.
 		} else if (mod->outMod->CanWrite() >= (MPC_FRAME_LENGTH * sizeof(short) * si.channels)*(mod->dsp_isactive()?2:1)) {
 			// CanWrite() returns the number of bytes you can write, so we check that
@@ -105,5 +126,5 @@
 
 			if(frame.bits == -1) {
-				done=1;
+				done = 1;
 			} else {
 				short output_buffer[MPC_FRAME_LENGTH * 2]; // default 2 channels
@@ -124,32 +145,20 @@
 				mod->outMod->Write((char*)output_buffer, frame.samples * sizeof(short) * si.channels);
 			}
-		} else Sleep(20);
-	}
+		} else WaitForSingleObject(wait_event, 1000);
+	}
+
+	CloseHandle(wait_event);
+	wait_event = 0;
+
 	return 0;
 }
 
-void mpc_player::getFileInfo(char *filename, char *title, int *length_in_ms)
-{
-	if (!filename || !*filename) {
-		if (length_in_ms) *length_in_ms = getLength();
-		if (title) {
-			char *p = lastfn + strlen(lastfn);
-			while (*p != '\\' && p >= lastfn) p--;
-			strcpy(title,++p);
-		}
-	} else {
-		if (length_in_ms) {
-			if (openFile(filename) == 0) {
-				closeFile();
-				*length_in_ms = getLength();
-			} else {
-				*length_in_ms = -1000; // the default is unknown file length (-1000).
-			}
-		}
-		if (title) {
-			char *p = filename + strlen(filename);
-			while (*p != '\\' && p >= filename) p--;
-			strcpy(title,++p);
-		}
+void mpc_player::getFileInfo(char *title, int *length_in_ms)
+{
+	if (length_in_ms) *length_in_ms = getLength();
+	if (title) {
+		char *p = lastfn + strlen(lastfn);
+		while (*p != '\\' && p >= lastfn) p--;
+		strcpy(title,++p);
 	}
 }
@@ -158,12 +167,11 @@
 void mpc_player::stop(void)
 { 
-	if (thread_handle != INVALID_HANDLE_VALUE)
-	{
-		killDecodeThread=1;
-		if (WaitForSingleObject(thread_handle,10000) == WAIT_TIMEOUT)
-		{
+	if (thread_handle != INVALID_HANDLE_VALUE) {
+		killDecodeThread = 1;
+		if (wait_event) SetEvent(wait_event);
+		if (WaitForSingleObject(thread_handle,10000) == WAIT_TIMEOUT) {
 			MessageBox(mod->hMainWindow,"error asking thread to die!\n",
-				"error killing decode thread",0);
-			TerminateThread(thread_handle,0);
+				"error killing decode thread", 0);
+			TerminateThread(thread_handle, 0);
 		}
 		CloseHandle(thread_handle);
@@ -189,6 +197,4 @@
 
 	if (openFile(fn) != 0) return 1;
-	
-	strcpy(lastfn,fn);
 
 	// -1 and -1 are to specify buffer and prebuffer lengths.
Index: /winamp-musepack/trunk/winamp-musepack/mpc_player.h
===================================================================
--- /winamp-musepack/trunk/winamp-musepack/mpc_player.h	(revision 187)
+++ /winamp-musepack/trunk/winamp-musepack/mpc_player.h	(revision 188)
@@ -11,15 +11,17 @@
 public:
 	mpc_player(In_Module * in_mod);
+	mpc_player(char * fn, In_Module * in_mod);
 	~mpc_player(void);
 
 	int play(char *fn);
 	void stop(void);
-	void getFileInfo(char *filename, char *title, int *length_in_ms);
+
+	void getFileInfo(char *title, int *length_in_ms);
 	int getLength(void) {return si.samples * 1000 / si.sample_freq;}
 	int getOutputTime(void) {return decode_pos_sample * 1000 / si.sample_freq;}
 
+	void setOutputTime(int time_in_ms);
+
 	int paused;				// are we paused?
-	volatile int seek_offset; // if != -1, it is the point that the decode 
-							  // thread should seek to, in ms.
 
 private:
@@ -31,7 +33,10 @@
 
 	__int64 decode_pos_sample; // decoding position in samples;
+	volatile int seek_offset; // if != -1, it is the point that the decode 
+							  // thread should seek to, in ms.
 	volatile int killDecodeThread;	// the kill switch for the decode thread
 
 	HANDLE thread_handle;	// the handle to the decode thread
+	HANDLE wait_event;
 
 	In_Module * mod;
@@ -42,4 +47,6 @@
 	void closeFile(void);
 
+	void init(In_Module * in_mod);
+
 	void scaleSamples(short * buffer, int len);
 };
Index: /winamp-musepack/trunk/winamp-musepack/winamp-musepack.vcproj
===================================================================
--- /winamp-musepack/trunk/winamp-musepack/winamp-musepack.vcproj	(revision 187)
+++ /winamp-musepack/trunk/winamp-musepack/winamp-musepack.vcproj	(revision 188)
@@ -176,4 +176,8 @@
 				>
 			</File>
+			<File
+				RelativePath=".\out.h"
+				>
+			</File>
 		</Filter>
 		<Filter
