Mercurial > audlegacy-plugins
annotate src/modplug/modplugbmp.cxx @ 2499:4d6045c20cc5
Include cleanups, part #4.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 31 Mar 2008 15:18:05 +0300 |
parents | e67bce91d70c |
children | 7b284f323ad8 |
rev | line source |
---|---|
2456
e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2388
diff
changeset
|
1 #define AUD_DEBUG 1 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 /* Modplug XMMS Plugin |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * Authors: Kenton Varda <temporal@gauge3d.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 * This source code is public domain. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 #include <fstream> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 #include <unistd.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 #include <math.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 #include "modplugbmp.h" |
161 | 13 #include "stdafx.h" |
14 #include "sndfile.h" | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 #include "stddefs.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 #include "archive/open.h" |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
17 extern "C" { |
1946
7ee1bc4d5f5b
Remove useless #includes, use <>
Matti Hamalainen <ccr@tnsp.org>
parents:
1933
diff
changeset
|
18 #include <audacious/configdb.h> |
7ee1bc4d5f5b
Remove useless #includes, use <>
Matti Hamalainen <ccr@tnsp.org>
parents:
1933
diff
changeset
|
19 #include <audacious/output.h> |
7ee1bc4d5f5b
Remove useless #includes, use <>
Matti Hamalainen <ccr@tnsp.org>
parents:
1933
diff
changeset
|
20 #include <audacious/strings.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
23 static char* format_and_free_ti( Tuple* ti, int* length ) |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
24 { |
2055 | 25 char* result = aud_tuple_formatter_make_title_string(ti, aud_get_gentitle_format()); |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
26 if ( result ) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
27 *length = aud_tuple_get_int(ti, FIELD_LENGTH, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
28 aud_tuple_free((void *) ti); |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
29 |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
30 return result; |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
31 } |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
32 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 // ModplugXMMS member functions =============================== |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 // operations ---------------------------------------- |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 ModplugXMMS::ModplugXMMS() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 mSoundFile = new CSoundFile; |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
39 mOutPlug = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 ModplugXMMS::~ModplugXMMS() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 delete mSoundFile; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 ModplugXMMS::Settings::Settings() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 mSurround = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 mOversamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 mReverb = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 mMegabass = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 mNoiseReduction = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 mVolumeRamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 mFastinfo = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 mUseFilename = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 mGrabAmigaMOD = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 mChannels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 mFrequency = 44100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 mBits = 16; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 mResamplingMode = SRCMODE_POLYPHASE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 mReverbDepth = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 mReverbDelay = 100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 mBassAmount = 40; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 mBassRange = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 mSurroundDepth = 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 mSurroundDelay = 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 mPreamp = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 mPreampLevel = 0.0f; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 mLoopCount = 0; //don't loop |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 void ModplugXMMS::Init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 |
2118 | 80 db = aud_cfg_db_open(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 |
2119
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
82 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"Surround", &mModProps.mSurround); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
83 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"Oversampling", &mModProps.mOversamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
84 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"Megabass", &mModProps.mMegabass); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
85 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"NoiseReduction", &mModProps.mNoiseReduction); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
86 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"VolumeRamp", &mModProps.mVolumeRamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
87 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"Reverb", &mModProps.mReverb); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
88 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"FastInfo", &mModProps.mFastinfo); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
89 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"UseFileName", &mModProps.mUseFilename); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
90 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"GrabAmigaMOD", &mModProps.mGrabAmigaMOD); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
91 aud_cfg_db_get_bool(db, MODPLUG_CFGID,"PreAmp", &mModProps.mPreamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
92 aud_cfg_db_get_float(db, MODPLUG_CFGID,"PreAmpLevel", &mModProps.mPreampLevel); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
93 aud_cfg_db_get_int(db, MODPLUG_CFGID, "Channels", &mModProps.mChannels); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
94 aud_cfg_db_get_int(db, MODPLUG_CFGID, "Bits", &mModProps.mBits); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
95 aud_cfg_db_get_int(db, MODPLUG_CFGID, "Frequency", &mModProps.mFrequency); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
96 aud_cfg_db_get_int(db, MODPLUG_CFGID, "ResamplineMode", &mModProps.mResamplingMode); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
97 aud_cfg_db_get_int(db, MODPLUG_CFGID, "ReverbDepth", &mModProps.mReverbDepth); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
98 aud_cfg_db_get_int(db, MODPLUG_CFGID, "ReverbDelay", &mModProps.mReverbDelay); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
99 aud_cfg_db_get_int(db, MODPLUG_CFGID, "BassAmount", &mModProps.mBassAmount); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
100 aud_cfg_db_get_int(db, MODPLUG_CFGID, "BassRange", &mModProps.mBassRange); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
101 aud_cfg_db_get_int(db, MODPLUG_CFGID, "SurroundDepth", &mModProps.mSurroundDepth); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
102 aud_cfg_db_get_int(db, MODPLUG_CFGID, "SurroundDelay", &mModProps.mSurroundDelay); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
103 aud_cfg_db_get_int(db, MODPLUG_CFGID, "LoopCount", &mModProps.mLoopCount); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 |
2118 | 105 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
108 bool ModplugXMMS::CanPlayFileFromVFS(const string& aFilename, VFSFile *file) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 string lExt; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 uint32 lPos; |
1599
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
112 const int magicSize = 32; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
113 char magic[magicSize]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 |
1978 | 115 aud_vfs_fread(magic, 1, magicSize, file); |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
116 if (!memcmp(magic, UMX_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
117 return true; |
1599
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
118 if (!memcmp(magic, "Extended Module:", 16)) |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
119 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
120 if (!memcmp(magic, M669_MAGIC, 2)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
121 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
122 if (!memcmp(magic, IT_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
123 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
124 if (!memcmp(magic, MTM_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
125 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
126 if (!memcmp(magic, PSM_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
127 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
128 |
1978 | 129 aud_vfs_fseek(file, 44, SEEK_SET); |
130 aud_vfs_fread(magic, 1, 4, file); | |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
131 if (!memcmp(magic, S3M_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
132 return true; |
1599
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
133 |
1978 | 134 aud_vfs_fseek(file, 1080, SEEK_SET); |
135 aud_vfs_fread(magic, 1, 4, file); | |
1599
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
136 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
137 // Check for Fast Tracker multichannel modules (xCHN, xxCH) |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
138 if (magic[1] == 'C' && magic[2] == 'H' && magic[3] == 'N') { |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
139 if (magic[0] == '6' || magic[0] == '8') |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
140 return true; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
141 } |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
142 if (magic[2] == 'C' && magic[3] == 'H' && isdigit(magic[0]) && isdigit(magic[1])) { |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
143 int nch = (magic[0] - '0') * 10 + (magic[1] - '0'); |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
144 if ((nch % 2 == 0) && nch >= 10) |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
145 return true; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
146 } |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
147 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
148 // Check for Amiga MOD module formats |
82
db47d5ac8f43
[svn] Always grab FT8 files, they're NOT Amiga MODs. (They are software mixed
js
parents:
12
diff
changeset
|
149 if(mModProps.mGrabAmigaMOD) { |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
150 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
151 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
152 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
153 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
154 if (!memcmp(magic, MOD_MAGIC_NOISETRACKER, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
155 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
156 if (!memcmp(magic, MOD_MAGIC_STARTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
157 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
158 if (!memcmp(magic, MOD_MAGIC_STARTRACKER8, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
159 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
160 if (!memcmp(magic, MOD_MAGIC_STARTRACKER4X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
161 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
162 if (!memcmp(magic, MOD_MAGIC_STARTRACKER8X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
163 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
164 if (!memcmp(magic, MOD_MAGIC_FASTTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
165 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
166 if (!memcmp(magic, MOD_MAGIC_OKTALYZER8, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
167 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
168 if (!memcmp(magic, MOD_MAGIC_OKTALYZER8X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
169 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
170 if (!memcmp(magic, MOD_MAGIC_TAKETRACKER16, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
171 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
172 if (!memcmp(magic, MOD_MAGIC_TAKETRACKER32, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
173 return true; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 } /* end of if(mModProps.mGrabAmigaMOD) */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 /* We didn't find the magic bytes, fall back to extension check */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 lPos = aFilename.find_last_of('.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 if((int)lPos == -1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 return false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 lExt = aFilename.substr(lPos); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 for(uint32 i = 0; i < lExt.length(); i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 lExt[i] = tolower(lExt[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 if (lExt == ".amf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 if (lExt == ".ams") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 if (lExt == ".dbm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 if (lExt == ".dbf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 if (lExt == ".dsm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 if (lExt == ".far") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 if (lExt == ".mdl") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 if (lExt == ".stm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 if (lExt == ".ult") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 if (lExt == ".j2b") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 if (lExt == ".mt2") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 if (lExt == ".mdz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 if (lExt == ".mdr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 if (lExt == ".mdgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 if (lExt == ".mdbz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 if (lExt == ".s3z") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 if (lExt == ".s3r") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 if (lExt == ".s3gz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 if (lExt == ".xmz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 if (lExt == ".xmr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 if (lExt == ".xmgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 if (lExt == ".itz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 if (lExt == ".itr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 if (lExt == ".itgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 if (lExt == ".dmf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 if (lExt == ".zip") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 if (lExt == ".gz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 if (lExt == ".bz2") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 return ContainsMod(aFilename); |
2456
e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2388
diff
changeset
|
242 if (lExt == ".rar") |
e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2388
diff
changeset
|
243 return ContainsMod(aFilename); |
e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2388
diff
changeset
|
244 if (lExt == ".rb") |
e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2388
diff
changeset
|
245 return ContainsMod(aFilename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 return false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
250 void ModplugXMMS::PlayLoop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 uint32 lLength; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 //the user might change the number of channels while playing. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 // we don't want this to take effect until we are done! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 uint8 lChannels = mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 while(!mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 if(!(lLength = mSoundFile->Read( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 mBufSize))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 //no more to play. Wait for output to finish and then stop. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 while((mOutPlug->buffer_playing()) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 if(mModProps.mPreamp) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 //apply preamp |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 uint n = mBufSize >> 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 for(uint i = 0; i < n; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 short old = ((short*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 ((short*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 if ((old & 0x8000) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 (((short*)mBuffer)[i] & 0x8000)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 ((short*)mBuffer)[i] = old | 0x7FFF; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 for(uint i = 0; i < mBufSize; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 uchar old = ((uchar*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 ((uchar*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 if ((old & 0x80) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 (((uchar*)mBuffer)[i] & 0x80)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 ((uchar*)mBuffer)[i] = old | 0x7F; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 //wait for buffer space to free up. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 while(((mOutPlug->buffer_free() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 < (int)mBufSize)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
311 playback->pass_audio |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 ( |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
313 playback, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 lChannels, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 mBufSize, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 NULL |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 mPlayed += mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 // mOutPlug->flush(0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 mOutPlug->close_audio(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 //Unload the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 mSoundFile->Destroy(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 delete mArchive; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 if (mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 delete [] mBuffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 mBuffer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1351
diff
changeset
|
341 void ModplugXMMS::PlayFile(const string& aFilename, InputPlayback *ipb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 { |
2316 | 343 int32 aLength=0; |
344 char *aModName=NULL; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 //open and mmap the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 mArchive = OpenArchive(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 if(mArchive->Size() == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 delete mArchive; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 if (mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 delete [] mBuffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 //find buftime to get approx. 512 samples/block |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 mBufTime = 512000 / mModProps.mFrequency + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 mBufSize = mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 mBufSize *= mModProps.mFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 mBufSize /= 1000; //milliseconds |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 mBufSize *= mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 mBufSize *= mModProps.mBits / 8; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 mBuffer = new uchar[mBufSize]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 if(!mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 return; //out of memory! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 CSoundFile::SetWaveConfig |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 mModProps.mBits, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 if(mModProps.mReverb) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 CSoundFile::SetReverbParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 if(mModProps.mMegabass) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 CSoundFile::SetXBassParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 mModProps.mBassRange |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 if(mModProps.mSurround) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 CSoundFile::SetSurroundParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 mModProps.mSurroundDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 mSoundFile->SetRepeatCount(mModProps.mLoopCount); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 mPreampFactor = exp(mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 mStopped = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 mSoundFile->Create |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 (uchar*)mArchive->Map(), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 mArchive->Size() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 mPlayed = 0; |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
429 |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
430 Tuple* ti = GetSongTuple( aFilename ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
431 if ( ti ) |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
432 aModName = format_and_free_ti( ti, &aLength ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
433 |
1986 | 434 ipb->set_params |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 ( |
1986 | 436 ipb, |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
437 aModName, |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
438 aLength, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 mSoundFile->GetNumChannels() * 1000, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 mStopped = mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 mFormat = FMT_S16_NE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 mFormat = FMT_U8; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 mOutPlug->open_audio |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 |
1351
833a7d4ea063
modplug: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
704
diff
changeset
|
458 mDecodeThread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1351
diff
changeset
|
459 ipb->set_pb_ready(ipb); |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
460 this->PlayLoop(ipb); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 void ModplugXMMS::Stop(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 g_thread_join(mDecodeThread); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 void ModplugXMMS::Pause(bool aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 if(aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 mPaused = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 mOutPlug->pause(aPaused); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 void ModplugXMMS::Seek(float32 aTime) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 uint32 lMax; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 uint32 lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 float32 lPostime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 if(aTime > (lMaxtime = mSoundFile->GetSongTime())) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 aTime = lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 lMax = mSoundFile->GetMaxPosition(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 lPostime = float(lMax) / lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 mSoundFile->SetCurrentPos(int(aTime * lPostime)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 mOutPlug->flush(int(aTime * 1000)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 mPlayed = uint32(aTime * 1000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 float32 ModplugXMMS::GetTime(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 { |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
503 if ((mStopped) || (!mOutPlug)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 return (float32)mOutPlug->output_time() / 1000; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
508 Tuple* ModplugXMMS::GetSongTuple(const string& aFilename) |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
509 { |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
510 CSoundFile* lSoundFile; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
511 Archive* lArchive; |
2121
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
512 const gchar *tmps; |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
513 |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
514 //open and mmap the file |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
515 lArchive = OpenArchive(aFilename); |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
516 if(lArchive->Size() == 0) |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
517 { |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
518 delete lArchive; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
519 return NULL; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
520 } |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
521 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
522 Tuple *ti = aud_tuple_new_from_filename(aFilename.c_str()); |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
523 lSoundFile = new CSoundFile; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
524 lSoundFile->Create((uchar*)lArchive->Map(), lArchive->Size()); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
525 |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
526 switch(lSoundFile->GetType()) |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
527 { |
1931
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
528 case MOD_TYPE_MOD: tmps = "ProTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
529 case MOD_TYPE_S3M: tmps = "Scream Tracker 3"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
530 case MOD_TYPE_XM: tmps = "Fast Tracker 2"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
531 case MOD_TYPE_IT: tmps = "Impulse Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
532 case MOD_TYPE_MED: tmps = "OctaMed"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
533 case MOD_TYPE_MTM: tmps = "MultiTracker Module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
534 case MOD_TYPE_669: tmps = "669 Composer / UNIS 669"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
535 case MOD_TYPE_ULT: tmps = "Ultra Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
536 case MOD_TYPE_STM: tmps = "Scream Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
537 case MOD_TYPE_FAR: tmps = "Farandole"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
538 case MOD_TYPE_AMF: tmps = "ASYLUM Music Format"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
539 case MOD_TYPE_AMS: tmps = "AMS module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
540 case MOD_TYPE_DSM: tmps = "DSIK Internal Format"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
541 case MOD_TYPE_MDL: tmps = "DigiTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
542 case MOD_TYPE_OKT: tmps = "Oktalyzer"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
543 case MOD_TYPE_DMF: tmps = "Delusion Digital Music Fileformat (X-Tracker)"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
544 case MOD_TYPE_PTM: tmps = "PolyTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
545 case MOD_TYPE_DBM: tmps = "DigiBooster Pro"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
546 case MOD_TYPE_MT2: tmps = "MadTracker 2"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
547 case MOD_TYPE_AMF0: tmps = "AMF0"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
548 case MOD_TYPE_PSM: tmps = "Protracker Studio Module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
549 default: tmps = "ModPlug unknown"; break; |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
550 } |
2121
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
551 aud_tuple_associate_string(ti, FIELD_CODEC, NULL, tmps); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
552 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced"); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
553 aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, lSoundFile->GetSongTime() * 1000); |
2121
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
554 |
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
555 gchar *tmps2 = MODPLUG_CONVERT(lSoundFile->GetTitle()); |
2388
2fe51f6ddb36
Trim whitespace on front of mod titles. (Bugzilla #175)
BioHazard <biohazard@bak.rr.com>
parents:
2316
diff
changeset
|
556 // Chop any leading spaces off. They are annoying in the playlist. |
2fe51f6ddb36
Trim whitespace on front of mod titles. (Bugzilla #175)
BioHazard <biohazard@bak.rr.com>
parents:
2316
diff
changeset
|
557 gchar *tmps3 = tmps2; // Make another pointer so tmps2 can still be free()d |
2fe51f6ddb36
Trim whitespace on front of mod titles. (Bugzilla #175)
BioHazard <biohazard@bak.rr.com>
parents:
2316
diff
changeset
|
558 while ( *tmps3 == ' ' ) tmps3++ ; |
2fe51f6ddb36
Trim whitespace on front of mod titles. (Bugzilla #175)
BioHazard <biohazard@bak.rr.com>
parents:
2316
diff
changeset
|
559 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, tmps3); |
1932
5638651b7b3d
Fixed warnings and one UTF-8 conversion.
Matti Hamalainen <ccr@tnsp.org>
parents:
1688
diff
changeset
|
560 g_free(tmps2); |
1601
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
561 |
1539
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
562 //unload the file |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
563 lSoundFile->Destroy(); |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
564 delete lSoundFile; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
565 delete lArchive; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
566 return ti; |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
567 } |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
568 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 void ModplugXMMS::SetInputPlugin(InputPlugin& aInPlugin) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 mInPlug = &aInPlugin; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 void ModplugXMMS::SetOutputPlugin(OutputPlugin& aOutPlugin) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 mOutPlug = &aOutPlugin; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 const ModplugXMMS::Settings& ModplugXMMS::GetModProps() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 return mModProps; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 const char* ModplugXMMS::Bool2OnOff(bool aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 if(aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 return "on"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 return "off"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 void ModplugXMMS::SetModProps(const Settings& aModProps) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 mModProps = aModProps; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 if(mModProps.mReverb) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 CSoundFile::SetReverbParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 if(mModProps.mMegabass) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 CSoundFile::SetXBassParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 mModProps.mBassRange |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 else //modplug seems to ignore the SetWaveConfigEx() setting for bass boost |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 CSoundFile::SetXBassParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 0, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 if(mModProps.mSurround) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 CSoundFile::SetSurroundParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 mModProps.mSurroundDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 mPreampFactor = exp(mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 |
2118 | 644 db = aud_cfg_db_open(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 |
2119
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
646 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"Surround", mModProps.mSurround); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
647 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"Oversampling", mModProps.mOversamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
648 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"Megabass", mModProps.mMegabass); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
649 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"NoiseReduction", mModProps.mNoiseReduction); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
650 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"VolumeRamp", mModProps.mVolumeRamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
651 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"Reverb", mModProps.mReverb); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
652 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"FastInfo", mModProps.mFastinfo); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
653 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"UseFileName", mModProps.mUseFilename); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
654 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"GrabAmigaMOD", mModProps.mGrabAmigaMOD); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
655 aud_cfg_db_set_bool(db, MODPLUG_CFGID,"PreAmp", mModProps.mPreamp); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
656 aud_cfg_db_set_float(db, MODPLUG_CFGID,"PreAmpLevel", mModProps.mPreampLevel); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
657 aud_cfg_db_set_int(db, MODPLUG_CFGID, "Channels", mModProps.mChannels); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
658 aud_cfg_db_set_int(db, MODPLUG_CFGID, "Bits", mModProps.mBits); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
659 aud_cfg_db_set_int(db, MODPLUG_CFGID, "Frequency", mModProps.mFrequency); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
660 aud_cfg_db_set_int(db, MODPLUG_CFGID, "ResamplineMode", mModProps.mResamplingMode); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
661 aud_cfg_db_set_int(db, MODPLUG_CFGID, "ReverbDepth", mModProps.mReverbDepth); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
662 aud_cfg_db_set_int(db, MODPLUG_CFGID, "ReverbDelay", mModProps.mReverbDelay); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
663 aud_cfg_db_set_int(db, MODPLUG_CFGID, "BassAmount", mModProps.mBassAmount); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
664 aud_cfg_db_set_int(db, MODPLUG_CFGID, "BassRange", mModProps.mBassRange); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
665 aud_cfg_db_set_int(db, MODPLUG_CFGID, "SurroundDepth", mModProps.mSurroundDepth); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
666 aud_cfg_db_set_int(db, MODPLUG_CFGID, "SurroundDelay", mModProps.mSurroundDelay); |
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
667 aud_cfg_db_set_int(db, MODPLUG_CFGID, "LoopCount", mModProps.mLoopCount); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 |
2118 | 669 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 ModplugXMMS gModplugXMMS; |