annotate src/audacious/output.c @ 4258:8157686b8115

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