comparison Plugins/Input/modplug/plugin.cpp @ 278:37316876ef6e trunk

[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
author chainsaw
date Sat, 10 Dec 2005 14:31:13 -0800
parents
children 9466f03c92f8
comparison
equal deleted inserted replaced
277:0cf2cc6d0fe5 278:37316876ef6e
1 /* Modplug XMMS Plugin
2 * Authors: Kenton Varda <temporal@gauge3d.org>
3 *
4 * This source code is public domain.
5 */
6
7 #include "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 }