Mercurial > audlegacy-plugins
annotate src/modplug/modplugbmp.cxx @ 3047:4434b4c4a715
ported EsounD plugin
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Fri, 17 Apr 2009 16:17:10 +0300 |
parents | 3134a0987162 |
children |
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" { |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2576
diff
changeset
|
18 #include <audlegacy/output.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
21 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
|
22 { |
2055 | 23 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
|
24 if ( result ) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
25 *length = aud_tuple_get_int(ti, FIELD_LENGTH, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
26 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
|
27 |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
28 return result; |
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 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 // ModplugXMMS member functions =============================== |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 // operations ---------------------------------------- |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 ModplugXMMS::ModplugXMMS() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 mSoundFile = new CSoundFile; |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
37 mOutPlug = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 ModplugXMMS::~ModplugXMMS() |
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 delete mSoundFile; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 ModplugXMMS::Settings::Settings() |
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 mSurround = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 mOversamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 mReverb = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 mMegabass = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 mNoiseReduction = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 mVolumeRamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 mFastinfo = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 mUseFilename = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 mGrabAmigaMOD = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 mChannels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 mFrequency = 44100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 mBits = 16; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 mResamplingMode = SRCMODE_POLYPHASE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 mReverbDepth = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 mReverbDelay = 100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 mBassAmount = 40; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 mBassRange = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 mSurroundDepth = 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 mSurroundDelay = 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 mPreamp = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 mPreampLevel = 0.0f; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 mLoopCount = 0; //don't loop |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 void ModplugXMMS::Init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2501
diff
changeset
|
76 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 |
2118 | 78 db = aud_cfg_db_open(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 |
2119
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
2118 | 103 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
106 bool ModplugXMMS::CanPlayFileFromVFS(const string& aFilename, VFSFile *file) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 string lExt; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 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
|
110 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
|
111 char magic[magicSize]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 |
1978 | 113 aud_vfs_fread(magic, 1, magicSize, file); |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
114 if (!memcmp(magic, UMX_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
115 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
|
116 if (!memcmp(magic, "Extended Module:", 16)) |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
117 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
118 if (!memcmp(magic, M669_MAGIC, 2)) |
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, IT_MAGIC, 4)) |
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, MTM_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, PSM_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 |
1978 | 127 aud_vfs_fseek(file, 44, SEEK_SET); |
128 aud_vfs_fread(magic, 1, 4, file); | |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
129 if (!memcmp(magic, S3M_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
130 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
|
131 |
1978 | 132 aud_vfs_fseek(file, 1080, SEEK_SET); |
133 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
|
134 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
135 // 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
|
136 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
|
137 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
|
138 return true; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
139 } |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 return true; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
144 } |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
145 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
146 // 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
|
147 if(mModProps.mGrabAmigaMOD) { |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
148 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
149 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
150 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4X, 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_NOISETRACKER, 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_STARTRACKER4, 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_STARTRACKER8, 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_STARTRACKER4X, 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_STARTRACKER8X, 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_FASTTRACKER4, 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_OKTALYZER8, 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_OKTALYZER8X, 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_TAKETRACKER16, 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_TAKETRACKER32, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
171 return true; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 } /* end of if(mModProps.mGrabAmigaMOD) */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 /* 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
|
175 lPos = aFilename.find_last_of('.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 if((int)lPos == -1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 return false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 lExt = aFilename.substr(lPos); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 for(uint32 i = 0; i < lExt.length(); i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 lExt[i] = tolower(lExt[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 if (lExt == ".amf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 if (lExt == ".ams") |
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 == ".dbm") |
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 == ".dbf") |
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 == ".dsm") |
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 == ".far") |
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 == ".mdl") |
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 == ".stm") |
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 == ".ult") |
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 == ".mt2") |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 if (lExt == ".mdz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 if (lExt == ".mdr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 if (lExt == ".mdgz") |
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 == ".mdbz") |
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 == ".s3z") |
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 == ".s3r") |
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 == ".s3gz") |
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 == ".xmz") |
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 == ".xmr") |
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 == ".xmgz") |
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 == ".itz") |
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 == ".itr") |
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 == ".itgz") |
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 == ".dmf") |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 if (lExt == ".zip") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 if (lExt == ".gz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 if (lExt == ".bz2") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 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
|
238 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
|
239 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
|
240 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
|
241 return ContainsMod(aFilename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 return false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
246 void ModplugXMMS::PlayLoop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 uint32 lLength; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 //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
|
250 // 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
|
251 uint8 lChannels = mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 while(!mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 if(!(lLength = mSoundFile->Read( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 mBufSize))) |
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 //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
|
260 while((mOutPlug->buffer_playing()) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 if(mModProps.mPreamp) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 //apply preamp |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 uint n = mBufSize >> 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 for(uint i = 0; i < n; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 short old = ((short*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 ((short*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 if ((old & 0x8000) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 (((short*)mBuffer)[i] & 0x8000)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 ((short*)mBuffer)[i] = old | 0x7FFF; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 else |
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 for(uint i = 0; i < mBufSize; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 uchar old = ((uchar*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 ((uchar*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 if ((old & 0x80) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 (((uchar*)mBuffer)[i] & 0x80)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 ((uchar*)mBuffer)[i] = old | 0x7F; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 break; |
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 //wait for buffer space to free up. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 while(((mOutPlug->buffer_free() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 < (int)mBufSize)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
307 playback->pass_audio |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 ( |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
309 playback, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 lChannels, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 mBufSize, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 NULL |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 mPlayed += mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 } |
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 // mOutPlug->flush(0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 mOutPlug->close_audio(); |
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 //Unload the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 mSoundFile->Destroy(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 delete mArchive; |
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 if (mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 delete [] mBuffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 mBuffer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 } |
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 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 mStopped = true; |
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 |
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
|
337 void ModplugXMMS::PlayFile(const string& aFilename, InputPlayback *ipb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 { |
2316 | 339 int32 aLength=0; |
340 char *aModName=NULL; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 //open and mmap the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 mArchive = OpenArchive(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 if(mArchive->Size() == 0) |
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 delete mArchive; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 } |
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 if (mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 delete [] mBuffer; |
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 //find buftime to get approx. 512 samples/block |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 mBufTime = 512000 / mModProps.mFrequency + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 mBufSize = mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 mBufSize *= mModProps.mFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 mBufSize /= 1000; //milliseconds |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 mBufSize *= mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 mBufSize *= mModProps.mBits / 8; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 mBuffer = new uchar[mBufSize]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 if(!mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 return; //out of memory! |
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 CSoundFile::SetWaveConfig |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 mModProps.mBits, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 mModProps.mChannels |
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 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 // [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
|
386 if(mModProps.mReverb) |
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 CSoundFile::SetReverbParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 ); |
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 // [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
|
395 if(mModProps.mMegabass) |
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 CSoundFile::SetXBassParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 mModProps.mBassRange |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 ); |
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 // [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
|
404 if(mModProps.mSurround) |
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 CSoundFile::SetSurroundParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 mModProps.mSurroundDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 ); |
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 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 mSoundFile->SetRepeatCount(mModProps.mLoopCount); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 mPreampFactor = exp(mModProps.mPreampLevel); |
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 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 mStopped = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 mSoundFile->Create |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 (uchar*)mArchive->Map(), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 mArchive->Size() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 mPlayed = 0; |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
425 |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
426 Tuple* ti = GetSongTuple( aFilename ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
427 if ( ti ) |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
428 aModName = format_and_free_ti( ti, &aLength ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
429 |
1986 | 430 ipb->set_params |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 ( |
1986 | 432 ipb, |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
433 aModName, |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
434 aLength, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 mSoundFile->GetNumChannels() * 1000, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 mStopped = mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 mFormat = FMT_S16_NE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 mFormat = FMT_U8; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 mOutPlug->open_audio |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 mModProps.mChannels |
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 |
1351
833a7d4ea063
modplug: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
704
diff
changeset
|
454 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
|
455 ipb->set_pb_ready(ipb); |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
456 this->PlayLoop(ipb); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 void ModplugXMMS::Stop(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 g_thread_join(mDecodeThread); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 void ModplugXMMS::Pause(bool aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 if(aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 mPaused = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 mOutPlug->pause(aPaused); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 void ModplugXMMS::Seek(float32 aTime) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 uint32 lMax; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 uint32 lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 float32 lPostime; |
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 if(aTime > (lMaxtime = mSoundFile->GetSongTime())) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 aTime = lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 lMax = mSoundFile->GetMaxPosition(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 lPostime = float(lMax) / lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 mSoundFile->SetCurrentPos(int(aTime * lPostime)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 mOutPlug->flush(int(aTime * 1000)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 mPlayed = uint32(aTime * 1000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 } |
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 float32 ModplugXMMS::GetTime(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 { |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
499 if ((mStopped) || (!mOutPlug)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 return (float32)mOutPlug->output_time() / 1000; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 |
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
|
504 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
|
505 { |
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
|
506 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
|
507 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
|
508 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
|
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 //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
|
511 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
|
512 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
|
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 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
|
515 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
|
516 } |
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 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
518 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
|
519 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
|
520 lSoundFile->Create((uchar*)lArchive->Map(), lArchive->Size()); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
521 |
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
|
522 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
|
523 { |
1931
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
524 case MOD_TYPE_MOD: tmps = "ProTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
525 case MOD_TYPE_S3M: tmps = "Scream Tracker 3"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
526 case MOD_TYPE_XM: tmps = "Fast Tracker 2"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
527 case MOD_TYPE_IT: tmps = "Impulse Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
528 case MOD_TYPE_MED: tmps = "OctaMed"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
529 case MOD_TYPE_MTM: tmps = "MultiTracker Module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
530 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
|
531 case MOD_TYPE_ULT: tmps = "Ultra Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
532 case MOD_TYPE_STM: tmps = "Scream Tracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
533 case MOD_TYPE_FAR: tmps = "Farandole"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
534 case MOD_TYPE_AMF: tmps = "ASYLUM Music Format"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
535 case MOD_TYPE_AMS: tmps = "AMS module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
536 case MOD_TYPE_DSM: tmps = "DSIK Internal Format"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
537 case MOD_TYPE_MDL: tmps = "DigiTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
538 case MOD_TYPE_OKT: tmps = "Oktalyzer"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
539 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
|
540 case MOD_TYPE_PTM: tmps = "PolyTracker"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
541 case MOD_TYPE_DBM: tmps = "DigiBooster Pro"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
542 case MOD_TYPE_MT2: tmps = "MadTracker 2"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
543 case MOD_TYPE_AMF0: tmps = "AMF0"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
544 case MOD_TYPE_PSM: tmps = "Protracker Studio Module"; break; |
d8f6fe2ff7da
Backed out changeset a945460e921c
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1930
diff
changeset
|
545 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
|
546 } |
2121
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
547 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
|
548 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced"); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1947
diff
changeset
|
549 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
|
550 |
8f1c26966b61
Assume DOS codepage 850 to be the default charset used in most modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
551 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
|
552 // 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
|
553 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
|
554 while ( *tmps3 == ' ' ) tmps3++ ; |
2fe51f6ddb36
Trim whitespace on front of mod titles. (Bugzilla #175)
BioHazard <biohazard@bak.rr.com>
parents:
2316
diff
changeset
|
555 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
|
556 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
|
557 |
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
|
558 //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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 } |
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 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 void ModplugXMMS::SetInputPlugin(InputPlugin& aInPlugin) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 mInPlug = &aInPlugin; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 void ModplugXMMS::SetOutputPlugin(OutputPlugin& aOutPlugin) |
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 mOutPlug = &aOutPlugin; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 const ModplugXMMS::Settings& ModplugXMMS::GetModProps() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 return mModProps; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 const char* ModplugXMMS::Bool2OnOff(bool aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 if(aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 return "on"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 return "off"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 void ModplugXMMS::SetModProps(const Settings& aModProps) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2501
diff
changeset
|
589 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 mModProps = aModProps; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 // [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
|
593 if(mModProps.mReverb) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 CSoundFile::SetReverbParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 ); |
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 // [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
|
602 if(mModProps.mMegabass) |
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 CSoundFile::SetXBassParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 mModProps.mBassRange |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 ); |
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 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
|
611 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 CSoundFile::SetXBassParameters |
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 0, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 ); |
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 // [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
|
619 if(mModProps.mSurround) |
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 CSoundFile::SetSurroundParameters |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 mModProps.mSurroundDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 ); |
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 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 mPreampFactor = exp(mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 |
2118 | 640 db = aud_cfg_db_open(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 |
2119
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2118
diff
changeset
|
642 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
|
643 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
|
644 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
|
645 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
|
646 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
|
647 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
|
648 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
|
649 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
|
650 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
|
651 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
|
652 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
|
653 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 |
2118 | 665 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 ModplugXMMS gModplugXMMS; |