comparison src/Input/modplug/modplugbmp.h @ 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 #ifndef __MODPLUGXMMS_CMODPLUGXMMS_H_INCLUDED__
8 #define __MODPLUGXMMS_CMODPLUGXMMS_H_INCLUDED__
9
10 #include <string>
11 #include <glib.h>
12
13 #ifndef __MODPLUGXMMS_STDDEFS_H__INCLUDED__
14 #include "stddefs.h"
15 #endif
16
17 #include "audacious/plugin.h"
18
19 /* Module files have their magic deep inside the file, at offset 1080; source: http://www.onicos.com/staff/iz/formats/mod.html and information by Michael Doering from UADE */
20 #define MOD_MAGIC_PROTRACKER4 (unsigned char [4]) { 0x4D, 0x2E, 0x4B, 0x2E } // "M.K." - Protracker 4 channel
21 #define MOD_MAGIC_PROTRACKER4X (unsigned char [4]) { 0x4D, 0x21, 0x4B, 0x21 } // "M!K!" - Protracker 4 channel
22 #define MOD_MAGIC_NOISETRACKER (unsigned char [4]) { 0x4D, 0x26, 0x4B, 0x21 } // "M&K!" - Noisetracker 1.3 by Kaktus & Mahoney
23 #define MOD_MAGIC_STARTRACKER4 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x34 } // "FLT4" - Startracker 4 channel (Startrekker/AudioSculpture)
24 #define MOD_MAGIC_STARTRACKER8 (unsigned char [4]) { 0x46, 0x4C, 0x54, 0x38 } // "FLT8" - Startracker 8 channel (Startrekker/AudioSculpture)
25 #define MOD_MAGIC_STARTRACKER4X (unsigned char [4]) { 0x45, 0x58, 0x30, 0x34 } // "EX04" - Startracker 4 channel (Startrekker/AudioSculpture)
26 #define MOD_MAGIC_STARTRACKER8X (unsigned char [4]) { 0x45, 0x58, 0x30, 0x38 } // "EX08" - Startracker 8 channel (Startrekker/AudioSculpture)
27 #define MOD_MAGIC_FASTTRACKER4 (unsigned char [4]) { 0x34, 0x43, 0x48, 0x4E } // "4CHN" - Fasttracker 4 channel
28 #define MOD_MAGIC_FASTTRACKER6 (unsigned char [4]) { 0x36, 0x43, 0x48, 0x4E } // "6CHN" - Fasttracker 6 channel
29 #define MOD_MAGIC_FASTTRACKER8 (unsigned char [4]) { 0x38, 0x43, 0x48, 0x4E } // "8CHN" - Fasttracker 8 channel
30 #define MOD_MAGIC_OKTALYZER8 (unsigned char [4]) { 0x43, 0x44, 0x38, 0x31 } // "CD81" - Atari oktalyzer 8 channel
31 #define MOD_MAGIC_OKTALYZER8X (unsigned char [4]) { 0x4F, 0x4B, 0x54, 0x41 } // "OKTA" - Atari oktalyzer 8 channel
32 #define MOD_MAGIC_TAKETRACKER16 (unsigned char [4]) { 0x31, 0x36, 0x43, 0x4E } // "16CN" - Taketracker 16 channel
33 #define MOD_MAGIC_TAKETRACKER32 (unsigned char [4]) { 0x33, 0x32, 0x43, 0x4E } // "32CN" - Taketracker 32 channel
34
35 #define S3M_MAGIC (unsigned char [4]) { 0x53, 0x43, 0x52, 0x4D } /* This is the SCRM string at offset 44 to 47 in the S3M header */
36
37 /* These nicer formats have the magic bytes at the front of the file where they belong */
38 #define UMX_MAGIC (unsigned char [4]) { 0xC1, 0x83, 0x2A, 0x9E }
39 #define XM_MAGIC (unsigned char [4]) { 0x45, 0x78, 0x74, 0x65 } /* Exte(nded Module) */
40 #define M669_MAGIC (unsigned char [4]) { 0x69, 0x66, 0x20, 0x20 }
41 #define IT_MAGIC (unsigned char [4]) { 0x49, 0x4D, 0x50, 0x4D } /* IMPM */
42 #define MTM_MAGIC (unsigned char [4]) { 0x4D, 0x54, 0x4D, 0x10 }
43 #define PSM_MAGIC (unsigned char [4]) { 0x50, 0x53, 0x4D, 0x20 }
44
45 using namespace std;
46
47 class CSoundFile;
48 class Archive;
49
50 class ModplugXMMS
51 {
52 public:
53 struct Settings
54 {
55 gboolean mSurround;
56 gboolean mOversamp;
57 gboolean mMegabass;
58 gboolean mNoiseReduction;
59 gboolean mVolumeRamp;
60 gboolean mReverb;
61 gboolean mFastinfo;
62 gboolean mUseFilename;
63 gboolean mGrabAmigaMOD;
64 gboolean mPreamp;
65
66 gint mChannels;
67 gint mBits;
68 gint mFrequency;
69 gint mResamplingMode;
70
71 gint mReverbDepth;
72 gint mReverbDelay;
73 gint mBassAmount;
74 gint mBassRange;
75 gint mSurroundDepth;
76 gint mSurroundDelay;
77 gfloat mPreampLevel;
78 gint mLoopCount;
79
80 Settings();
81 };
82
83 ModplugXMMS();
84 ~ModplugXMMS();
85
86 void Init(); // Called when the plugin is loaded
87 bool CanPlayFile(const string& aFilename);// Return true if the plugin can handle the file
88
89 void CloseConfigureBox();
90
91 void PlayFile(const string& aFilename);// Play the file.
92 void Stop(); // Stop playing.
93 void Pause(bool aPaused); // Pause or unpause.
94
95 void Seek(float32 aTime); // Seek to the specified time.
96 float32 GetTime(); // Get the current play time.
97
98 void GetSongInfo(const string& aFilename, char*& aTitle, int32& aLength); // Function to grab the title string
99
100 void SetInputPlugin(InputPlugin& aInPlugin);
101 void SetOutputPlugin(OutputPlugin& aOutPlugin);
102
103 const Settings& GetModProps();
104 void SetModProps(const Settings& aModProps);
105
106 private:
107 InputPlugin* mInPlug;
108 OutputPlugin* mOutPlug;
109
110 uchar* mBuffer;
111 uint32 mBufSize;
112
113 bool mPaused;
114 volatile bool mStopped;
115
116 Settings mModProps;
117
118 AFormat mFormat;
119
120 uint32 mBufTime; //milliseconds
121
122 CSoundFile* mSoundFile;
123 Archive* mArchive;
124
125 uint32 mPlayed;
126
127 GThread* mDecodeThread;
128
129 char mModName[100];
130
131 float mPreampFactor;
132
133 void PlayLoop();
134 static void* PlayThread(void* arg);
135 const char* Bool2OnOff(bool aValue);
136 };
137
138 extern ModplugXMMS gModplugXMMS;
139
140 #endif //included