diff src/Input/modplug/plugin.cxx @ 0:13389e613d67 trunk

[svn] - initial import of audacious-plugins tree (lots to do)
author nenolod
date Mon, 18 Sep 2006 01:11:49 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Input/modplug/plugin.cxx	Mon Sep 18 01:11:49 2006 -0700
@@ -0,0 +1,111 @@
+/* Modplug XMMS Plugin
+ * Authors: Kenton Varda <temporal@gauge3d.org>
+ *
+ * This source code is public domain.
+ */
+
+#include "audacious/plugin.h"
+#include <libmodplug/modplug.h>
+#include "gui/main.h"
+
+extern InputPlugin gModPlug;
+
+static void Init(void)
+{
+	gModplugXMMS.SetInputPlugin(gModPlug);
+	gModplugXMMS.Init();
+}
+
+static int CanPlayFile(char* aFilename)
+{
+	if(gModplugXMMS.CanPlayFile(aFilename))
+		return 1;
+	return 0;
+}
+
+static void PlayFile(char* aFilename)
+{
+	gModplugXMMS.SetOutputPlugin(*gModPlug.output);
+	gModplugXMMS.PlayFile(aFilename);
+}
+
+static void Stop(void)
+{
+	gModplugXMMS.Stop();
+}
+
+static void Pause(short aPaused)
+{
+	gModplugXMMS.Pause((bool)aPaused);
+}
+
+static void Seek(int aTime)
+{
+	gModplugXMMS.Seek(float32(aTime));
+}
+static int GetTime(void)
+{
+	float32 lTime;
+	
+	lTime = gModplugXMMS.GetTime();
+	if(lTime == -1)
+		return -1;
+	else
+		return (int)(lTime * 1000);
+}
+
+static void GetSongInfo(char* aFilename, char** aTitle, int* aLength)
+{
+	gModplugXMMS.GetSongInfo(aFilename, *aTitle, *aLength);
+}
+
+void ShowAboutBox(void)
+{
+	ShowAboutWindow();
+}
+
+void ShowConfigureBox(void)
+{
+	ShowConfigureWindow(gModplugXMMS.GetModProps());
+}
+
+void ShowFileInfoBox(char* aFilename)
+{
+	ShowInfoWindow(aFilename);
+}
+
+InputPlugin gModPlug =
+{
+	NULL,
+	NULL,
+	"ModPlug Player",
+	Init,
+	ShowAboutBox,
+	ShowConfigureBox,
+	CanPlayFile,
+	NULL,
+	PlayFile,
+	Stop,
+	Pause,
+	Seek,
+	NULL,
+	GetTime,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	GetSongInfo,
+	ShowFileInfoBox,
+	NULL
+};
+
+extern "C"
+{
+	InputPlugin* get_iplugin_info (void)
+	{
+		return &gModPlug;
+	}
+}