Mercurial > audlegacy
annotate Plugins/Input/modplug/modplugbmp.cpp @ 553:82346a6312c2 trunk
[svn] make WMA plugin strings translatable
author | nenolod |
---|---|
date | Wed, 01 Feb 2006 13:09:00 -0800 |
parents | 7fa1738514d5 |
children | d539e5c5f730 |
rev | line source |
---|---|
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
1 /* Modplug XMMS Plugin |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
2 * Authors: Kenton Varda <temporal@gauge3d.org> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
3 * |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
4 * This source code is public domain. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
5 */ |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
6 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
7 #include <fstream> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
8 #include <unistd.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
9 #include <math.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
10 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
11 #include "modplugbmp.h" |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
12 #include <libmodplug/stdafx.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
13 #include <libmodplug/sndfile.h> |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
14 #include "stddefs.h" |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
15 #include "archive/open.h" |
330 | 16 #include "libaudacious/configdb.h" |
414
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
17 extern "C" { |
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
18 #include "audacious/output.h" |
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
19 } |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
20 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
21 // ModplugXMMS member functions =============================== |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
22 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
23 // operations ---------------------------------------- |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
24 ModplugXMMS::ModplugXMMS() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
25 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
26 mSoundFile = new CSoundFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
27 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
28 ModplugXMMS::~ModplugXMMS() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
29 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
30 delete mSoundFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
31 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
32 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
33 ModplugXMMS::Settings::Settings() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
34 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
35 mSurround = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
36 mOversamp = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
37 mReverb = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
38 mMegabass = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
39 mNoiseReduction = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
40 mVolumeRamp = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
41 mFastinfo = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
42 mUseFilename = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
43 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
44 mChannels = 2; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
45 mFrequency = 44100; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
46 mBits = 16; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
47 mResamplingMode = SRCMODE_POLYPHASE; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
48 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
49 mReverbDepth = 30; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
50 mReverbDelay = 100; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
51 mBassAmount = 40; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
52 mBassRange = 30; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
53 mSurroundDepth = 20; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
54 mSurroundDelay = 20; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
55 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
56 mPreamp = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
57 mPreampLevel = 0.0f; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
58 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
59 mLoopCount = 0; //don't loop |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
60 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
61 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
62 void ModplugXMMS::Init(void) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
63 { |
330 | 64 ConfigDb *db; |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
65 |
330 | 66 db = bmp_cfg_db_open(); |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
67 |
330 | 68 bmp_cfg_db_get_bool(db,"modplug","Surround", &mModProps.mSurround); |
69 bmp_cfg_db_get_bool(db,"modplug","Oversampling", &mModProps.mOversamp); | |
70 bmp_cfg_db_get_bool(db,"modplug","Megabass", &mModProps.mMegabass); | |
71 bmp_cfg_db_get_bool(db,"modplug","NoiseReduction", &mModProps.mNoiseReduction); | |
72 bmp_cfg_db_get_bool(db,"modplug","VolumeRamp", &mModProps.mVolumeRamp); | |
73 bmp_cfg_db_get_bool(db,"modplug","Reverb", &mModProps.mReverb); | |
74 bmp_cfg_db_get_bool(db,"modplug","FastInfo", &mModProps.mFastinfo); | |
75 bmp_cfg_db_get_bool(db,"modplug","UseFileName", &mModProps.mUseFilename); | |
76 bmp_cfg_db_get_bool(db,"modplug","PreAmp", &mModProps.mPreamp); | |
77 bmp_cfg_db_get_float(db,"modplug","PreAmpLevel", &mModProps.mPreampLevel); | |
78 bmp_cfg_db_get_int(db,"modplug", "Channels", &mModProps.mChannels); | |
79 bmp_cfg_db_get_int(db,"modplug", "Bits", &mModProps.mBits); | |
80 bmp_cfg_db_get_int(db,"modplug", "Frequency", &mModProps.mFrequency); | |
81 bmp_cfg_db_get_int(db,"modplug", "ResamplineMode", &mModProps.mResamplingMode); | |
82 bmp_cfg_db_get_int(db,"modplug", "ReverbDepth", &mModProps.mReverbDepth); | |
83 bmp_cfg_db_get_int(db,"modplug", "ReverbDelay", &mModProps.mReverbDelay); | |
84 bmp_cfg_db_get_int(db,"modplug", "BassAmount", &mModProps.mBassAmount); | |
85 bmp_cfg_db_get_int(db,"modplug", "BassRange", &mModProps.mBassRange); | |
86 bmp_cfg_db_get_int(db,"modplug", "SurroundDepth", &mModProps.mSurroundDepth); | |
87 bmp_cfg_db_get_int(db,"modplug", "SurroundDelay", &mModProps.mSurroundDelay); | |
88 bmp_cfg_db_get_int(db,"modplug", "LoopCount", &mModProps.mLoopCount); | |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
89 |
330 | 90 bmp_cfg_db_close(db); |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
91 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
92 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
93 bool ModplugXMMS::CanPlayFile(const string& aFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
94 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
95 string lExt; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
96 uint32 lPos; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
97 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
98 lPos = aFilename.find_last_of('.'); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
99 if((int)lPos == -1) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
100 return false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
101 lExt = aFilename.substr(lPos); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
102 for(uint32 i = 0; i < lExt.length(); i++) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
103 lExt[i] = tolower(lExt[i]); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
104 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
105 if (lExt == ".669") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
106 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
107 if (lExt == ".amf") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
108 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
109 if (lExt == ".ams") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
110 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
111 if (lExt == ".dbm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
112 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
113 if (lExt == ".dbf") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
114 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
115 if (lExt == ".dsm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
116 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
117 if (lExt == ".far") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
118 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
119 if (lExt == ".it") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
120 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
121 if (lExt == ".mdl") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
122 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
123 if (lExt == ".med") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
124 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
125 if (lExt == ".mod") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
126 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
127 if (lExt == ".mtm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
128 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
129 if (lExt == ".okt") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
130 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
131 if (lExt == ".ptm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
132 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
133 if (lExt == ".s3m") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
134 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
135 if (lExt == ".stm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
136 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
137 if (lExt == ".ult") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
138 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
139 if (lExt == ".umx") //Unreal rocks! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
140 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
141 if (lExt == ".xm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
142 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
143 if (lExt == ".j2b") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
144 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
145 if (lExt == ".mt2") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
146 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
147 if (lExt == ".psm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
148 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
149 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
150 if (lExt == ".mdz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
151 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
152 if (lExt == ".mdr") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
153 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
154 if (lExt == ".mdgz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
155 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
156 if (lExt == ".mdbz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
157 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
158 if (lExt == ".s3z") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
159 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
160 if (lExt == ".s3r") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
161 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
162 if (lExt == ".s3gz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
163 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
164 if (lExt == ".xmz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
165 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
166 if (lExt == ".xmr") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
167 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
168 if (lExt == ".xmgz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
169 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
170 if (lExt == ".itz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
171 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
172 if (lExt == ".itr") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
173 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
174 if (lExt == ".itgz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
175 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
176 if (lExt == ".dmf") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
177 return true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
178 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
179 if (lExt == ".zip") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
180 return ContainsMod(aFilename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
181 if (lExt == ".gz") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
182 return ContainsMod(aFilename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
183 if (lExt == ".bz2") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
184 return ContainsMod(aFilename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
185 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
186 return false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
187 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
188 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
189 void* ModplugXMMS::PlayThread(void* arg) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
190 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
191 ((ModplugXMMS*)arg)->PlayLoop(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
192 return NULL; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
193 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
194 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
195 void ModplugXMMS::PlayLoop() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
196 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
197 uint32 lLength; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
198 //the user might change the number of channels while playing. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
199 // we don't want this to take effect until we are done! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
200 uint8 lChannels = mModProps.mChannels; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
201 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
202 while(!mStopped) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
203 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
204 if(!(lLength = mSoundFile->Read( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
205 mBuffer, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
206 mBufSize))) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
207 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
208 //no more to play. Wait for output to finish and then stop. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
209 while((mOutPlug->buffer_playing()) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
210 && (!mStopped)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
211 usleep(10000); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
212 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
213 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
214 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
215 if(mModProps.mPreamp) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
216 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
217 //apply preamp |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
218 if(mModProps.mBits == 16) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
219 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
220 uint n = mBufSize >> 1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
221 for(uint i = 0; i < n; i++) { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
222 short old = ((short*)mBuffer)[i]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
223 ((short*)mBuffer)[i] *= mPreampFactor; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
224 // detect overflow and clip! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
225 if ((old & 0x8000) != |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
226 (((short*)mBuffer)[i] & 0x8000)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
227 ((short*)mBuffer)[i] = old | 0x7FFF; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
228 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
229 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
230 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
231 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
232 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
233 for(uint i = 0; i < mBufSize; i++) { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
234 uchar old = ((uchar*)mBuffer)[i]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
235 ((uchar*)mBuffer)[i] *= mPreampFactor; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
236 // detect overflow and clip! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
237 if ((old & 0x80) != |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
238 (((uchar*)mBuffer)[i] & 0x80)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
239 ((uchar*)mBuffer)[i] = old | 0x7F; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
240 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
241 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
242 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
243 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
244 if(mStopped) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
245 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
246 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
247 //wait for buffer space to free up. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
248 while(((mOutPlug->buffer_free() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
249 < (int)mBufSize)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
250 && (!mStopped)) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
251 usleep(10000); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
252 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
253 if(mStopped) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
254 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
255 |
414
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
256 produce_audio |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
257 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
258 mPlayed, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
259 mFormat, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
260 lChannels, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
261 mBufSize, |
414
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
262 mBuffer, |
7fa1738514d5
[svn] Convert all input plugins (except timidity & wav-sndfile) to produce_audio.
chainsaw
parents:
330
diff
changeset
|
263 NULL |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
264 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
265 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
266 mPlayed += mBufTime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
267 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
268 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
269 // mOutPlug->flush(0); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
270 mOutPlug->close_audio(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
271 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
272 //Unload the file |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
273 mSoundFile->Destroy(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
274 delete mArchive; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
275 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
276 if (mBuffer) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
277 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
278 delete [] mBuffer; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
279 mBuffer = NULL; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
280 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
281 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
282 mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
283 mStopped = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
284 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
285 g_thread_exit(NULL); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
286 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
287 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
288 void ModplugXMMS::PlayFile(const string& aFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
289 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
290 mStopped = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
291 mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
292 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
293 //open and mmap the file |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
294 mArchive = OpenArchive(aFilename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
295 if(mArchive->Size() == 0) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
296 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
297 delete mArchive; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
298 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
299 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
300 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
301 if (mBuffer) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
302 delete [] mBuffer; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
303 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
304 //find buftime to get approx. 512 samples/block |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
305 mBufTime = 512000 / mModProps.mFrequency + 1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
306 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
307 mBufSize = mBufTime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
308 mBufSize *= mModProps.mFrequency; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
309 mBufSize /= 1000; //milliseconds |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
310 mBufSize *= mModProps.mChannels; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
311 mBufSize *= mModProps.mBits / 8; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
312 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
313 mBuffer = new uchar[mBufSize]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
314 if(!mBuffer) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
315 return; //out of memory! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
316 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
317 CSoundFile::SetWaveConfig |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
318 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
319 mModProps.mFrequency, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
320 mModProps.mBits, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
321 mModProps.mChannels |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
322 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
323 CSoundFile::SetWaveConfigEx |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
324 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
325 mModProps.mSurround, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
326 !mModProps.mOversamp, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
327 mModProps.mReverb, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
328 true, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
329 mModProps.mMegabass, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
330 mModProps.mNoiseReduction, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
331 false |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
332 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
333 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
334 // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
335 if(mModProps.mReverb) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
336 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
337 CSoundFile::SetReverbParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
338 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
339 mModProps.mReverbDepth, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
340 mModProps.mReverbDelay |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
341 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
342 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
343 // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
344 if(mModProps.mMegabass) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
345 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
346 CSoundFile::SetXBassParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
347 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
348 mModProps.mBassAmount, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
349 mModProps.mBassRange |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
350 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
351 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
352 // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
353 if(mModProps.mSurround) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
354 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
355 CSoundFile::SetSurroundParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
356 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
357 mModProps.mSurroundDepth, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
358 mModProps.mSurroundDelay |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
359 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
360 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
361 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
362 mSoundFile->SetRepeatCount(mModProps.mLoopCount); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
363 mPreampFactor = exp(mModProps.mPreampLevel); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
364 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
365 mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
366 mStopped = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
367 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
368 mSoundFile->Create |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
369 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
370 (uchar*)mArchive->Map(), |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
371 mArchive->Size() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
372 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
373 mPlayed = 0; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
374 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
375 bool useFilename = mModProps.mUseFilename; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
376 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
377 if(!useFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
378 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
379 strncpy(mModName, mSoundFile->GetTitle(), 100); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
380 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
381 for(int i = 0; mModName[i] == ' ' || mModName[i] == 0; i++) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
382 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
383 if(mModName[i] == 0) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
384 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
385 useFilename = true; //mod name is blank -- use filename |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
386 break; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
387 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
388 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
389 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
390 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
391 if(useFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
392 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
393 strncpy(mModName, strrchr(aFilename.c_str(), '/') + 1, 100); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
394 char* ext = strrchr(mModName, '.'); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
395 if(ext) *ext = '\0'; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
396 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
397 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
398 mInPlug->set_info |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
399 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
400 mModName, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
401 mSoundFile->GetSongTime() * 1000, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
402 mSoundFile->GetNumChannels(), |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
403 mModProps.mFrequency / 1000, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
404 mModProps.mChannels |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
405 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
406 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
407 mStopped = mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
408 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
409 if(mModProps.mBits == 16) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
410 mFormat = FMT_S16_NE; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
411 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
412 mFormat = FMT_U8; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
413 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
414 mOutPlug->open_audio |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
415 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
416 mFormat, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
417 mModProps.mFrequency, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
418 mModProps.mChannels |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
419 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
420 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
421 mDecodeThread = g_thread_create( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
422 (GThreadFunc)PlayThread, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
423 this, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
424 TRUE, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
425 NULL |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
426 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
427 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
428 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
429 void ModplugXMMS::Stop(void) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
430 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
431 if(mStopped) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
432 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
433 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
434 mStopped = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
435 mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
436 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
437 g_thread_join(mDecodeThread); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
438 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
439 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
440 void ModplugXMMS::Pause(bool aPaused) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
441 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
442 if(aPaused) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
443 mPaused = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
444 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
445 mPaused = false; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
446 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
447 mOutPlug->pause(aPaused); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
448 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
449 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
450 void ModplugXMMS::Seek(float32 aTime) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
451 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
452 uint32 lMax; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
453 uint32 lMaxtime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
454 float32 lPostime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
455 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
456 if(aTime > (lMaxtime = mSoundFile->GetSongTime())) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
457 aTime = lMaxtime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
458 lMax = mSoundFile->GetMaxPosition(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
459 lPostime = float(lMax) / lMaxtime; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
460 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
461 mSoundFile->SetCurrentPos(int(aTime * lPostime)); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
462 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
463 mOutPlug->flush(int(aTime * 1000)); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
464 mPlayed = uint32(aTime * 1000); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
465 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
466 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
467 float32 ModplugXMMS::GetTime(void) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
468 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
469 if(mStopped) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
470 return -1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
471 return (float32)mOutPlug->output_time() / 1000; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
472 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
473 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
474 void ModplugXMMS::GetSongInfo(const string& aFilename, char*& aTitle, int32& aLength) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
475 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
476 aLength = -1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
477 fstream lTestFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
478 string lError; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
479 bool lDone; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
480 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
481 lTestFile.open(aFilename.c_str(), ios::in); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
482 if(!lTestFile) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
483 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
484 lError = "**no such file: "; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
485 lError += strrchr(aFilename.c_str(), '/') + 1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
486 aTitle = new char[lError.length() + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
487 strcpy(aTitle, lError.c_str()); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
488 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
489 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
490 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
491 lTestFile.close(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
492 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
493 if(mModProps.mFastinfo) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
494 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
495 if(mModProps.mUseFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
496 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
497 //Use filename as name |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
498 aTitle = new char[aFilename.length() + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
499 strcpy(aTitle, strrchr(aFilename.c_str(), '/') + 1); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
500 *strrchr(aTitle, '.') = '\0'; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
501 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
502 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
503 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
504 fstream lModFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
505 string lExt; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
506 uint32 lPos; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
507 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
508 lDone = true; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
509 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
510 // previously ios::nocreate was used (X Standard C++ Library) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
511 lModFile.open(aFilename.c_str(), ios::in); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
512 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
513 lPos = aFilename.find_last_of('.'); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
514 if((int)lPos == 0) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
515 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
516 lExt = aFilename.substr(lPos); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
517 for(uint32 i = 0; i < lExt.length(); i++) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
518 lExt[i] = tolower(lExt[i]); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
519 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
520 if (lExt == ".mod") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
521 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
522 lModFile.read(mModName, 20); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
523 mModName[20] = 0; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
524 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
525 else if (lExt == ".s3m") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
526 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
527 lModFile.read(mModName, 28); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
528 mModName[28] = 0; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
529 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
530 else if (lExt == ".xm") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
531 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
532 lModFile.seekg(17); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
533 lModFile.read(mModName, 20); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
534 mModName[20] = 0; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
535 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
536 else if (lExt == ".it") |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
537 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
538 lModFile.seekg(4); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
539 lModFile.read(mModName, 28); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
540 mModName[28] = 0; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
541 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
542 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
543 lDone = false; //fall back to slow info |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
544 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
545 lModFile.close(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
546 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
547 if(lDone) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
548 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
549 for(int i = 0; mModName[i] != 0; i++) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
550 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
551 if(mModName[i] != ' ') |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
552 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
553 aTitle = new char[strlen(mModName) + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
554 strcpy(aTitle, mModName); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
555 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
556 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
557 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
558 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
559 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
560 //mod name is blank. Use filename instead. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
561 aTitle = new char[aFilename.length() + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
562 strcpy(aTitle, strrchr(aFilename.c_str(), '/') + 1); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
563 *strrchr(aTitle, '.') = '\0'; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
564 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
565 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
566 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
567 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
568 Archive* lArchive; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
569 CSoundFile* lSoundFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
570 const char* lTitle; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
571 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
572 //open and mmap the file |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
573 lArchive = OpenArchive(aFilename); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
574 if(lArchive->Size() == 0) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
575 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
576 lError = "**bad mod file: "; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
577 lError += strrchr(aFilename.c_str(), '/') + 1; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
578 aTitle = new char[lError.length() + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
579 strcpy(aTitle, lError.c_str()); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
580 delete lArchive; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
581 return; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
582 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
583 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
584 lSoundFile = new CSoundFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
585 lSoundFile->Create((uchar*)lArchive->Map(), lArchive->Size()); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
586 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
587 if(!mModProps.mUseFilename) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
588 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
589 lTitle = lSoundFile->GetTitle(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
590 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
591 for(int i = 0; lTitle[i] != 0; i++) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
592 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
593 if(lTitle[i] != ' ') |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
594 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
595 aTitle = new char[strlen(lTitle) + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
596 strcpy(aTitle, lTitle); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
597 goto therest; //sorry |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
598 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
599 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
600 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
601 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
602 //mod name is blank, or user wants the filename to be used as the title. |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
603 aTitle = new char[aFilename.length() + 1]; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
604 strcpy(aTitle, strrchr(aFilename.c_str(), '/') + 1); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
605 *strrchr(aTitle, '.') = '\0'; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
606 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
607 therest: |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
608 aLength = lSoundFile->GetSongTime() * 1000; //It wants milliseconds!?! |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
609 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
610 //unload the file |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
611 lSoundFile->Destroy(); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
612 delete lSoundFile; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
613 delete lArchive; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
614 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
615 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
616 void ModplugXMMS::SetInputPlugin(InputPlugin& aInPlugin) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
617 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
618 mInPlug = &aInPlugin; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
619 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
620 void ModplugXMMS::SetOutputPlugin(OutputPlugin& aOutPlugin) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
621 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
622 mOutPlug = &aOutPlugin; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
623 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
624 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
625 const ModplugXMMS::Settings& ModplugXMMS::GetModProps() |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
626 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
627 return mModProps; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
628 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
629 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
630 const char* ModplugXMMS::Bool2OnOff(bool aValue) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
631 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
632 if(aValue) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
633 return "on"; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
634 else |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
635 return "off"; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
636 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
637 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
638 void ModplugXMMS::SetModProps(const Settings& aModProps) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
639 { |
330 | 640 ConfigDb *db; |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
641 mModProps = aModProps; |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
642 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
643 // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
644 if(mModProps.mReverb) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
645 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
646 CSoundFile::SetReverbParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
647 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
648 mModProps.mReverbDepth, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
649 mModProps.mReverbDelay |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
650 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
651 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
652 // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
653 if(mModProps.mMegabass) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
654 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
655 CSoundFile::SetXBassParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
656 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
657 mModProps.mBassAmount, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
658 mModProps.mBassRange |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
659 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
660 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
661 else //modplug seems to ignore the SetWaveConfigEx() setting for bass boost |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
662 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
663 CSoundFile::SetXBassParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
664 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
665 0, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
666 0 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
667 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
668 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
669 // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
670 if(mModProps.mSurround) |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
671 { |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
672 CSoundFile::SetSurroundParameters |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
673 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
674 mModProps.mSurroundDepth, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
675 mModProps.mSurroundDelay |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
676 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
677 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
678 CSoundFile::SetWaveConfigEx |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
679 ( |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
680 mModProps.mSurround, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
681 !mModProps.mOversamp, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
682 mModProps.mReverb, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
683 true, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
684 mModProps.mMegabass, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
685 mModProps.mNoiseReduction, |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
686 false |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
687 ); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
688 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
689 mPreampFactor = exp(mModProps.mPreampLevel); |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
690 |
330 | 691 db = bmp_cfg_db_open(); |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
692 |
330 | 693 bmp_cfg_db_set_bool(db,"modplug","Surround", mModProps.mSurround); |
694 bmp_cfg_db_set_bool(db,"modplug","Oversampling", mModProps.mOversamp); | |
695 bmp_cfg_db_set_bool(db,"modplug","Megabass", mModProps.mMegabass); | |
696 bmp_cfg_db_set_bool(db,"modplug","NoiseReduction", mModProps.mNoiseReduction); | |
697 bmp_cfg_db_set_bool(db,"modplug","VolumeRamp", mModProps.mVolumeRamp); | |
698 bmp_cfg_db_set_bool(db,"modplug","Reverb", mModProps.mReverb); | |
699 bmp_cfg_db_set_bool(db,"modplug","FastInfo", mModProps.mFastinfo); | |
700 bmp_cfg_db_set_bool(db,"modplug","UseFileName", mModProps.mUseFilename); | |
701 bmp_cfg_db_set_bool(db,"modplug","PreAmp", mModProps.mPreamp); | |
702 bmp_cfg_db_set_float(db,"modplug","PreAmpLevel", mModProps.mPreampLevel); | |
703 bmp_cfg_db_set_int(db,"modplug", "Channels", mModProps.mChannels); | |
704 bmp_cfg_db_set_int(db,"modplug", "Bits", mModProps.mBits); | |
705 bmp_cfg_db_set_int(db,"modplug", "Frequency", mModProps.mFrequency); | |
706 bmp_cfg_db_set_int(db,"modplug", "ResamplineMode", mModProps.mResamplingMode); | |
707 bmp_cfg_db_set_int(db,"modplug", "ReverbDepth", mModProps.mReverbDepth); | |
708 bmp_cfg_db_set_int(db,"modplug", "ReverbDelay", mModProps.mReverbDelay); | |
709 bmp_cfg_db_set_int(db,"modplug", "BassAmount", mModProps.mBassAmount); | |
710 bmp_cfg_db_set_int(db,"modplug", "BassRange", mModProps.mBassRange); | |
711 bmp_cfg_db_set_int(db,"modplug", "SurroundDepth", mModProps.mSurroundDepth); | |
712 bmp_cfg_db_set_int(db,"modplug", "SurroundDelay", mModProps.mSurroundDelay); | |
713 bmp_cfg_db_set_int(db,"modplug", "LoopCount", mModProps.mLoopCount); | |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
714 |
330 | 715 bmp_cfg_db_close(db); |
278
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
716 } |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
717 |
37316876ef6e
[svn] Use modplug instead of mikmod. Supports more formats & compressed files.
chainsaw
parents:
diff
changeset
|
718 ModplugXMMS gModplugXMMS; |