Mercurial > audlegacy-plugins
annotate src/modplug/modplugbmp.cxx @ 1930:a945460e921c
modplug: use g_strdup() to silence conversion warnings.
author | Kiyoshi Aman <kiyoshi.aman@gmail.com> |
---|---|
date | Mon, 01 Oct 2007 07:54:51 -0500 |
parents | d6d8e3cd23c5 |
children | d8f6fe2ff7da |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* Modplug XMMS Plugin |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Authors: Kenton Varda <temporal@gauge3d.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * This source code is public domain. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 */ |
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 #include <fstream> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 #include <unistd.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 #include <math.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 #include "modplugbmp.h" |
161 | 12 #include "stdafx.h" |
13 #include "sndfile.h" | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 #include "stddefs.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 #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
|
16 extern "C" { |
1930
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
17 #include <glib.h> |
3
088092a52fea
[svn] - move from (internal) libaudacious/ include path to audacious/ include path
nenolod
parents:
0
diff
changeset
|
18 #include "audacious/configdb.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
|
19 #include "audacious/output.h" |
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
|
20 #include "audacious/tuple.h" |
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
|
21 #include "audacious/tuple_formatter.h" |
3
088092a52fea
[svn] - move from (internal) libaudacious/ include path to audacious/ include path
nenolod
parents:
0
diff
changeset
|
22 #include "audacious/vfs.h" |
1601
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
23 #include "audacious/strings.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
26 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
|
27 { |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
28 char* result = tuple_formatter_make_title_string(ti, get_gentitle_format()); |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
29 if ( result ) |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
30 *length = tuple_get_int(ti, FIELD_LENGTH, NULL); |
1544
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
31 tuple_free((void *) ti); |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
32 |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
33 return result; |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
34 } |
0cfbecddb647
It compiles, no segfault... So where is my title?
Tony Vroon <chainsaw@gentoo.org>
parents:
1539
diff
changeset
|
35 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 // ModplugXMMS member functions =============================== |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 // operations ---------------------------------------- |
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 mSoundFile = new CSoundFile; |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
42 mOutPlug = NULL; |
0
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::~ModplugXMMS() |
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 delete mSoundFile; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 ModplugXMMS::Settings::Settings() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 mSurround = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 mOversamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 mReverb = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 mMegabass = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 mNoiseReduction = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 mVolumeRamp = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 mFastinfo = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 mUseFilename = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 mGrabAmigaMOD = true; |
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 mChannels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 mFrequency = 44100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 mBits = 16; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 mResamplingMode = SRCMODE_POLYPHASE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 mReverbDepth = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 mReverbDelay = 100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 mBassAmount = 40; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 mBassRange = 30; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 mSurroundDepth = 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 mSurroundDelay = 20; |
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 mPreamp = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 mPreampLevel = 0.0f; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 mLoopCount = 0; //don't loop |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 void ModplugXMMS::Init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 db = bmp_cfg_db_open(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 bmp_cfg_db_get_bool(db,"modplug","Surround", &mModProps.mSurround); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 bmp_cfg_db_get_bool(db,"modplug","Oversampling", &mModProps.mOversamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 bmp_cfg_db_get_bool(db,"modplug","Megabass", &mModProps.mMegabass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 bmp_cfg_db_get_bool(db,"modplug","NoiseReduction", &mModProps.mNoiseReduction); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 bmp_cfg_db_get_bool(db,"modplug","VolumeRamp", &mModProps.mVolumeRamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 bmp_cfg_db_get_bool(db,"modplug","Reverb", &mModProps.mReverb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 bmp_cfg_db_get_bool(db,"modplug","FastInfo", &mModProps.mFastinfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 bmp_cfg_db_get_bool(db,"modplug","UseFileName", &mModProps.mUseFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 bmp_cfg_db_get_bool(db,"modplug","GrabAmigaMOD", &mModProps.mGrabAmigaMOD); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 bmp_cfg_db_get_bool(db,"modplug","PreAmp", &mModProps.mPreamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 bmp_cfg_db_get_float(db,"modplug","PreAmpLevel", &mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 bmp_cfg_db_get_int(db,"modplug", "Channels", &mModProps.mChannels); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 bmp_cfg_db_get_int(db,"modplug", "Bits", &mModProps.mBits); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 bmp_cfg_db_get_int(db,"modplug", "Frequency", &mModProps.mFrequency); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 bmp_cfg_db_get_int(db,"modplug", "ResamplineMode", &mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 bmp_cfg_db_get_int(db,"modplug", "ReverbDepth", &mModProps.mReverbDepth); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 bmp_cfg_db_get_int(db,"modplug", "ReverbDelay", &mModProps.mReverbDelay); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 bmp_cfg_db_get_int(db,"modplug", "BassAmount", &mModProps.mBassAmount); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 bmp_cfg_db_get_int(db,"modplug", "BassRange", &mModProps.mBassRange); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 bmp_cfg_db_get_int(db,"modplug", "SurroundDepth", &mModProps.mSurroundDepth); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 bmp_cfg_db_get_int(db,"modplug", "SurroundDelay", &mModProps.mSurroundDelay); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 bmp_cfg_db_get_int(db,"modplug", "LoopCount", &mModProps.mLoopCount); |
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 bmp_cfg_db_close(db); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
111 bool ModplugXMMS::CanPlayFileFromVFS(const string& aFilename, VFSFile *file) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 string lExt; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 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
|
115 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
|
116 char magic[magicSize]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 |
1599
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
118 vfs_fread(magic, 1, magicSize, file); |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
119 if (!memcmp(magic, UMX_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
120 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
|
121 if (!memcmp(magic, "Extended Module:", 16)) |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
122 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
123 if (!memcmp(magic, M669_MAGIC, 2)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
124 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
125 if (!memcmp(magic, IT_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
126 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
127 if (!memcmp(magic, MTM_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
128 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
129 if (!memcmp(magic, PSM_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
130 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
131 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 vfs_fseek(file, 44, SEEK_SET); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 vfs_fread(magic, 1, 4, file); |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
134 if (!memcmp(magic, S3M_MAGIC, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
135 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
|
136 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 vfs_fseek(file, 1080, SEEK_SET); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 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
|
139 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
140 // 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
|
141 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
|
142 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
|
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 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
|
146 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
|
147 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
|
148 return true; |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
149 } |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
150 |
6764c35e16a6
Detect Fast Tracker (and others) xCHN and xxCH MOD module signatures properly.
Matti Hamalainen <ccr@tnsp.org>
parents:
1562
diff
changeset
|
151 // 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
|
152 if(mModProps.mGrabAmigaMOD) { |
704
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
153 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
154 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
155 if (!memcmp(magic, MOD_MAGIC_PROTRACKER4X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
156 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
157 if (!memcmp(magic, MOD_MAGIC_NOISETRACKER, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
158 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
159 if (!memcmp(magic, MOD_MAGIC_STARTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
160 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
161 if (!memcmp(magic, MOD_MAGIC_STARTRACKER8, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
162 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
163 if (!memcmp(magic, MOD_MAGIC_STARTRACKER4X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
164 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
165 if (!memcmp(magic, MOD_MAGIC_STARTRACKER8X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
166 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
167 if (!memcmp(magic, MOD_MAGIC_FASTTRACKER4, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
168 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
169 if (!memcmp(magic, MOD_MAGIC_OKTALYZER8, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
170 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
171 if (!memcmp(magic, MOD_MAGIC_OKTALYZER8X, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
172 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
173 if (!memcmp(magic, MOD_MAGIC_TAKETRACKER16, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
174 return true; |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
175 if (!memcmp(magic, MOD_MAGIC_TAKETRACKER32, 4)) |
94b22cc75eb8
[svn] - VFS probing support patch by Christian Birchinger (joker).
nenolod
parents:
161
diff
changeset
|
176 return true; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 } /* end of if(mModProps.mGrabAmigaMOD) */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 /* 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
|
180 lPos = aFilename.find_last_of('.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 if((int)lPos == -1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 return false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 lExt = aFilename.substr(lPos); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 for(uint32 i = 0; i < lExt.length(); i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 lExt[i] = tolower(lExt[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 if (lExt == ".amf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 if (lExt == ".ams") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 if (lExt == ".dbm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 if (lExt == ".dbf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 if (lExt == ".dsm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 if (lExt == ".far") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 if (lExt == ".mdl") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 if (lExt == ".stm") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 if (lExt == ".ult") |
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 == ".j2b") |
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 == ".mt2") |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 if (lExt == ".mdz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 if (lExt == ".mdr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 if (lExt == ".mdgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 if (lExt == ".mdbz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 if (lExt == ".s3z") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 if (lExt == ".s3r") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 if (lExt == ".s3gz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 if (lExt == ".xmz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 if (lExt == ".xmr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 if (lExt == ".xmgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 if (lExt == ".itz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 if (lExt == ".itr") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 if (lExt == ".itgz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 if (lExt == ".dmf") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 return true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 if (lExt == ".zip") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 if (lExt == ".gz") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 if (lExt == ".bz2") |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 return ContainsMod(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 return false; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 void ModplugXMMS::PlayLoop() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 uint32 lLength; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 //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
|
253 // 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
|
254 uint8 lChannels = mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 while(!mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 if(!(lLength = mSoundFile->Read( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 mBufSize))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 //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
|
263 while((mOutPlug->buffer_playing()) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 break; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 if(mModProps.mPreamp) |
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 //apply preamp |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 uint n = mBufSize >> 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 for(uint i = 0; i < n; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 short old = ((short*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 ((short*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 if ((old & 0x8000) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 (((short*)mBuffer)[i] & 0x8000)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 ((short*)mBuffer)[i] = old | 0x7FFF; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 for(uint i = 0; i < mBufSize; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 uchar old = ((uchar*)mBuffer)[i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 ((uchar*)mBuffer)[i] *= (short int)mPreampFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 // detect overflow and clip! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 if ((old & 0x80) != |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 (((uchar*)mBuffer)[i] & 0x80)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 ((uchar*)mBuffer)[i] = old | 0x7F; |
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 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 //wait for buffer space to free up. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 while(((mOutPlug->buffer_free() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 < (int)mBufSize)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 && (!mStopped)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 usleep(10000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 produce_audio |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 mPlayed, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 lChannels, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 mBufSize, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 mBuffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 NULL |
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 mPlayed += mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 } |
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 // mOutPlug->flush(0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 mOutPlug->close_audio(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 //Unload the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 mSoundFile->Destroy(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 delete mArchive; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 if (mBuffer) |
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 delete [] mBuffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 mBuffer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 } |
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 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 |
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
|
340 void ModplugXMMS::PlayFile(const string& aFilename, InputPlayback *ipb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 { |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
342 int32 aLength; |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
343 char *aModName; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 //open and mmap the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 mArchive = OpenArchive(aFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 if(mArchive->Size() == 0) |
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 delete mArchive; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 } |
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 if (mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 delete [] mBuffer; |
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 //find buftime to get approx. 512 samples/block |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 mBufTime = 512000 / mModProps.mFrequency + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 mBufSize = mBufTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 mBufSize *= mModProps.mFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 mBufSize /= 1000; //milliseconds |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 mBufSize *= mModProps.mChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 mBufSize *= mModProps.mBits / 8; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 mBuffer = new uchar[mBufSize]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 if(!mBuffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 return; //out of memory! |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 CSoundFile::SetWaveConfig |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 mModProps.mBits, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 ); |
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 // [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
|
389 if(mModProps.mReverb) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 CSoundFile::SetReverbParameters |
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 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 ); |
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 // [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
|
398 if(mModProps.mMegabass) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 CSoundFile::SetXBassParameters |
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 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 mModProps.mBassRange |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 ); |
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 // [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
|
407 if(mModProps.mSurround) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 CSoundFile::SetSurroundParameters |
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 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 mModProps.mSurroundDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 mSoundFile->SetRepeatCount(mModProps.mLoopCount); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 mPreampFactor = exp(mModProps.mPreampLevel); |
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 mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 mStopped = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 mSoundFile->Create |
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 (uchar*)mArchive->Map(), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 mArchive->Size() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 mPlayed = 0; |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
428 |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
429 Tuple* ti = GetSongTuple( aFilename ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
430 if ( ti ) |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
431 aModName = format_and_free_ti( ti, &aLength ); |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
432 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 mInPlug->set_info |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 ( |
1545
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
435 aModName, |
1047d8a70a6c
Correct title generation, use that tuple builder.
Tony Vroon <chainsaw@gentoo.org>
parents:
1544
diff
changeset
|
436 aLength, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 mSoundFile->GetNumChannels() * 1000, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 ); |
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 mStopped = mPaused = false; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 if(mModProps.mBits == 16) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 mFormat = FMT_S16_NE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 mFormat = FMT_U8; |
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 mOutPlug->open_audio |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 mFormat, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 mModProps.mFrequency, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 mModProps.mChannels |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 |
1351
833a7d4ea063
modplug: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
704
diff
changeset
|
456 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
|
457 ipb->set_pb_ready(ipb); |
1351
833a7d4ea063
modplug: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
704
diff
changeset
|
458 this->PlayLoop(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 } |
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 void ModplugXMMS::Stop(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 if(mStopped) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 mStopped = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 mPaused = false; |
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 g_thread_join(mDecodeThread); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 void ModplugXMMS::Pause(bool aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 if(aPaused) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 mPaused = true; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 mPaused = false; |
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 mOutPlug->pause(aPaused); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 void ModplugXMMS::Seek(float32 aTime) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 uint32 lMax; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 uint32 lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 float32 lPostime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 if(aTime > (lMaxtime = mSoundFile->GetSongTime())) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 aTime = lMaxtime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 lMax = mSoundFile->GetMaxPosition(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 lPostime = float(lMax) / lMaxtime; |
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 mSoundFile->SetCurrentPos(int(aTime * lPostime)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 mOutPlug->flush(int(aTime * 1000)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 mPlayed = uint32(aTime * 1000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 float32 ModplugXMMS::GetTime(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 { |
1475
1c5688582a4e
fixed modplug, wasn't working properly with new threading model
Giacomo Lozito <james@develia.org>
parents:
1447
diff
changeset
|
501 if ((mStopped) || (!mOutPlug)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 return (float32)mOutPlug->output_time() / 1000; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 |
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
|
506 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
|
507 { |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
508 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
|
509 Archive* lArchive; |
1601
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
510 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
|
511 |
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 //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
|
513 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
|
514 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
|
515 { |
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 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
|
517 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
|
518 } |
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 |
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 Tuple *ti = tuple_new_from_filename(aFilename.c_str()); |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
521 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
|
522 lSoundFile->Create((uchar*)lArchive->Map(), lArchive->Size()); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
523 |
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
|
524 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
|
525 { |
1930
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
526 case MOD_TYPE_MOD: tmps = g_strdup("ProTracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
527 case MOD_TYPE_S3M: tmps = g_strdup("Scream Tracker 3"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
528 case MOD_TYPE_XM: tmps = g_strdup("Fast Tracker 2"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
529 case MOD_TYPE_IT: tmps = g_strdup("Impulse Tracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
530 case MOD_TYPE_MED: tmps = g_strdup("OctaMed"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
531 case MOD_TYPE_MTM: tmps = g_strdup("MultiTracker Module"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
532 case MOD_TYPE_669: tmps = g_strdup("669 Composer / UNIS 669"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
533 case MOD_TYPE_ULT: tmps = g_strdup("Ultra Tracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
534 case MOD_TYPE_STM: tmps = g_strdup("Scream Tracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
535 case MOD_TYPE_FAR: tmps = g_strdup("Farandole"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
536 case MOD_TYPE_AMF: tmps = g_strdup("ASYLUM Music Format"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
537 case MOD_TYPE_AMS: tmps = g_strdup("AMS module"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
538 case MOD_TYPE_DSM: tmps = g_strdup("DSIK Internal Format"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
539 case MOD_TYPE_MDL: tmps = g_strdup("DigiTracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
540 case MOD_TYPE_OKT: tmps = g_strdup("Oktalyzer"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
541 case MOD_TYPE_DMF: tmps = g_strdup("Delusion Digital Music Fileformat (X-Tracker)"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
542 case MOD_TYPE_PTM: tmps = g_strdup("PolyTracker"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
543 case MOD_TYPE_DBM: tmps = g_strdup("DigiBooster Pro"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
544 case MOD_TYPE_MT2: tmps = g_strdup("MadTracker 2"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
545 case MOD_TYPE_AMF0: tmps = g_strdup("AMF0"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
546 case MOD_TYPE_PSM: tmps = g_strdup("Protracker Studio Module"); break; |
a945460e921c
modplug: use g_strdup() to silence conversion warnings.
Kiyoshi Aman <kiyoshi.aman@gmail.com>
parents:
1688
diff
changeset
|
547 default: tmps = g_strdup("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
|
548 } |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
549 tuple_associate_string(ti, FIELD_CODEC, NULL, tmps); |
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
550 tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced"); |
1688 | 551 tuple_associate_int(ti, FIELD_LENGTH, NULL, lSoundFile->GetSongTime() * 1000); |
1601
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
552 |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
553 /* NOTICE! FIXME? This is actually incorrect. We _cannot_ know what charset |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
554 * an arbitrary module file uses .. typically it is some DOS CP-variant, |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
555 * except for true Amiga modules. |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
556 */ |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
557 tmps = str_to_utf8(lSoundFile->GetTitle()); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
558 tuple_associate_string(ti, FIELD_TITLE, NULL, lSoundFile->GetTitle()); |
1601
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
559 g_free(tmps); |
be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
Matti Hamalainen <ccr@tnsp.org>
parents:
1600
diff
changeset
|
560 |
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
|
561 //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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 } |
488f7e6c36ed
Tuple builder for modplug. Someone do me a favour and fix getinfo to do something like the one in console.
Tony Vroon <chainsaw@gentoo.org>
parents:
1475
diff
changeset
|
567 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 void ModplugXMMS::SetInputPlugin(InputPlugin& aInPlugin) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 mInPlug = &aInPlugin; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 void ModplugXMMS::SetOutputPlugin(OutputPlugin& aOutPlugin) |
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 mOutPlug = &aOutPlugin; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 const ModplugXMMS::Settings& ModplugXMMS::GetModProps() |
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 return mModProps; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 const char* ModplugXMMS::Bool2OnOff(bool aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 if(aValue) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 return "on"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 return "off"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 void ModplugXMMS::SetModProps(const Settings& 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 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 mModProps = aModProps; |
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 // [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
|
596 if(mModProps.mReverb) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 CSoundFile::SetReverbParameters |
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 mModProps.mReverbDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 mModProps.mReverbDelay |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 ); |
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 // [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
|
605 if(mModProps.mMegabass) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 CSoundFile::SetXBassParameters |
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 mModProps.mBassAmount, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 mModProps.mBassRange |
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 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 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
|
614 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 CSoundFile::SetXBassParameters |
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 0, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 ); |
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 // [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
|
622 if(mModProps.mSurround) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 CSoundFile::SetSurroundParameters |
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 mModProps.mSurroundDepth, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 mModProps.mSurroundDelay |
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 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 CSoundFile::SetWaveConfigEx |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 ( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 mModProps.mSurround, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 !mModProps.mOversamp, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 mModProps.mReverb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 true, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 mModProps.mMegabass, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 mModProps.mNoiseReduction, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 false |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 CSoundFile::SetResamplingMode(mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 mPreampFactor = exp(mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 db = bmp_cfg_db_open(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 bmp_cfg_db_set_bool(db,"modplug","Surround", mModProps.mSurround); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 bmp_cfg_db_set_bool(db,"modplug","Oversampling", mModProps.mOversamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 bmp_cfg_db_set_bool(db,"modplug","Megabass", mModProps.mMegabass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 bmp_cfg_db_set_bool(db,"modplug","NoiseReduction", mModProps.mNoiseReduction); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 bmp_cfg_db_set_bool(db,"modplug","VolumeRamp", mModProps.mVolumeRamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 bmp_cfg_db_set_bool(db,"modplug","Reverb", mModProps.mReverb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 bmp_cfg_db_set_bool(db,"modplug","FastInfo", mModProps.mFastinfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 bmp_cfg_db_set_bool(db,"modplug","UseFileName", mModProps.mUseFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 bmp_cfg_db_set_bool(db,"modplug","GrabAmigaMOD", mModProps.mGrabAmigaMOD); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 bmp_cfg_db_set_bool(db,"modplug","PreAmp", mModProps.mPreamp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 bmp_cfg_db_set_float(db,"modplug","PreAmpLevel", mModProps.mPreampLevel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
656 bmp_cfg_db_set_int(db,"modplug", "Channels", mModProps.mChannels); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
657 bmp_cfg_db_set_int(db,"modplug", "Bits", mModProps.mBits); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 bmp_cfg_db_set_int(db,"modplug", "Frequency", mModProps.mFrequency); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 bmp_cfg_db_set_int(db,"modplug", "ResamplineMode", mModProps.mResamplingMode); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 bmp_cfg_db_set_int(db,"modplug", "ReverbDepth", mModProps.mReverbDepth); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 bmp_cfg_db_set_int(db,"modplug", "ReverbDelay", mModProps.mReverbDelay); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 bmp_cfg_db_set_int(db,"modplug", "BassAmount", mModProps.mBassAmount); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 bmp_cfg_db_set_int(db,"modplug", "BassRange", mModProps.mBassRange); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 bmp_cfg_db_set_int(db,"modplug", "SurroundDepth", mModProps.mSurroundDepth); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
665 bmp_cfg_db_set_int(db,"modplug", "SurroundDelay", mModProps.mSurroundDelay); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 bmp_cfg_db_set_int(db,"modplug", "LoopCount", mModProps.mLoopCount); |
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 bmp_cfg_db_close(db); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 ModplugXMMS gModplugXMMS; |