annotate audacious/output.c @ 1922:29d90d3f9680 trunk

[svn] - add feedback when the build_stamp is generated.
author nenolod
date Mon, 30 Oct 2006 14:01:32 -0800
parents def887eae029
children a99862e5bd65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include "output.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #include "iir.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include "main.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include "input.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include "playlist.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 #include "libaudacious/util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 OutputPluginData op_data = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 NULL,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 NULL
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
39 OutputPluginState op_state = {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
40 0,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
41 0,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
42 0
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
43 };
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
44
809
79da0e6ed790 [svn] - fix typo
nenolod
parents: 807
diff changeset
45 OutputPlugin psuedo_output_plugin = {
807
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
46 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
47 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
48 "XMMS reverse compatibility output plugin",
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
49 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
50 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
51 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
52 NULL,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
53 output_get_volume,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
54 output_set_volume,
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
55 output_open_audio,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
56 output_write_audio,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
57 output_close_audio,
807
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
58
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
59 output_flush,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
60 output_pause,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
61 output_buffer_free,
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
62 output_buffer_playing,
807
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
63 get_output_time,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
64 get_written_time,
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
65 NULL
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
66 };
df3412dc33c4 [svn] - add psuedo_output_plugin, a psuedo output plugin that will be used for reverse compatibility with old plugins.
nenolod
parents: 806
diff changeset
67
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 OutputPlugin *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 get_current_output_plugin(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 return op_data.current_output_plugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 set_current_output_plugin(gint i)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 #if 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 gint time;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 gint pos;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 gboolean playing;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 GList *node = g_list_nth(op_data.output_list, i);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 if (!node) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 op_data.current_output_plugin = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 op_data.current_output_plugin = node->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 #if 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 playing = bmp_playback_get_playing();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 if (playing) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 /* FIXME: we do all on our own here */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 guint min = 0, sec = 0, params, time, pos;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 gchar timestr[10];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 bmp_playback_pause();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 pos = get_playlist_position();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 time = bmp_playback_get_time() / 1000;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 g_snprintf(timestr, sizeof(timestr), "%u:%2.2u",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 time / 60, time % 60);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 params = sscanf(timestr, "%u:%u", &min, &sec);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 if (params == 2)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 time = (min * 60) + sec;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 else if (params == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 time = min;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 bmp_playback_stop();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 playlist_set_position(pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 bmp_playback_play_file(playlist_get_filename(pos));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 while (!bmp_playback_get_playing())
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 g_message("waiting...");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 if (playlist_get_current_length() > -1 &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 time <= (playlist_get_current_length() / 1000)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 /* Some time for things to cool down and heat up */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 g_usleep(1000000);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 bmp_playback_seek(time);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 GList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 get_output_list(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 return op_data.output_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 output_about(gint i)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 if (out && out->about)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 out->about();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 output_configure(gint i)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 OutputPlugin *out = g_list_nth(op_data.output_list, i)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 if (out && out->configure)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 out->configure();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 output_get_volume(gint * l, gint * r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 *l = *r = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 if (!op_data.current_output_plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 if (!op_data.current_output_plugin->get_volume)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 op_data.current_output_plugin->get_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 output_set_volume(gint l, gint r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 if (!op_data.current_output_plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 if (!op_data.current_output_plugin->set_volume)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 op_data.current_output_plugin->set_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 output_set_eq(gboolean active, gfloat pre, gfloat * bands)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 int i;
430
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
183 preamp[0] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
184 preamp[1] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
185
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 for (i = 0; i < 10; ++i)
430
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
187 {
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
188 set_gain(i, 0, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]);
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
189 set_gain(i, 1, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]);
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
190 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 /* this should be in BYTES, NOT gint16s */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 byteswap(size_t size,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 gint16 * buf)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 gint16 *it;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 size &= ~1; /* must be multiple of 2 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 for (it = buf; it < buf + size / 2; ++it)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 *(guint16 *) it = GUINT16_SWAP_LE_BE(*(guint16 *) it);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203
806
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
204 /* called by input plugin to peek at the output plugin's write progress */
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
205 gint
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
206 get_written_time(void)
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
207 {
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
208 OutputPlugin *op = get_current_output_plugin();
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
209
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
210 return op->written_time();
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
211 }
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
212
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
213 /* called by input plugin to peek at the output plugin's output progress */
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
214 gint
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
215 get_output_time(void)
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
216 {
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
217 OutputPlugin *op = get_current_output_plugin();
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
218
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
219 return op->output_time();
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
220 }
d51a251b542c [svn] - add get_written_time(), get_output_time().
nenolod
parents: 625
diff changeset
221
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
222 gint
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
223 output_open_audio(AFormat fmt, gint rate, gint nch)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
224 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
225 gint ret;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
226 OutputPlugin *op;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
227
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
228 op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
229
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
230 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
231 return -1;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
232
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
233 /* Is our output port already open? */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
234 if ((op_state.rate != 0 && op_state.nch != 0) &&
1768
def887eae029 [svn] - remove some old debugging notices
nenolod
parents: 1459
diff changeset
235 (op_state.rate == rate && op_state.nch == nch && op_state.fmt == fmt))
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
236 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
237 /* Yes, and it's the correct sampling rate. Reset the counter and go. */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
238 op->flush(0);
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
239 return 1;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
240 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
241 else if (op_state.rate != 0 && op_state.nch != 0)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
242 op->close_audio();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
243
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
244 ret = op->open_audio(fmt, rate, nch);
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
245
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
246 if (ret == 1) /* Success? */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
247 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
248 op_state.fmt = fmt;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
249 op_state.rate = rate;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
250 op_state.nch = nch;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
251 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
252
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
253 return ret;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
254 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
255
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
256 void
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
257 output_write_audio(gpointer ptr, gint length)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
258 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
259 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
260
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
261 /* Sanity check. */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
262 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
263 return;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
264
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
265 op->write_audio(ptr, length);
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
266 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
267
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
268 void
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
269 output_close_audio(void)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
270 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
271 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
272
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
273 /* Do not close if there are still songs to play and the user has
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
274 * not requested a stop. --nenolod
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
275 */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
276 if (ip_data.stop == FALSE &&
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
277 (playlist_get_position_nolock() < playlist_get_length_nolock() - 1))
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
278 return;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
279
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
280 /* Sanity check. */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
281 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
282 return;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
283
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
284 op->close_audio();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
285
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
286 /* Reset the op_state. */
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
287 op_state.fmt = op_state.rate = op_state.nch = 0;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
288 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
289
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
290 void
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
291 output_flush(gint time)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
292 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
293 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
294
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
295 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
296 return;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
297
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
298 op->flush(time);
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
299 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
300
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
301 void
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
302 output_pause(gshort paused)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
303 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
304 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
305
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
306 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
307 return;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
308
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
309 op->pause(paused);
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
310 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
311
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
312 gint
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
313 output_buffer_free(void)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
314 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
315 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
316
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
317 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
318 return 0;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
319
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
320 return op->buffer_free();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
321 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
322
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
323 gint
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
324 output_buffer_playing(void)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
325 {
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
326 OutputPlugin *op = get_current_output_plugin();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
327
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
328 if (op == NULL)
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
329 return 0;
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
330
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
331 return op->buffer_playing();
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
332 }
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 809
diff changeset
333
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 /* called by input plugin when data is ready */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336 produce_audio(gint time, /* position */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 AFormat fmt, /* output format */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 gint nch, /* channels */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 gint length, /* length of sample */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 gpointer ptr, /* data */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 int *going /* 0 when time to stop */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 )
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 static int init = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 int swapped = 0;
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 519
diff changeset
346 guint myorder = G_BYTE_ORDER == G_LITTLE_ENDIAN ? FMT_S16_LE : FMT_S16_BE;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 int caneq = (fmt == FMT_S16_NE || fmt == myorder);
518
6c28a04d1254 [svn] cleanup produce_audio() a bit.
nenolod
parents: 430
diff changeset
348 OutputPlugin *op = get_current_output_plugin();
929
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
349 int writeoffs;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 if (!caneq && cfg.equalizer_active) { /* wrong byte order */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 byteswap(length, ptr); /* so convert */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 ++swapped;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 ++caneq;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 } /* can eq now, mark swapd */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 else if (caneq && !cfg.equalizer_active) /* right order but no eq */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 caneq = 0; /* so don't eq */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 if (caneq) { /* if eq enab */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 if (!init) { /* if first run */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 init_iir(); /* then init eq */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 ++init;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364
430
67cd014f35a2 [svn] This commit rips out the old equalization engine with a dynamic engine
nenolod
parents: 0
diff changeset
365 iir(&ptr, length, nch);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 if (swapped) /* if was swapped */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 byteswap(length, ptr); /* swap back for output */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370
518
6c28a04d1254 [svn] cleanup produce_audio() a bit.
nenolod
parents: 430
diff changeset
371 /* do vis plugin(s) */
519
88e9a6a8336f [svn] whoever wrote output_to_audio() was a crackhead.
nenolod
parents: 518
diff changeset
372 input_add_vis_pcm(time, fmt, nch, length, ptr);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373
929
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
374 writeoffs = 0;
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
375 while (writeoffs < length) {
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
376 int writable = length - writeoffs;
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
377
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
378 if (writable > 2048)
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
379 writable = 2048;
518
6c28a04d1254 [svn] cleanup produce_audio() a bit.
nenolod
parents: 430
diff changeset
380
1051
6e95edd16b43 [svn] - if writable == 0 then bail out of produce_audio() instead of segfault
nenolod
parents: 1036
diff changeset
381 if (writable == 0)
6e95edd16b43 [svn] - if writable == 0 then bail out of produce_audio() instead of segfault
nenolod
parents: 1036
diff changeset
382 return;
6e95edd16b43 [svn] - if writable == 0 then bail out of produce_audio() instead of segfault
nenolod
parents: 1036
diff changeset
383
1036
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
384 while (op->buffer_free() < writable) { /* wait output buf */
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
385 if (going && !*going) /* thread stopped? */
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
386 return; /* so finish */
929
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
387
1036
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
388 if (ip_data.stop) /* has a stop been requested? */
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
389 return; /* yes, so finish */
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
390
976a54334538 [svn] - abort out of produce_audio if a stop has been requested
nenolod
parents: 929
diff changeset
391 g_usleep(10000); /* else sleep for retry */
929
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
392 }
518
6c28a04d1254 [svn] cleanup produce_audio() a bit.
nenolod
parents: 430
diff changeset
393
1053
86da433104a8 [svn] - add an additional ip_data.stop check
nenolod
parents: 1051
diff changeset
394 if (ip_data.stop)
86da433104a8 [svn] - add an additional ip_data.stop check
nenolod
parents: 1051
diff changeset
395 return;
86da433104a8 [svn] - add an additional ip_data.stop check
nenolod
parents: 1051
diff changeset
396
929
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
397 /* do output */
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
398 op->write_audio(((guint8 *) ptr) + writeoffs, writable);
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
399
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
400 writeoffs += writable;
54b23650fac1 [svn] - experimental produce-audio changes via shd of the UADE team
nenolod
parents: 890
diff changeset
401 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 }