Mercurial > audlegacy-plugins
comparison 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 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:13389e613d67 |
|---|---|
| 1 /* Modplug XMMS Plugin | |
| 2 * Authors: Kenton Varda <temporal@gauge3d.org> | |
| 3 * | |
| 4 * This source code is public domain. | |
| 5 */ | |
| 6 | |
| 7 #include "audacious/plugin.h" | |
| 8 #include <libmodplug/modplug.h> | |
| 9 #include "gui/main.h" | |
| 10 | |
| 11 extern InputPlugin gModPlug; | |
| 12 | |
| 13 static void Init(void) | |
| 14 { | |
| 15 gModplugXMMS.SetInputPlugin(gModPlug); | |
| 16 gModplugXMMS.Init(); | |
| 17 } | |
| 18 | |
| 19 static int CanPlayFile(char* aFilename) | |
| 20 { | |
| 21 if(gModplugXMMS.CanPlayFile(aFilename)) | |
| 22 return 1; | |
| 23 return 0; | |
| 24 } | |
| 25 | |
| 26 static void PlayFile(char* aFilename) | |
| 27 { | |
| 28 gModplugXMMS.SetOutputPlugin(*gModPlug.output); | |
| 29 gModplugXMMS.PlayFile(aFilename); | |
| 30 } | |
| 31 | |
| 32 static void Stop(void) | |
| 33 { | |
| 34 gModplugXMMS.Stop(); | |
| 35 } | |
| 36 | |
| 37 static void Pause(short aPaused) | |
| 38 { | |
| 39 gModplugXMMS.Pause((bool)aPaused); | |
| 40 } | |
| 41 | |
| 42 static void Seek(int aTime) | |
| 43 { | |
| 44 gModplugXMMS.Seek(float32(aTime)); | |
| 45 } | |
| 46 static int GetTime(void) | |
| 47 { | |
| 48 float32 lTime; | |
| 49 | |
| 50 lTime = gModplugXMMS.GetTime(); | |
| 51 if(lTime == -1) | |
| 52 return -1; | |
| 53 else | |
| 54 return (int)(lTime * 1000); | |
| 55 } | |
| 56 | |
| 57 static void GetSongInfo(char* aFilename, char** aTitle, int* aLength) | |
| 58 { | |
| 59 gModplugXMMS.GetSongInfo(aFilename, *aTitle, *aLength); | |
| 60 } | |
| 61 | |
| 62 void ShowAboutBox(void) | |
| 63 { | |
| 64 ShowAboutWindow(); | |
| 65 } | |
| 66 | |
| 67 void ShowConfigureBox(void) | |
| 68 { | |
| 69 ShowConfigureWindow(gModplugXMMS.GetModProps()); | |
| 70 } | |
| 71 | |
| 72 void ShowFileInfoBox(char* aFilename) | |
| 73 { | |
| 74 ShowInfoWindow(aFilename); | |
| 75 } | |
| 76 | |
| 77 InputPlugin gModPlug = | |
| 78 { | |
| 79 NULL, | |
| 80 NULL, | |
| 81 "ModPlug Player", | |
| 82 Init, | |
| 83 ShowAboutBox, | |
| 84 ShowConfigureBox, | |
| 85 CanPlayFile, | |
| 86 NULL, | |
| 87 PlayFile, | |
| 88 Stop, | |
| 89 Pause, | |
| 90 Seek, | |
| 91 NULL, | |
| 92 GetTime, | |
| 93 NULL, | |
| 94 NULL, | |
| 95 NULL, | |
| 96 NULL, | |
| 97 NULL, | |
| 98 NULL, | |
| 99 NULL, | |
| 100 GetSongInfo, | |
| 101 ShowFileInfoBox, | |
| 102 NULL | |
| 103 }; | |
| 104 | |
| 105 extern "C" | |
| 106 { | |
| 107 InputPlugin* get_iplugin_info (void) | |
| 108 { | |
| 109 return &gModPlug; | |
| 110 } | |
| 111 } |
