Mercurial > audlegacy
annotate src/audacious/output.c @ 4259:92642f860860
- added template for src_flow
- vis_flow can work now with FMT_FLOAT, but disabled pending src stuff refactoring
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Sat, 09 Feb 2008 01:05:36 +0300 |
parents | 8157686b8115 |
children | 2b7a74fce100 a41fb6bc632a |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
4234 | 2 * Copyright (C) 2005-2008 Audacious team |
2313 | 3 * |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2813
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2813
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 | |
4242
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
26 /* #define AUD_DEBUG */ |
4234 | 27 |
2313 | 28 #ifdef HAVE_CONFIG_H |
29 # include "config.h" | |
30 #endif | |
31 | |
32 #include "output.h" | |
33 #include "iir.h" | |
34 #include "main.h" | |
35 #include "input.h" | |
2328 | 36 #include "playback.h" |
2313 | 37 |
38 #include "playlist.h" | |
2717 | 39 #include "configdb.h" |
2542 | 40 |
3553
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
41 #include "flow.h" |
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
42 |
2811
1c7ee5ed3a10
[svn] Move effect plugin handling into the main thread
ertzing
parents:
2717
diff
changeset
|
43 #include "effect.h" |
3546
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
44 #include "volumecontrol.h" |
3559 | 45 #include "visualization.h" |
2811
1c7ee5ed3a10
[svn] Move effect plugin handling into the main thread
ertzing
parents:
2717
diff
changeset
|
46 |
4234 | 47 #include "libSAD.h" |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
48 #include "util.h" |
4234 | 49 |
2542 | 50 #include <math.h> |
51 | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
52 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
53 #include <samplerate.h> |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
54 #endif |
2313 | 55 |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
56 #define FMT_FRACBITS(a) ( (a) == FMT_FIXED32 ? __AUDACIOUS_ASSUMED_MAD_F_FRACBITS__ : 0 ) |
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
57 |
2313 | 58 OutputPluginData op_data = { |
59 NULL, | |
60 NULL | |
61 }; | |
62 | |
63 OutputPluginState op_state = { | |
64 0, | |
65 0, | |
66 0 | |
67 }; | |
68 | |
69 OutputPlugin psuedo_output_plugin = { | |
3549 | 70 .description = "XMMS reverse compatibility output plugin", |
71 .get_volume = output_get_volume, | |
72 .set_volume = output_set_volume, | |
73 | |
74 .open_audio = output_open_audio, | |
75 .write_audio = output_write_audio, | |
76 .close_audio = output_close_audio, | |
2313 | 77 |
3549 | 78 .flush = output_flush, |
79 .pause = output_pause, | |
80 | |
81 .buffer_free = output_buffer_free, | |
82 .buffer_playing = output_buffer_playing, | |
83 .output_time = get_output_time, | |
84 .written_time = get_written_time, | |
2313 | 85 }; |
86 | |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
87 static void apply_replaygain_info (ReplayGainInfo *rg_info); |
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
88 |
2313 | 89 OutputPlugin * |
90 get_current_output_plugin(void) | |
91 { | |
92 return op_data.current_output_plugin; | |
93 } | |
94 | |
95 void | |
96 set_current_output_plugin(gint i) | |
97 { | |
98 gboolean playing; | |
99 OutputPlugin *op = get_current_output_plugin(); | |
100 | |
101 GList *node = g_list_nth(op_data.output_list, i); | |
102 if (!node) { | |
103 op_data.current_output_plugin = NULL; | |
104 return; | |
105 } | |
106 | |
107 op_data.current_output_plugin = node->data; | |
108 | |
109 playing = playback_get_playing(); | |
110 | |
111 if (playing == TRUE) | |
112 { | |
113 guint time, pos; | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
114 PlaylistEntry *entry; |
2313 | 115 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
116 /* don't stop yet, get the seek time and playlist position first */ |
2313 | 117 pos = playlist_get_position(playlist_get_active()); |
118 time = op->output_time(); | |
119 | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
120 /* reset the audio system */ |
2313 | 121 mainwin_stop_pushed(); |
122 op->close_audio(); | |
123 | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
124 g_usleep(300000); |
2313 | 125 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
126 /* wait for the playback thread to come online */ |
2313 | 127 while (playback_get_playing()) |
128 g_message("waiting for audio system shutdown..."); | |
129 | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
130 /* wait for the playback thread to come online */ |
2313 | 131 playlist_set_position(playlist_get_active(), pos); |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
132 entry = playlist_get_entry_to_play(playlist_get_active()); |
2313 | 133 playback_play_file(entry); |
134 | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
135 while (!playback_get_playing()) |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
136 { |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
137 gtk_main_iteration(); |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
138 g_message("waiting for audio system startup..."); |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
139 } |
2313 | 140 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
141 /* and signal a reseek */ |
2313 | 142 if (playlist_get_current_length(playlist_get_active()) > -1 && |
143 time <= (playlist_get_current_length(playlist_get_active()))) | |
144 playback_seek(time / 1000); | |
145 } | |
146 } | |
147 | |
148 GList * | |
149 get_output_list(void) | |
150 { | |
151 return op_data.output_list; | |
152 } | |
153 | |
154 void | |
155 output_about(gint i) | |
156 { | |
157 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data; | |
158 if (out && out->about) | |
159 out->about(); | |
160 } | |
161 | |
162 void | |
163 output_configure(gint i) | |
164 { | |
165 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data; | |
166 if (out && out->configure) | |
167 out->configure(); | |
168 } | |
169 | |
170 void | |
171 output_get_volume(gint * l, gint * r) | |
172 { | |
173 *l = *r = -1; | |
174 | |
175 if (!op_data.current_output_plugin) | |
176 return; | |
177 | |
178 if (!op_data.current_output_plugin->get_volume) | |
179 return; | |
180 | |
3546
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
181 if (cfg.software_volume_control) |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
182 volumecontrol_get_volume_state(l, r); |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
183 else |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
184 op_data.current_output_plugin->get_volume(l, r); |
2313 | 185 } |
186 | |
187 void | |
188 output_set_volume(gint l, gint r) | |
189 { | |
190 if (!op_data.current_output_plugin) | |
191 return; | |
192 | |
193 if (!op_data.current_output_plugin->set_volume) | |
194 return; | |
195 | |
3546
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
196 if (cfg.software_volume_control) |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
197 volumecontrol_set_volume_state(l, r); |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
198 else |
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
199 op_data.current_output_plugin->set_volume(l, r); |
2313 | 200 } |
201 | |
202 void | |
203 output_set_eq(gboolean active, gfloat pre, gfloat * bands) | |
204 { | |
205 int i; | |
206 preamp[0] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre; | |
207 preamp[1] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre; | |
208 | |
209 for (i = 0; i < 10; ++i) | |
210 { | |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
211 set_gain(i, 0, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]); |
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
212 set_gain(i, 1, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]); |
2313 | 213 } |
214 } | |
215 | |
216 /* called by input plugin to peek at the output plugin's write progress */ | |
217 gint | |
218 get_written_time(void) | |
219 { | |
220 OutputPlugin *op = get_current_output_plugin(); | |
221 | |
222 return op->written_time(); | |
223 } | |
224 | |
225 /* called by input plugin to peek at the output plugin's output progress */ | |
226 gint | |
227 get_output_time(void) | |
228 { | |
229 OutputPlugin *op = get_current_output_plugin(); | |
230 | |
231 return op->output_time(); | |
232 } | |
233 | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
234 #ifdef USE_SRC |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
235 |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
236 static SRC_STATE *src_state; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
237 static SRC_DATA src_data; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
238 static int overSamplingFs = 96000; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
239 static int converter_type = SRC_SINC_BEST_QUALITY; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
240 static int srcError = 0; |
2648
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
241 |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
242 static float *srcIn = NULL, *srcOut = NULL; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
243 static short int *wOut = NULL; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
244 static int lengthOfSrcIn = 0; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
245 static int lengthOfSrcOut = 0; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
246 |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
247 static void freeSRC() |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
248 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
249 if(src_state != NULL) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
250 src_state = src_delete(src_state); |
2648
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
251 free(srcIn); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
252 free(srcOut); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
253 free(wOut); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
254 srcIn = NULL; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
255 srcOut = NULL; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
256 wOut = NULL; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
257 lengthOfSrcIn = 0; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
258 lengthOfSrcOut = 0; |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
259 } |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
260 |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
261 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
262 |
4234 | 263 static SAD_dither_t *sad_state = NULL; |
264 static SAD_dither_t *sad_state_to_float = NULL; | |
265 static SAD_dither_t *sad_state_from_float = NULL; | |
266 static void *sad_out_buf = NULL; | |
267 static int sad_out_buf_length = 0; | |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
268 static ReplayGainInfo replay_gain_info = { |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
269 .track_gain = 0.0, |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
270 .track_peak = 0.0, |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
271 .album_gain = 0.0, |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
272 .album_peak = 0.0, |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
273 }; |
4234 | 274 |
275 static void | |
276 freeSAD() | |
277 { | |
278 if (sad_state != NULL) {SAD_dither_free(sad_state); sad_state = NULL;} | |
279 if (sad_state_from_float != NULL) {SAD_dither_free(sad_state_from_float); sad_state_from_float = NULL;} | |
280 if (sad_state_to_float != NULL) {SAD_dither_free(sad_state_to_float); sad_state_to_float = NULL;} | |
281 if (sad_out_buf != NULL) {free(sad_out_buf); sad_out_buf = NULL; sad_out_buf_length = 0;} | |
282 } | |
283 | |
2313 | 284 gint |
285 output_open_audio(AFormat fmt, gint rate, gint nch) | |
286 { | |
287 gint ret; | |
288 OutputPlugin *op; | |
4234 | 289 AUDDBG("\n"); |
290 | |
291 AFormat output_fmt; | |
292 int bit_depth; | |
293 SAD_buffer_format input_sad_fmt; | |
294 SAD_buffer_format output_sad_fmt; | |
295 | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
296 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
297 gboolean src_enabled; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
298 gint src_rate, src_type; |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
299 ConfigDb *db; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
300 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3681
diff
changeset
|
301 db = cfg_db_open(); |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
302 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3681
diff
changeset
|
303 if (cfg_db_get_bool(db, NULL, "enable_src", &src_enabled) == FALSE) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
304 src_enabled = FALSE; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
305 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3681
diff
changeset
|
306 if (cfg_db_get_int(db, NULL, "src_rate", &src_rate) == FALSE) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
307 overSamplingFs = 48000; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
308 else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
309 overSamplingFs = src_rate; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
310 |
2649
153dc928115a
[svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents:
2648
diff
changeset
|
311 /* don't resample if sampling rates are the same --nenolod */ |
153dc928115a
[svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents:
2648
diff
changeset
|
312 if (rate == overSamplingFs) |
153dc928115a
[svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents:
2648
diff
changeset
|
313 src_enabled = FALSE; |
153dc928115a
[svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents:
2648
diff
changeset
|
314 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3681
diff
changeset
|
315 if (cfg_db_get_int(db, NULL, "src_type", &src_type) == FALSE) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
316 converter_type = SRC_SINC_BEST_QUALITY; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
317 else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
318 converter_type = src_type; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
319 |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
320 freeSRC(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
321 |
4234 | 322 if(src_enabled) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
323 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
324 src_state = src_new(converter_type, nch, &srcError); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
325 if (src_state != NULL) |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
326 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
327 src_data.src_ratio = (float)overSamplingFs/(float)rate; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
328 rate = overSamplingFs; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
329 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
330 else |
4234 | 331 { |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
332 fprintf(stderr, "src_new(): %s\n\n", src_strerror(srcError)); |
4234 | 333 src_enabled = FALSE; |
334 } | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
335 } |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
336 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
337 cfg_db_close(db); |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
338 #endif |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
339 |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
340 /*if (cfg_db_get_int(db, NULL, "output_bit_depth", &bit_depth) == FALSE) bit_depth = 16;*/ |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
341 bit_depth = cfg.output_bit_depth; |
4234 | 342 |
343 AUDDBG("bit depth: %d\n", bit_depth); | |
4238
75ea2083e744
some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4237
diff
changeset
|
344 output_fmt = (bit_depth == 24) ? FMT_S24_NE : FMT_S16_NE; |
75ea2083e744
some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4237
diff
changeset
|
345 /*output_fmt = (bit_depth == 24) ? FMT_S24_LE : FMT_S16_LE;*/ /* no reason to support other output formats --asphyx */ |
4234 | 346 |
347 freeSAD(); | |
348 | |
349 #ifdef USE_SRC | |
350 if (src_enabled) { | |
351 AUDDBG("initializing dithering engine for 2 stage conversion\n"); | |
352 input_sad_fmt.sample_format = sadfmt_from_afmt(fmt); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
353 if (input_sad_fmt.sample_format < 0) return FALSE; |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
354 input_sad_fmt.fracbits = FMT_FRACBITS(fmt); |
4234 | 355 input_sad_fmt.channels = nch; |
356 input_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
357 input_sad_fmt.samplerate = 0; | |
358 | |
359 output_sad_fmt.sample_format = SAD_SAMPLE_FLOAT; | |
360 output_sad_fmt.fracbits = 0; | |
361 output_sad_fmt.channels = nch; | |
362 output_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
363 output_sad_fmt.samplerate = 0; | |
364 | |
365 sad_state_to_float = SAD_dither_init(&input_sad_fmt, &output_sad_fmt, &ret); | |
366 if (sad_state_to_float == NULL) { | |
367 AUDDBG("ditherer init failed (decoder's native --> float)\n"); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
368 return FALSE; |
4234 | 369 } |
370 SAD_dither_set_dither (sad_state_to_float, FALSE); | |
371 | |
372 input_sad_fmt.sample_format = SAD_SAMPLE_FLOAT; | |
373 input_sad_fmt.fracbits = 0; | |
374 input_sad_fmt.channels = nch; | |
375 input_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
376 input_sad_fmt.samplerate = 0; | |
377 | |
378 output_sad_fmt.sample_format = sadfmt_from_afmt(output_fmt); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
379 if (output_sad_fmt.sample_format < 0) return FALSE; |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
380 output_sad_fmt.fracbits = FMT_FRACBITS(output_fmt); |
4234 | 381 output_sad_fmt.channels = nch; |
382 output_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
383 output_sad_fmt.samplerate = 0; | |
384 | |
385 sad_state_from_float = SAD_dither_init(&input_sad_fmt, &output_sad_fmt, &ret); | |
386 if (sad_state_from_float == NULL) { | |
387 SAD_dither_free(sad_state_to_float); | |
388 AUDDBG("ditherer init failed (float --> output)\n"); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
389 return FALSE; |
4234 | 390 } |
391 SAD_dither_set_dither (sad_state_from_float, TRUE); | |
392 | |
393 fmt = output_fmt; | |
394 } else | |
395 #endif /* USE_SRC */ | |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
396 { /* needed for RG processing !*/ |
4234 | 397 AUDDBG("initializing dithering engine for direct conversion\n"); |
398 | |
399 input_sad_fmt.sample_format = sadfmt_from_afmt(fmt); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
400 if (input_sad_fmt.sample_format < 0) return FALSE; |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
401 input_sad_fmt.fracbits = FMT_FRACBITS(fmt); |
4234 | 402 input_sad_fmt.channels = nch; |
403 input_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
404 input_sad_fmt.samplerate = 0; /* resampling not implemented yet in libSAD */ | |
405 | |
406 output_sad_fmt.sample_format = sadfmt_from_afmt(output_fmt); | |
4240
29c8603a877a
added FMT_FIXED32, an equivalent of mad_fixed_t, already supported by libSAD; some endianness-related changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4239
diff
changeset
|
407 output_sad_fmt.fracbits = FMT_FRACBITS(output_fmt); |
4234 | 408 output_sad_fmt.channels = nch; |
409 output_sad_fmt.channels_order = SAD_CHORDER_INTERLEAVED; | |
410 output_sad_fmt.samplerate = 0; | |
411 | |
412 sad_state = SAD_dither_init(&input_sad_fmt, &output_sad_fmt, &ret); | |
413 if (sad_state == NULL) { | |
414 AUDDBG("ditherer init failed\n"); | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
415 return FALSE; |
4234 | 416 } |
417 SAD_dither_set_dither (sad_state, TRUE); | |
418 | |
419 fmt = output_fmt; | |
420 } | |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
421 |
4242
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
422 if(replay_gain_info.album_peak == 0.0 && replay_gain_info.track_peak == 0.0) { |
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
423 AUDDBG("RG info isn't set yet. Filling replay_gain_info with default values.\n"); |
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
424 replay_gain_info.track_gain = cfg.default_gain; |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4247
diff
changeset
|
425 replay_gain_info.track_peak = 0.01; |
4242
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
426 replay_gain_info.album_gain = cfg.default_gain; |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4247
diff
changeset
|
427 replay_gain_info.album_peak = 0.01; |
4242
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
428 } |
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
429 apply_replaygain_info(&replay_gain_info); |
4234 | 430 |
2313 | 431 op = get_current_output_plugin(); |
432 | |
433 if (op == NULL) | |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
434 return FALSE; |
2313 | 435 |
436 /* Is our output port already open? */ | |
437 if ((op_state.rate != 0 && op_state.nch != 0) && | |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
438 (op_state.rate == rate && op_state.nch == nch && op_state.fmt == fmt)) |
2313 | 439 { |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
440 /* Yes, and it's the correct sampling rate. Reset the counter and go. */ |
4235
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
441 AUDDBG("flushing output instead of reopening\n"); |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
442 op->flush(0); |
4239
51291ce4eb54
some endianness-related changes, corrected error handling
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4238
diff
changeset
|
443 return TRUE; |
2313 | 444 } |
445 else if (op_state.rate != 0 && op_state.nch != 0) | |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
446 op->close_audio(); |
2313 | 447 |
448 ret = op->open_audio(fmt, rate, nch); | |
449 | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
450 if (ret == 1) /* Success? */ |
2313 | 451 { |
4234 | 452 AUDDBG("opened audio: fmt=%d, rate=%d, nch=%d\n", fmt, rate, nch); |
2313 | 453 op_state.fmt = fmt; |
454 op_state.rate = rate; | |
455 op_state.nch = nch; | |
456 } | |
457 | |
458 return ret; | |
459 } | |
460 | |
461 void | |
462 output_write_audio(gpointer ptr, gint length) | |
463 { | |
464 OutputPlugin *op = get_current_output_plugin(); | |
465 | |
466 /* Sanity check. */ | |
467 if (op == NULL) | |
468 return; | |
469 | |
470 op->write_audio(ptr, length); | |
471 } | |
472 | |
473 void | |
474 output_close_audio(void) | |
475 { | |
476 OutputPlugin *op = get_current_output_plugin(); | |
477 | |
4234 | 478 AUDDBG("\n"); |
479 | |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
480 #ifdef USE_SRC |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
481 freeSRC(); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
482 #endif |
4234 | 483 freeSAD(); |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
484 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
485 AUDDBG("clearing RG settings\n"); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
486 replay_gain_info.track_gain = 0.0; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
487 replay_gain_info.track_peak = 0.0; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
488 replay_gain_info.album_gain = 0.0; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
489 replay_gain_info.album_peak = 0.0; |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
490 |
2313 | 491 /* Do not close if there are still songs to play and the user has |
492 * not requested a stop. --nenolod | |
493 */ | |
494 if (ip_data.stop == FALSE && | |
2673 | 495 (playlist_get_position_nolock(playlist_get_active()) < |
496 playlist_get_length(playlist_get_active()) - 1)) | |
2313 | 497 return; |
498 | |
499 /* Sanity check. */ | |
500 if (op == NULL) | |
501 return; | |
502 | |
503 op->close_audio(); | |
504 | |
505 /* Reset the op_state. */ | |
506 op_state.fmt = op_state.rate = op_state.nch = 0; | |
507 } | |
508 | |
509 void | |
510 output_flush(gint time) | |
511 { | |
512 OutputPlugin *op = get_current_output_plugin(); | |
513 | |
514 if (op == NULL) | |
515 return; | |
516 | |
517 op->flush(time); | |
518 } | |
519 | |
520 void | |
521 output_pause(gshort paused) | |
522 { | |
523 OutputPlugin *op = get_current_output_plugin(); | |
524 | |
525 if (op == NULL) | |
526 return; | |
527 | |
528 op->pause(paused); | |
529 } | |
530 | |
531 gint | |
532 output_buffer_free(void) | |
533 { | |
534 OutputPlugin *op = get_current_output_plugin(); | |
535 | |
536 if (op == NULL) | |
537 return 0; | |
538 | |
539 return op->buffer_free(); | |
540 } | |
541 | |
542 gint | |
543 output_buffer_playing(void) | |
544 { | |
545 OutputPlugin *op = get_current_output_plugin(); | |
546 | |
547 if (op == NULL) | |
548 return 0; | |
549 | |
550 return op->buffer_playing(); | |
551 } | |
552 | |
553 /* called by input plugin when data is ready */ | |
554 void | |
3709
a89a12aa4f2c
Add InputPlayback::pass_audio() which replaces produce_audio().
William Pitcock <nenolod@atheme.org>
parents:
3708
diff
changeset
|
555 output_pass_audio(InputPlayback *playback, |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
556 AFormat fmt, /* output format */ |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
557 gint nch, /* channels */ |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
558 gint length, /* length of sample */ |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
559 gpointer ptr, /* data */ |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
560 int *going /* 0 when time to stop */ |
2313 | 561 ) |
562 { | |
3553
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
563 static Flow *postproc_flow = NULL; |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
564 static Flow *legacy_flow = NULL; |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
565 OutputPlugin *op = playback->output; |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
566 gint writeoffs; |
4234 | 567 |
568 if (length <= 0) return; | |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
569 gint time = playback->output->written_time(); |
2313 | 570 |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
571 if (legacy_flow == NULL) |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
572 { |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
573 legacy_flow = flow_new(); |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
574 flow_link_element(legacy_flow, iir_flow); |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
575 flow_link_element(legacy_flow, effect_flow); |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
576 flow_link_element(legacy_flow, volumecontrol_flow); |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
577 } |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
578 |
3553
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
579 if (postproc_flow == NULL) |
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
580 { |
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
581 postproc_flow = flow_new(); |
3559 | 582 flow_link_element(postproc_flow, vis_flow); |
3553
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
583 } |
a140fadd741d
software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents:
3549
diff
changeset
|
584 |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
585 #ifdef USE_SRC |
4234 | 586 if(src_state != NULL) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
587 { |
4258
8157686b8115
added FMT_SIZEOF macro
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
588 int lrLength = length / FMT_SIZEOF(fmt); |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
589 int overLrLength = (int)floor(lrLength*(src_data.src_ratio+1)); |
2648
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
590 if(lengthOfSrcIn < lrLength) |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
591 { |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
592 lengthOfSrcIn = lrLength; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
593 free(srcIn); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
594 srcIn = (float*)malloc(sizeof(float)*lrLength); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
595 } |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
596 if(lengthOfSrcOut < overLrLength) |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
597 { |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
598 lengthOfSrcOut = overLrLength; |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
599 free(srcOut); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
600 free(wOut); |
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
601 srcOut = (float*)malloc(sizeof(float)*overLrLength); |
4258
8157686b8115
added FMT_SIZEOF macro
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
602 wOut = (short int*)malloc(FMT_SIZEOF(op_state.fmt) * overLrLength); |
2648
51495131e4ae
[svn] - synchronize SRC conversion patch with upstream
nenolod
parents:
2542
diff
changeset
|
603 } |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
604 |
4234 | 605 SAD_dither_process_buffer(sad_state_to_float, ptr, srcIn, lrLength / nch); |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
606 /*flow_execute(postproc_flow, time, &srcIn, lrLength * sizeof(float), FMT_FLOAT, op_state.rate, nch);*/ /*FIXME*/ |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
607 |
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
608 |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
609 src_data.data_in = srcIn; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
610 src_data.data_out = srcOut; |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
611 src_data.end_of_input = 0; |
4186
833e5faa5847
Make sample rate conversion work with mono files. (Bugzilla #88)
William Pitcock <nenolod@atheme.org>
parents:
3984
diff
changeset
|
612 src_data.input_frames = lrLength / nch; |
833e5faa5847
Make sample rate conversion work with mono files. (Bugzilla #88)
William Pitcock <nenolod@atheme.org>
parents:
3984
diff
changeset
|
613 src_data.output_frames = overLrLength / nch; |
2542 | 614 if ((srcError = src_process(src_state, &src_data)) > 0) |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
615 { |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
616 fprintf(stderr, "src_process(): %s\n", src_strerror(srcError)); |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
617 } |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
618 else |
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
619 { |
4234 | 620 SAD_dither_process_buffer(sad_state_from_float, srcOut, wOut, src_data.output_frames_gen); |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
621 ptr = wOut; |
4258
8157686b8115
added FMT_SIZEOF macro
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
622 length = src_data.output_frames_gen * op_state.nch * FMT_SIZEOF(op_state.fmt); |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
623 } |
4234 | 624 } else |
2538
719e0898ff3c
[svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents:
2373
diff
changeset
|
625 #endif |
4234 | 626 if(sad_state != NULL) { |
4258
8157686b8115
added FMT_SIZEOF macro
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
627 int frames = length / nch / FMT_SIZEOF(fmt); |
8157686b8115
added FMT_SIZEOF macro
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
628 int len = frames * op_state.nch * FMT_SIZEOF(op_state.fmt); |
4234 | 629 if(sad_out_buf == NULL || sad_out_buf_length < len ) { |
630 if(sad_out_buf != NULL) free (sad_out_buf); | |
631 sad_out_buf = malloc(len); | |
632 sad_out_buf_length = len; | |
633 } | |
634 SAD_dither_process_buffer(sad_state, ptr, sad_out_buf, frames); | |
635 ptr = sad_out_buf; | |
4235
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
636 length = len; |
4234 | 637 } |
638 | |
639 if (op_state.fmt == FMT_S16_NE || (op_state.fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || | |
640 (op_state.fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN)) { | |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
641 length = flow_execute(legacy_flow, time, &ptr, length, op_state.fmt, op_state.rate, op_state.nch); |
4234 | 642 } else { |
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4258
diff
changeset
|
643 AUDDBG("legacy_flow can deal only with S16_NE streams\n"); /*FIXME*/ |
4234 | 644 } |
3546
fd4cd1945b91
Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents:
3486
diff
changeset
|
645 |
2313 | 646 writeoffs = 0; |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
647 while (writeoffs < length) |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
648 { |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
649 int writable = length - writeoffs; |
2313 | 650 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
651 if (writable > 2048) |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
652 writable = 2048; |
2313 | 653 |
2813
49f3d1b43518
[svn] - code cleanups involving SRC patch and indentation
nenolod
parents:
2811
diff
changeset
|
654 if (writable == 0) |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
655 return; |
2313 | 656 |
3486
96baf555b449
Get rid of "XMMS Multiple Effect Plugin support" hack. Effects processing is handled in produce_audio() now days.
William Pitcock <nenolod@atheme.org>
parents:
3437
diff
changeset
|
657 while (op->buffer_free() < writable) /* wait output buf */ |
96baf555b449
Get rid of "XMMS Multiple Effect Plugin support" hack. Effects processing is handled in produce_audio() now days.
William Pitcock <nenolod@atheme.org>
parents:
3437
diff
changeset
|
658 { |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
659 GTimeVal pb_abs_time; |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
660 |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
661 g_get_current_time(&pb_abs_time); |
4230
b3e82a1eb129
Experimental patch to fix pulseaudio deficencies by sleeping 10000us.
William Pitcock <nenolod@atheme.org>
parents:
4186
diff
changeset
|
662 g_time_val_add(&pb_abs_time, 10000); |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
663 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
664 if (going && !*going) /* thread stopped? */ |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
665 return; /* so finish */ |
2313 | 666 |
3486
96baf555b449
Get rid of "XMMS Multiple Effect Plugin support" hack. Effects processing is handled in produce_audio() now days.
William Pitcock <nenolod@atheme.org>
parents:
3437
diff
changeset
|
667 if (ip_data.stop) /* has a stop been requested? */ |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
668 return; /* yes, so finish */ |
2313 | 669 |
3680
6615978ca88c
Instead of waiting 10ms, wait half the time of the period buffer.
William Pitcock <nenolod@atheme.org>
parents:
3560
diff
changeset
|
670 /* else sleep for retry */ |
3696
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
671 g_mutex_lock(playback->pb_change_mutex); |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
672 g_cond_timed_wait(playback->pb_change_cond, playback->pb_change_mutex, &pb_abs_time); |
418ac922ce87
Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents:
3686
diff
changeset
|
673 g_mutex_unlock(playback->pb_change_mutex); |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
674 } |
2313 | 675 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
676 if (ip_data.stop) |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
677 return; |
2313 | 678 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
679 if (going && !*going) /* thread stopped? */ |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
680 return; /* so finish */ |
2313 | 681 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
682 /* do output */ |
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
683 op->write_audio(((guint8 *) ptr) + writeoffs, writable); |
2313 | 684 |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2328
diff
changeset
|
685 writeoffs += writable; |
2313 | 686 } |
687 } | |
4235
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
688 |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
689 /* called by input plugin when RG info available --asphyx */ |
4235
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
690 void |
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
691 output_set_replaygain_info (InputPlayback *pb, ReplayGainInfo *rg_info) |
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
692 { |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
693 replay_gain_info = *rg_info; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
694 apply_replaygain_info(rg_info); |
4235
2d4b4f13d10d
set_replaygain_info added to PAPI
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
695 } |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
696 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
697 static void |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
698 apply_replaygain_info (ReplayGainInfo *rg_info) |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
699 { |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
700 SAD_replaygain_mode mode; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
701 SAD_replaygain_info info; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
702 /*ConfigDb *db;*/ |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
703 gboolean rg_enabled; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
704 gboolean album_mode; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
705 SAD_dither_t *active_state; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
706 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
707 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
708 if(sad_state == NULL && sad_state_from_float == NULL) { |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
709 AUDDBG("SAD not initialized!\n"); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
710 return; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
711 } |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
712 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
713 rg_enabled = cfg.enable_replay_gain; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
714 album_mode = cfg.replay_gain_album; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
715 mode.clipping_prevention = cfg.enable_clipping_prevention; |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4247
diff
changeset
|
716 mode.hard_limit = FALSE; |
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4247
diff
changeset
|
717 mode.adaptive_scaler = cfg.enable_adaptive_scaler; |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
718 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
719 if(!rg_enabled) return; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
720 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
721 mode.mode = album_mode ? SAD_RG_ALBUM : SAD_RG_TRACK; |
4242
21008f43bb93
RG improved. It f... works.
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4240
diff
changeset
|
722 mode.preamp = cfg.replay_gain_preamp; |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
723 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
724 info.present = TRUE; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
725 info.track_gain = rg_info->track_gain; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
726 info.track_peak = rg_info->track_peak; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
727 info.album_gain = rg_info->album_gain; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
728 info.album_peak = rg_info->album_peak; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
729 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
730 AUDDBG("Applying Replay Gain settings:\n"); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
731 AUDDBG("* mode: %s\n", mode.mode == SAD_RG_ALBUM ? "album" : "track"); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
732 AUDDBG("* clipping prevention: %s\n", mode.clipping_prevention ? "yes" : "no"); |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4247
diff
changeset
|
733 AUDDBG("* adaptive scaler %s\n", mode.adaptive_scaler ? "yes" : "no"); |
4237
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
734 AUDDBG("* preamp: %+f dB\n", mode.preamp); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
735 AUDDBG("Replay Gain info for current track:\n"); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
736 AUDDBG("* track gain: %+f dB\n", info.track_gain); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
737 AUDDBG("* track peak: %f\n", info.track_peak); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
738 AUDDBG("* album gain: %+f dB\n", info.album_gain); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
739 AUDDBG("* album peak: %f\n", info.album_peak); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
740 |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
741 active_state = sad_state != NULL ? sad_state : sad_state_from_float; |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
742 SAD_dither_apply_replaygain(active_state, &info, &mode); |
8f6956130372
initial Replay Gain support
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4235
diff
changeset
|
743 } |