annotate src/audacious/output.c @ 4230:b3e82a1eb129

Experimental patch to fix pulseaudio deficencies by sleeping 10000us.
author William Pitcock <nenolod@atheme.org>
date Fri, 01 Feb 2008 13:15:05 -0600
parents 833e5faa5847
children 58bc8f042f69
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious team
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
27 # include "config.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
28 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
29
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
30 #include "output.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
31 #include "iir.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
32 #include "main.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
33 #include "input.h"
2328
d88558b0de0a [svn] - Added script for migration to XDG basedir.
js
parents: 2313
diff changeset
34 #include "playback.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
35
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
36 #include "playlist.h"
2717
6884a2144a01 [svn] - make audacious build again
nenolod
parents: 2673
diff changeset
37 #include "configdb.h"
2542
ef01234ae265 [svn] - ppc64 warning fixes for upsampling patch
nenolod
parents: 2538
diff changeset
38
3553
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
39 #include "flow.h"
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
40
2811
1c7ee5ed3a10 [svn] Move effect plugin handling into the main thread
ertzing
parents: 2717
diff changeset
41 #include "effect.h"
3546
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
42 #include "volumecontrol.h"
3559
0898b8139af8 Vis -> Flow API.
William Pitcock <nenolod@atheme.org>
parents: 3558
diff changeset
43 #include "visualization.h"
2811
1c7ee5ed3a10 [svn] Move effect plugin handling into the main thread
ertzing
parents: 2717
diff changeset
44
2542
ef01234ae265 [svn] - ppc64 warning fixes for upsampling patch
nenolod
parents: 2538
diff changeset
45 #include <math.h>
ef01234ae265 [svn] - ppc64 warning fixes for upsampling patch
nenolod
parents: 2538
diff changeset
46
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
47 #ifdef USE_SRC
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
48 #include <samplerate.h>
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
49 #endif
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
50
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
51 OutputPluginData op_data = {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
52 NULL,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
53 NULL
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
54 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
55
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
56 OutputPluginState op_state = {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
57 0,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
58 0,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
59 0
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 OutputPlugin psuedo_output_plugin = {
3549
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
63 .description = "XMMS reverse compatibility output plugin",
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
64 .get_volume = output_get_volume,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
65 .set_volume = output_set_volume,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
66
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
67 .open_audio = output_open_audio,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
68 .write_audio = output_write_audio,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
69 .close_audio = output_close_audio,
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
70
3549
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
71 .flush = output_flush,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
72 .pause = output_pause,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
73
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
74 .buffer_free = output_buffer_free,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
75 .buffer_playing = output_buffer_playing,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
76 .output_time = get_output_time,
a5b1084e7f38 C99 initialisers
William Pitcock <nenolod@atheme.org>
parents: 3546
diff changeset
77 .written_time = get_written_time,
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
78 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
79
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
80 OutputPlugin *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
81 get_current_output_plugin(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
82 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
83 return op_data.current_output_plugin;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
84 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
85
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
86 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
87 set_current_output_plugin(gint i)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
88 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
89 gboolean playing;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
90 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
91
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
92 GList *node = g_list_nth(op_data.output_list, i);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
93 if (!node) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
94 op_data.current_output_plugin = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
95 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
96 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
97
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
98 op_data.current_output_plugin = node->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
99
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
100 playing = playback_get_playing();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
101
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
102 if (playing == TRUE)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
103 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
104 guint time, pos;
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
105 PlaylistEntry *entry;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
106
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
107 /* don't stop yet, get the seek time and playlist position first */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
108 pos = playlist_get_position(playlist_get_active());
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
109 time = op->output_time();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
110
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
111 /* reset the audio system */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
112 mainwin_stop_pushed();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
113 op->close_audio();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
114
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
115 g_usleep(300000);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
116
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
117 /* wait for the playback thread to come online */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
118 while (playback_get_playing())
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
119 g_message("waiting for audio system shutdown...");
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
120
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
121 /* wait for the playback thread to come online */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
122 playlist_set_position(playlist_get_active(), pos);
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
123 entry = playlist_get_entry_to_play(playlist_get_active());
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
124 playback_play_file(entry);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
125
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
126 while (!playback_get_playing())
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
127 {
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
128 gtk_main_iteration();
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
129 g_message("waiting for audio system startup...");
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
130 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
131
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
132 /* and signal a reseek */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
133 if (playlist_get_current_length(playlist_get_active()) > -1 &&
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
134 time <= (playlist_get_current_length(playlist_get_active())))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
135 playback_seek(time / 1000);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
136 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
137 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
138
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
139 GList *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
140 get_output_list(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
141 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
142 return op_data.output_list;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
143 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
144
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
145 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
146 output_about(gint i)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
147 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
148 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
149 if (out && out->about)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
150 out->about();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
151 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
152
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
153 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
154 output_configure(gint i)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
155 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
156 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
157 if (out && out->configure)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
158 out->configure();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
159 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
160
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
161 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
162 output_get_volume(gint * l, gint * r)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
163 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
164 *l = *r = -1;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
165
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
166 if (!op_data.current_output_plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
167 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
168
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
169 if (!op_data.current_output_plugin->get_volume)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
170 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
171
3546
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
172 if (cfg.software_volume_control)
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
173 volumecontrol_get_volume_state(l, r);
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
174 else
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
175 op_data.current_output_plugin->get_volume(l, r);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
176 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
177
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
178 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
179 output_set_volume(gint l, gint r)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
180 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
181 if (!op_data.current_output_plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
182 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
183
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
184 if (!op_data.current_output_plugin->set_volume)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
185 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
186
3546
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
187 if (cfg.software_volume_control)
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
188 volumecontrol_set_volume_state(l, r);
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
189 else
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
190 op_data.current_output_plugin->set_volume(l, r);
2313
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 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
194 output_set_eq(gboolean active, gfloat pre, gfloat * bands)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
195 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
196 int i;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
197 preamp[0] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
198 preamp[1] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
199
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
200 for (i = 0; i < 10; ++i)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
201 {
2813
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
202 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
203 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
204 }
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 /* called by input plugin to peek at the output plugin's write progress */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
208 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
209 get_written_time(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
210 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
211 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
212
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
213 return op->written_time();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
214 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
215
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
216 /* called by input plugin to peek at the output plugin's output progress */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
217 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
218 get_output_time(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
219 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
220 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
221
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
222 return op->output_time();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
223 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
224
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
225 #ifdef USE_SRC
2813
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
226
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
227 static SRC_STATE *src_state;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
228 static SRC_DATA src_data;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
229 static int overSamplingFs = 96000;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
230 static int converter_type = SRC_SINC_BEST_QUALITY;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
231 static int srcError = 0;
2648
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
232
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
233 static float *srcIn = NULL, *srcOut = NULL;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
234 static short int *wOut = NULL;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
235 static int lengthOfSrcIn = 0;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
236 static int lengthOfSrcOut = 0;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
237
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
238 static void freeSRC()
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
239 {
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
240 if(src_state != NULL)
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
241 src_state = src_delete(src_state);
2648
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
242 free(srcIn);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
243 free(srcOut);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
244 free(wOut);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
245 srcIn = NULL;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
246 srcOut = NULL;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
247 wOut = NULL;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
248 lengthOfSrcIn = 0;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
249 lengthOfSrcOut = 0;
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
250 }
2813
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
251
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
252 #endif
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
253
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
254 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
255 output_open_audio(AFormat fmt, gint rate, gint nch)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
256 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
257 gint ret;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
258 OutputPlugin *op;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
259
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
260 #ifdef USE_SRC
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
261 ConfigDb *db;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
262 gboolean src_enabled;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
263 gint src_rate, src_type;
3686
259b7d3e0976 sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents: 3681
diff changeset
264 db = cfg_db_open();
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
265
3686
259b7d3e0976 sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents: 3681
diff changeset
266 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
267 src_enabled = FALSE;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
268
3686
259b7d3e0976 sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents: 3681
diff changeset
269 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
270 overSamplingFs = 48000;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
271 else
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
272 overSamplingFs = src_rate;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
273
2649
153dc928115a [svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents: 2648
diff changeset
274 /* 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
275 if (rate == overSamplingFs)
153dc928115a [svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents: 2648
diff changeset
276 src_enabled = FALSE;
153dc928115a [svn] - don't resample if source rate matches the internal clock rate. closes #881.
nenolod
parents: 2648
diff changeset
277
3686
259b7d3e0976 sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents: 3681
diff changeset
278 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
279 converter_type = SRC_SINC_BEST_QUALITY;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
280 else
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
281 converter_type = src_type;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
282
3686
259b7d3e0976 sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents: 3681
diff changeset
283 cfg_db_close(db);
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
284
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
285 freeSRC();
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
286
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
287 if(src_enabled&&
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
288 (fmt == FMT_S16_NE||(fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN)||
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
289 (fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN)))
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
290 {
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
291 src_state = src_new(converter_type, nch, &srcError);
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
292 if (src_state != NULL)
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 src_data.src_ratio = (float)overSamplingFs/(float)rate;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
295 rate = overSamplingFs;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
296 }
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
297 else
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
298 fprintf(stderr, "src_new(): %s\n\n", src_strerror(srcError));
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
299 }
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
300 #endif
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
301
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
302 op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
303
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
304 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
305 return -1;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
306
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
307 /* Is our output port already open? */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
308 if ((op_state.rate != 0 && op_state.nch != 0) &&
2813
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
309 (op_state.rate == rate && op_state.nch == nch && op_state.fmt == fmt))
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
310 {
2813
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
311 /* Yes, and it's the correct sampling rate. Reset the counter and go. */
49f3d1b43518 [svn] - code cleanups involving SRC patch and indentation
nenolod
parents: 2811
diff changeset
312 op->flush(0);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
313 return 1;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
314 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
315 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
316 op->close_audio();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
317
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
318 ret = op->open_audio(fmt, rate, nch);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
319
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
320 if (ret == 1) /* Success? */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
321 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
322 op_state.fmt = fmt;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
323 op_state.rate = rate;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
324 op_state.nch = nch;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
325 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
326
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
327 return ret;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
328 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
329
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
330 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
331 output_write_audio(gpointer ptr, gint length)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
332 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
333 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
334
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
335 /* Sanity check. */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
336 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
337 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
338
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
339 op->write_audio(ptr, length);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
340 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
341
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
342 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
343 output_close_audio(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
344 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
345 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
346
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
347 #ifdef USE_SRC
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
348 freeSRC();
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
349 #endif
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
350
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
351 /* Do not close if there are still songs to play and the user has
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
352 * not requested a stop. --nenolod
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
353 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
354 if (ip_data.stop == FALSE &&
2673
82e24035fdf8 [svn] - chase r4368.
nenolod
parents: 2649
diff changeset
355 (playlist_get_position_nolock(playlist_get_active()) <
82e24035fdf8 [svn] - chase r4368.
nenolod
parents: 2649
diff changeset
356 playlist_get_length(playlist_get_active()) - 1))
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
357 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
358
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
359 /* Sanity check. */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
360 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
361 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
362
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
363 op->close_audio();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
364
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
365 /* Reset the op_state. */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
366 op_state.fmt = op_state.rate = op_state.nch = 0;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
367 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
368
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
369 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
370 output_flush(gint time)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
371 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
372 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
373
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
374 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
375 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
376
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
377 op->flush(time);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
378 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
379
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
380 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
381 output_pause(gshort paused)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
382 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
383 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
384
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
385 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
386 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
387
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
388 op->pause(paused);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
389 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
390
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
391 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
392 output_buffer_free(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
393 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
394 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
395
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
396 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
397 return 0;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
398
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
399 return op->buffer_free();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
400 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
401
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
402 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
403 output_buffer_playing(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
404 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
405 OutputPlugin *op = get_current_output_plugin();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
406
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
407 if (op == NULL)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
408 return 0;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
409
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
410 return op->buffer_playing();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
411 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
412
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
413 /* called by input plugin when data is ready */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
414 void
3709
a89a12aa4f2c Add InputPlayback::pass_audio() which replaces produce_audio().
William Pitcock <nenolod@atheme.org>
parents: 3708
diff changeset
415 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
416 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
417 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
418 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
419 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
420 int *going /* 0 when time to stop */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
421 )
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
422 {
3553
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
423 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
424 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
425 gint writeoffs;
418ac922ce87 Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
426 gint time = playback->output->written_time();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
427
3553
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
428 if (postproc_flow == NULL)
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
429 {
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
430 postproc_flow = flow_new();
3560
154f21dcd61e equalizer -> flow API
William Pitcock <nenolod@atheme.org>
parents: 3559
diff changeset
431 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
432 flow_link_element(postproc_flow, effect_flow);
3559
0898b8139af8 Vis -> Flow API.
William Pitcock <nenolod@atheme.org>
parents: 3558
diff changeset
433 flow_link_element(postproc_flow, vis_flow);
3553
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
434 flow_link_element(postproc_flow, volumecontrol_flow);
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
435 }
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3549
diff changeset
436
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
437 #ifdef USE_SRC
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
438 if(src_state != NULL&&length > 0)
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
439 {
4186
833e5faa5847 Make sample rate conversion work with mono files. (Bugzilla #88)
William Pitcock <nenolod@atheme.org>
parents: 3984
diff changeset
440 int lrLength = length / nch;
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
441 int overLrLength = (int)floor(lrLength*(src_data.src_ratio+1));
2648
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
442 if(lengthOfSrcIn < lrLength)
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
443 {
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
444 lengthOfSrcIn = lrLength;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
445 free(srcIn);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
446 srcIn = (float*)malloc(sizeof(float)*lrLength);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
447 }
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
448 if(lengthOfSrcOut < overLrLength)
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
449 {
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
450 lengthOfSrcOut = overLrLength;
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
451 free(srcOut);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
452 free(wOut);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
453 srcOut = (float*)malloc(sizeof(float)*overLrLength);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
454 wOut = (short int*)malloc(sizeof(short int)*overLrLength);
51495131e4ae [svn] - synchronize SRC conversion patch with upstream
nenolod
parents: 2542
diff changeset
455 }
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
456 src_short_to_float_array((short int*)ptr, srcIn, lrLength);
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
457 src_data.data_in = srcIn;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
458 src_data.data_out = srcOut;
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
459 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
460 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
461 src_data.output_frames = overLrLength / nch;
2542
ef01234ae265 [svn] - ppc64 warning fixes for upsampling patch
nenolod
parents: 2538
diff changeset
462 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
463 {
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
464 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
465 }
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
466 else
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
467 {
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
468 src_float_to_short_array(srcOut, wOut, src_data.output_frames_gen*2);
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
469 ptr = wOut;
4186
833e5faa5847 Make sample rate conversion work with mono files. (Bugzilla #88)
William Pitcock <nenolod@atheme.org>
parents: 3984
diff changeset
470 length = src_data.output_frames_gen * (nch * 2);
2538
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
471 }
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
472 }
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
473 #endif
719e0898ff3c [svn] - Patch to use libsamplerate for high-quality interpolated upsampling,
nenolod
parents: 2373
diff changeset
474
3708
6f4068a0f291 make sndstretch work properly
William Pitcock <nenolod@atheme.org>
parents: 3696
diff changeset
475 length = flow_execute(postproc_flow, time, &ptr, length, op_state.fmt, op_state.rate, op_state.nch);
3546
fd4cd1945b91 Connect volumecontrol flow to the work pipeline.
William Pitcock <nenolod@atheme.org>
parents: 3486
diff changeset
476
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
477 writeoffs = 0;
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
478 while (writeoffs < length)
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
479 {
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
480 int writable = length - writeoffs;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
481
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
482 if (writable > 2048)
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
483 writable = 2048;
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 if (writable == 0)
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
486 return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
487
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
488 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
489 {
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
490 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
491
418ac922ce87 Use a mutex/condvar/timed wait to allow tickless operation in the output loop.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
492 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
493 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
494
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
495 if (going && !*going) /* thread stopped? */
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
496 return; /* so finish */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
497
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
498 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
499 return; /* yes, so finish */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
500
3680
6615978ca88c Instead of waiting 10ms, wait half the time of the period buffer.
William Pitcock <nenolod@atheme.org>
parents: 3560
diff changeset
501 /* 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
502 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
503 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
504 g_mutex_unlock(playback->pb_change_mutex);
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
505 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
506
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
507 if (ip_data.stop)
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
508 return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
509
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
510 if (going && !*going) /* thread stopped? */
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
511 return; /* so finish */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
512
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
513 /* do output */
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
514 op->write_audio(((guint8 *) ptr) + writeoffs, writable);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
515
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2328
diff changeset
516 writeoffs += writable;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
517 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
518 }