annotate audacious/output.c @ 2085:472be23d11a1 trunk

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