annotate src/adplug/adplug-xmms.cc @ 1677:f6f5603a0954

xmms_show_message() changed to audacious_info_dialog()
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Sep 2007 22:42:22 +0300
parents aee4ebea943a
children f35f9d6fcb6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 AdPlug/XMMS - AdPlug XMMS Plugin
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 Copyright (C) 2002, 2003 Simon Peter <dn.tlp@gmx.net>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 AdPlug/XMMS is free software; you can redistribute it and/or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 License as published by the Free Software Foundation; either
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 This plugin is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 Lesser General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 License along with this plugin; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19
528
4d8b92b55acf [svn] - add config.h includes where needed
nenolod
parents: 527
diff changeset
20 #ifdef HAVE_CONFIG_H
4d8b92b55acf [svn] - add config.h includes where needed
nenolod
parents: 527
diff changeset
21 # include "config.h"
4d8b92b55acf [svn] - add config.h includes where needed
nenolod
parents: 527
diff changeset
22 #endif
4d8b92b55acf [svn] - add config.h includes where needed
nenolod
parents: 527
diff changeset
23
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 #include <algorithm>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #include <sstream>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 #include <stdio.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #include <sys/types.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include <gtk/gtk.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #include "adplug.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include "emuopl.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 #include "silentopl.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include "players.h"
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
34 #include "audacious/i18n.h"
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
35 extern "C"
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
36 {
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
37 #include "audacious/configdb.h"
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
38 #include "audacious/plugin.h"
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include "audacious/output.h"
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
40 #include "audacious/util.h"
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
43
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44 /***** Defines *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
46 // Version string
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 #define ADPLUG_NAME "AdPlug (AdLib Sound Player)"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 // Sound buffer size in samples
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 #define SNDBUFSIZE 512
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 // AdPlug's 8 and 16 bit audio formats
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53 #define FORMAT_8 FMT_U8
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
54 #define FORMAT_16 FMT_S16_NE
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
55
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
56 // Default file name of AdPlug's database file
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57 #define ADPLUGDB_FILE "adplug.db"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
58
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
59 // Default AdPlug user's configuration subdirectory
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
60 #define ADPLUG_CONFDIR ".adplug"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
61
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
62 /***** Global variables *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
64 extern "C" InputPlugin adplug_ip;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
65 static gboolean audio_error = FALSE;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
66 GtkWidget *about_win = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
67
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
68 // Configuration (and defaults)
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
69 static struct
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
70 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
71 gint freq;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
72 gboolean bit16, stereo, endless;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
73 CPlayers players;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
74 } cfg =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
75 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
76 44100l, true, false, false, CAdPlug::players};
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
77
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
78 // Player variables
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
79 static struct
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
80 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
81 CPlayer *p;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
82 CAdPlugDatabase *db;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
83 unsigned int subsong, songlength;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
84 int seek;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
85 char filename[PATH_MAX];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
86 char *songtitle;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
87 float time_ms;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
88 bool playing;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
89 GThread *play_thread;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
90 GtkLabel *infobox;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
91 GtkDialog *infodlg;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
92 } plr =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
93 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
94 0, 0, 0, 0, -1, "", NULL, 0.0f, false, 0, NULL, NULL};
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
95
559
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
96 static InputPlayback *playback;
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
97
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
98 // XXX: this function is not in the public API yet.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
99 extern "C" VFSFile * vfs_buffered_file_new_from_uri (gchar * uri);
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
100
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
101 /***** Debugging *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
103 #ifdef DEBUG
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105 #include <stdarg.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
107 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
108 dbg_printf (const char *fmt, ...)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
109 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110 va_list argptr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
111
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
112 va_start (argptr, fmt);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
113 vfprintf (stderr, fmt, argptr);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
114 va_end (argptr);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
117 #else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
118
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
119 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
120 dbg_printf (const char *fmt, ...)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
121 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
122 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
123
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
124 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126 /***** [Dialog]: Utility functions *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
127
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
128 static GtkWidget *
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
129 make_framed (GtkWidget * what, const gchar * label)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
130 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
131 GtkWidget *framebox = gtk_frame_new (label);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
132
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
133 gtk_container_add (GTK_CONTAINER (framebox), what);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
134 return framebox;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
135 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
136
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
137 static GtkWidget *
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
138 print_left (const gchar * text)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
139 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
140 GtkLabel *label = GTK_LABEL (gtk_label_new (text));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
142 gtk_label_set_justify (label, GTK_JUSTIFY_LEFT);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
143 gtk_misc_set_padding (GTK_MISC (label), 2, 2);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
144 return GTK_WIDGET (label);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
147 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
148 MessageBox (const char *title, const char *text, const char *button)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
150 char *tmptitle = (char *) malloc (strlen (title) + 1),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
151 *tmptxt = (char *) malloc (strlen (text) + 1),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
152 *tmpbutton = (char *) malloc (strlen (button) + 1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
153
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
154 strcpy (tmptitle, title);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
155 strcpy (tmptxt, text);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
156 strcpy (tmpbutton, button);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
157
1677
f6f5603a0954 xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents: 1676
diff changeset
158 GtkWidget *msgbox = audacious_info_dialog (tmptitle, tmptxt, tmpbutton, FALSE,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
159 G_CALLBACK (gtk_widget_destroyed),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
160 &msgbox);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
161
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
162 free (tmptitle);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
163 free (tmptxt);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
164 free (tmpbutton);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
165 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
166
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
167 /***** Dialog boxes *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
168
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
169 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
170 adplug_about (void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
171 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
172 if (!about_win)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
174 gchar *about_title = g_strjoin ("", _("About "), ADPLUG_NAME, NULL);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
175 const gchar *version_text = CAdPlug::get_version ().c_str ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
176 gchar *about_text = g_strjoin ("", ADPLUG_NAME,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
177 _
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
178 ("\nCopyright (C) 2002, 2003 Simon Peter <dn.tlp@gmx.net>\n\n"
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
179 "This plugin is released under the terms and conditions of the GNU LGPL.\n"
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
180 "See http://www.gnu.org/licenses/lgpl.html for details."
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
181 "\n\nThis plugin uses the AdPlug library, which is copyright (C) Simon Peter, et al.\n"
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
182 "Linked AdPlug library version: "),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
183 version_text, NULL);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
184 about_win =
1677
f6f5603a0954 xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents: 1676
diff changeset
185 audacious_info_dialog (about_title, about_text, _("Ok"), FALSE, NULL, NULL);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
186 g_signal_connect (G_OBJECT (about_win), "destroy",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
187 G_CALLBACK (gtk_widget_destroyed), &about_win);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
188 g_free (about_text);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
189 g_free (about_title);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
190 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
191 gtk_widget_show (about_win);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
192 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
193
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
194 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
195 close_config_box_ok (GtkButton * button, GPtrArray * rblist)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
196 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
197 // Apply configuration settings
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
198 cfg.bit16 =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
199 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
200 (g_ptr_array_index (rblist, 0)));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
201 cfg.stereo =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
202 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
203 (g_ptr_array_index (rblist, 1)));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
205 if (gtk_toggle_button_get_active
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
206 (GTK_TOGGLE_BUTTON (g_ptr_array_index (rblist, 2))))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
207 cfg.freq = 11025;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
208 if (gtk_toggle_button_get_active
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
209 (GTK_TOGGLE_BUTTON (g_ptr_array_index (rblist, 3))))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
210 cfg.freq = 22050;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
211 if (gtk_toggle_button_get_active
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
212 (GTK_TOGGLE_BUTTON (g_ptr_array_index (rblist, 4))))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
213 cfg.freq = 44100;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
214 if (gtk_toggle_button_get_active
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
215 (GTK_TOGGLE_BUTTON (g_ptr_array_index (rblist, 5))))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
216 cfg.freq = 48000;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
218 cfg.endless =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
219 !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
220 (g_ptr_array_index (rblist, 6)));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
221
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
222 cfg.players = *(CPlayers *) g_ptr_array_index (rblist, 7);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
223 delete (CPlayers *) g_ptr_array_index (rblist, 7);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
224
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
225 g_ptr_array_free (rblist, FALSE);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
226 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
227
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
228 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
229 close_config_box_cancel (GtkButton * button, GPtrArray * rblist)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
230 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
231 delete (CPlayers *) g_ptr_array_index (rblist, 7);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
232 g_ptr_array_free (rblist, FALSE);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
233 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
234
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
235 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
236 config_fl_row_select (GtkCList * fl, gint row, gint col,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
237 GdkEventButton * event, CPlayers * pl)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
238 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
239 pl->push_back ((CPlayerDesc *) gtk_clist_get_row_data (fl, row));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
240 pl->unique ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
241 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
242
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
243 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
244 config_fl_row_unselect (GtkCList * fl, gint row, gint col,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
245 GdkEventButton * event, CPlayers * pl)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
246 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
247 pl->remove ((CPlayerDesc *) gtk_clist_get_row_data (fl, row));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
248 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
249
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
250 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
251 adplug_config (void)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
252 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
253 GtkDialog *config_dlg = GTK_DIALOG (gtk_dialog_new ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
254 GtkNotebook *notebook = GTK_NOTEBOOK (gtk_notebook_new ());
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
255 GtkTable *table;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
256 GtkTooltips *tooltips = gtk_tooltips_new ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
257 GPtrArray *rblist = g_ptr_array_new ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
258
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
259 gtk_window_set_title (GTK_WINDOW (config_dlg), _("AdPlug :: Configuration"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
260 gtk_window_set_policy (GTK_WINDOW (config_dlg), FALSE, FALSE, TRUE); // Window is auto sized
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
261 gtk_window_set_modal (GTK_WINDOW (config_dlg), TRUE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
262 gtk_container_add (GTK_CONTAINER (config_dlg->vbox), GTK_WIDGET (notebook));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
263
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
264 // Add Ok & Cancel buttons
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
265 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
266 GtkWidget *button;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
267
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
268 button = gtk_button_new_with_label (_("Ok"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
269 g_signal_connect (G_OBJECT (button), "clicked",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
270 G_CALLBACK (close_config_box_ok), (gpointer) rblist);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
271 g_signal_connect_data (G_OBJECT (button), "clicked",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
272 G_CALLBACK (gtk_widget_destroy),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
273 GTK_OBJECT (config_dlg), NULL,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
274 (GConnectFlags) (G_CONNECT_AFTER |
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
275 G_CONNECT_SWAPPED));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
276 gtk_container_add (GTK_CONTAINER (config_dlg->action_area), button);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
277
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
278 button = gtk_button_new_with_label (_("Cancel"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
279 g_signal_connect (G_OBJECT (button), "clicked",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
280 G_CALLBACK (close_config_box_cancel),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
281 (gpointer) rblist);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
282 g_signal_connect_swapped (G_OBJECT (button), "clicked",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
283 G_CALLBACK (gtk_widget_destroy),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
284 GTK_OBJECT (config_dlg));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
285 gtk_container_add (GTK_CONTAINER (config_dlg->action_area), button);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
286 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
287
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
288 /***** Page 1: General *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
289
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
290 table = GTK_TABLE (gtk_table_new (1, 2, TRUE));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
291 gtk_table_set_row_spacings (table, 5);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
292 gtk_table_set_col_spacings (table, 5);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
293 gtk_notebook_append_page (notebook, GTK_WIDGET (table),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
294 print_left (_("General")));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
295
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
296 // Add "Sound quality" section
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
297 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
298 GtkTable *sqt = GTK_TABLE (gtk_table_new (2, 2, FALSE));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299 GtkVBox *fvb;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
300 GtkRadioButton *rb;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
301
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
302 gtk_table_set_row_spacings (sqt, 5);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
303 gtk_table_set_col_spacings (sqt, 5);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
304 gtk_table_attach_defaults (table,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
305 make_framed (GTK_WIDGET (sqt),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
306 _("Sound quality")), 0, 1, 0, 1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
307
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
308 // Add "Resolution" section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
309 fvb = GTK_VBOX (gtk_vbox_new (TRUE, 0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
310 gtk_table_attach_defaults (sqt,
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
311 make_framed (GTK_WIDGET (fvb), _("Resolution")),
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
312 0, 1, 0, 1);
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
313 rb = GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (NULL, _("8bit")));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
314 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), !cfg.bit16);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
315 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
316 rb =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
317 GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
318 (rb, _("16bit")));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
319 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), cfg.bit16);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
320 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
321 g_ptr_array_add (rblist, (gpointer) rb);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
322
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
323 // Add "Channels" section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
324 fvb = GTK_VBOX (gtk_vbox_new (TRUE, 0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
325 gtk_table_attach_defaults (sqt,
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
326 make_framed (GTK_WIDGET (fvb), _("Channels")), 0,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
327 1, 1, 2);
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
328 rb = GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (NULL, _("Mono")));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
329 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), !cfg.stereo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
330 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
331 rb =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
332 GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
333 (rb, _("Stereo")));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
334 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), cfg.stereo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
335 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
336 gtk_tooltips_set_tip (tooltips, GTK_WIDGET (rb),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
337 _("Setting stereo is not recommended, unless you need to. "
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
338 "This won't add any stereo effects to the sound - OPL2 "
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
339 "is just mono - but eats up more CPU power!"), NULL);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
340 g_ptr_array_add (rblist, (gpointer) rb);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
341
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
342 // Add "Frequency" section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
343 fvb = GTK_VBOX (gtk_vbox_new (TRUE, 0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
344 gtk_table_attach_defaults (sqt,
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
345 make_framed (GTK_WIDGET (fvb), _("Frequency")), 1,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
346 2, 0, 2);
1529
349cae04e455 -continued German translation
mf0102 <0102@gmx.at>
parents: 1447
diff changeset
347 rb = GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (NULL, "11025"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
348 if (cfg.freq == 11025)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
349 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
350 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
351 g_ptr_array_add (rblist, (gpointer) rb);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
352 rb =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
353 GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
1529
349cae04e455 -continued German translation
mf0102 <0102@gmx.at>
parents: 1447
diff changeset
354 (rb, "22050"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
355 if (cfg.freq == 22050)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
356 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
357 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
358 g_ptr_array_add (rblist, (gpointer) rb);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
359 rb =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
360 GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
1529
349cae04e455 -continued German translation
mf0102 <0102@gmx.at>
parents: 1447
diff changeset
361 (rb, "44100"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
362 if (cfg.freq == 44100)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
363 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
364 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
365 g_ptr_array_add (rblist, (gpointer) rb);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
366 rb =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
367 GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
1529
349cae04e455 -continued German translation
mf0102 <0102@gmx.at>
parents: 1447
diff changeset
368 (rb, "48000"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
369 if (cfg.freq == 48000)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
370 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
371 gtk_container_add (GTK_CONTAINER (fvb), GTK_WIDGET (rb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
372 g_ptr_array_add (rblist, (gpointer) rb);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
373 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
374
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
375 // Add "Playback" section
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
376 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
377 GtkVBox *vb = GTK_VBOX (gtk_vbox_new (FALSE, 0));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
378 GtkCheckButton *cb;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
379
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
380 gtk_table_attach_defaults (table,
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
381 make_framed (GTK_WIDGET (vb), _("Playback")), 1,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
382 2, 0, 1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
383
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
384 cb =
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
385 GTK_CHECK_BUTTON (gtk_check_button_new_with_label (_("Detect songend")));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
386 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), !cfg.endless);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
387 gtk_container_add (GTK_CONTAINER (vb), GTK_WIDGET (cb));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
388 gtk_tooltips_set_tip (tooltips, GTK_WIDGET (cb),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
389 _("If enabled, XMMS will detect a song's ending, stop "
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
390 "it and advance in the playlist. If disabled, XMMS "
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
391 "won't take notice of a song's ending and loop it all "
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
392 "over again and again."), NULL);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
393 g_ptr_array_add (rblist, (gpointer) cb);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
394 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
395
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
396 /***** Page 2: Formats *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
397
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
398 table = GTK_TABLE (gtk_table_new (1, 1, TRUE));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
399 gtk_notebook_append_page (notebook, GTK_WIDGET (table),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
400 print_left (_("Formats")));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
401
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
402 // Add "Format selection" section
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
403 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
404 GtkHBox *vb = GTK_HBOX (gtk_hbox_new (FALSE, 0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
405 gtk_table_attach_defaults (table,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
406 make_framed (GTK_WIDGET (vb),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
407 _("Format selection")), 0, 1, 0, 1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
408 // Add scrollable list
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
409 {
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
410 const gchar *rowstr[] = { _("Format"), _("Extension") };
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
411 GtkEventBox *eventbox = GTK_EVENT_BOX (gtk_event_box_new ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
412 GtkScrolledWindow *formatswnd =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
413 GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
1044
b1128efde471 [svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents: 955
diff changeset
414 GtkCList *fl = GTK_CLIST (gtk_clist_new_with_titles (2, (gchar **)rowstr));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
415 CPlayers::const_iterator i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
416 unsigned int j;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
417 gtk_clist_set_selection_mode (fl, GTK_SELECTION_MULTIPLE);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
418
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
419 // Build list
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
420 for (i = CAdPlug::players.begin (); i != CAdPlug::players.end (); i++)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
421 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
422 gint rownum;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
423
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
424 gchar *rws[2];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
425 rws[0] = g_strdup ((*i)->filetype.c_str ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
426 rws[1] = g_strdup ((*i)->get_extension (0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
427 for (j = 1; (*i)->get_extension (j); j++)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
428 rws[1] = g_strjoin (", ", rws[1], (*i)->get_extension (j), NULL);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
429 rownum = gtk_clist_append (fl, rws);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
430 g_free (rws[0]);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
431 g_free (rws[1]);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
432 gtk_clist_set_row_data (fl, rownum, (gpointer) (*i));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
433 if (find (cfg.players.begin (), cfg.players.end (), *i) !=
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
434 cfg.players.end ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
435 gtk_clist_select_row (fl, rownum, 0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
436 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
437
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
438 gtk_clist_columns_autosize (fl);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
439 gtk_scrolled_window_set_policy (formatswnd, GTK_POLICY_AUTOMATIC,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
440 GTK_POLICY_AUTOMATIC);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
441 gpointer pl = (gpointer) new CPlayers (cfg.players);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
442 g_signal_connect (G_OBJECT (fl), "select-row",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
443 G_CALLBACK (config_fl_row_select), pl);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
444 g_signal_connect (G_OBJECT (fl), "unselect-row",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
445 G_CALLBACK (config_fl_row_unselect), pl);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
446 gtk_container_add (GTK_CONTAINER (formatswnd), GTK_WIDGET (fl));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
447 gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (formatswnd));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
448 gtk_container_add (GTK_CONTAINER (vb), GTK_WIDGET (eventbox));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
449 gtk_tooltips_set_tip (tooltips, GTK_WIDGET (eventbox),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
450 _("Selected file types will be recognized and played "
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
451 "back by this plugin. Deselected types will be "
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
452 "ignored to make room for other plugins to play "
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
453 "these files."), NULL);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
454 g_ptr_array_add (rblist, pl);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
455 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
456 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
457
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
458 // Show window
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
459 gtk_widget_show_all (GTK_WIDGET (config_dlg));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
460 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
461
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
462 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
463 add_instlist (GtkCList * instlist, const char *t1, const char *t2)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
464 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
465 gchar *rowstr[2];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
466
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
467 rowstr[0] = g_strdup (t1);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
468 rowstr[1] = g_strdup (t2);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
469 gtk_clist_append (instlist, rowstr);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
470 g_free (rowstr[0]);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
471 g_free (rowstr[1]);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
472 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
473
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
474 static CPlayer *
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
475 factory (VFSFile * fd, Copl * newopl)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
476 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
477 CPlayers::const_iterator i;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
478
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
479 dbg_printf ("factory(%p<%s>,opl): ", fd,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
480 fd->uri != NULL ? fd->uri : "unknown");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
481 return CAdPlug::factory (fd, newopl, cfg.players);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
482 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
484 static void adplug_stop (InputPlayback * data);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
485 static void adplug_play (InputPlayback * data);
559
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
486
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
487
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
488
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
489 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
490 subsong_slider (GtkAdjustment * adj)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
491 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
492 adplug_stop (NULL);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
493 plr.subsong = (unsigned int) adj->value - 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
494 adplug_play (playback);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
495 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
496
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
497 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
498 close_infobox (GtkDialog * infodlg)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
499 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
500 // Forget our references to the instance of the "currently playing song" info
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
501 // box. But only if we're really destroying that one... ;)
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
502 if (infodlg == plr.infodlg)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
503 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
504 plr.infobox = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
505 plr.infodlg = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
506 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
507 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
508
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
509 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
510 adplug_info_box (char *filename)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
511 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
512 CSilentopl tmpopl;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
513 VFSFile *fd = vfs_buffered_file_new_from_uri (filename);
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
514
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
515 if (!fd)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
516 return;
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
517
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
518 CPlayer *p = (strcmp (filename, plr.filename) || !plr.p) ?
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
519 factory (fd, &tmpopl) : plr.p;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
520
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
521 if (!p)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
522 return; // bail out if no player could be created
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
523 if (p == plr.p && plr.infodlg)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
524 return; // only one info box for active song
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
525
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
526 std::ostringstream infotext;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
527 unsigned int i;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
528 GtkDialog *infobox = GTK_DIALOG (gtk_dialog_new ());
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
529 GtkButton *okay_button = GTK_BUTTON (gtk_button_new_with_label (_("Ok")));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
530
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
531 GtkVBox *box = GTK_VBOX (gtk_vbox_new (TRUE, 2));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
532 GtkHBox *hbox = GTK_HBOX (gtk_hbox_new (TRUE, 2));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
533 GtkHBox *hbox2 = GTK_HBOX (gtk_hbox_new (TRUE, 2));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
534
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
535 // Build file info box
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
536 gtk_window_set_title (GTK_WINDOW (infobox), _("AdPlug :: File Info"));
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
537 gtk_window_set_policy (GTK_WINDOW (infobox), FALSE, FALSE, TRUE); // Window is auto sized
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
538
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
539 gtk_container_add (GTK_CONTAINER (infobox->vbox), GTK_WIDGET (box));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
540 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
541 // gtk_packer_set_default_border_width(packer, 2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
542
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
543 gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
544 g_signal_connect_swapped (G_OBJECT (okay_button), "clicked",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
545 G_CALLBACK (gtk_widget_destroy),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
546 GTK_OBJECT (infobox));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
547 g_signal_connect (G_OBJECT (infobox), "destroy",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
548 G_CALLBACK (close_infobox), 0);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
549 gtk_container_add (GTK_CONTAINER (infobox->action_area),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
550 GTK_WIDGET (okay_button));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
551
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
552 // Add filename section
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
553 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
554 // gtk_packer_add_defaults(packer, make_framed(print_left(filename), "Filename"),
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
555 // GTK_SIDE_TOP, GTK_ANCHOR_CENTER, GTK_FILL_X);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
556 gtk_box_pack_end (GTK_BOX (box), GTK_WIDGET (hbox2), TRUE, TRUE, 2);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
557 gtk_box_pack_end (GTK_BOX (box),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
558 make_framed (print_left (filename), _("Filename")), TRUE,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
559 TRUE, 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
560
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
561 // Add "Song info" section
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
562 infotext << _("Title: ") << p->gettitle () << std::endl <<
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
563 _("Author: ") << p->getauthor () << std::endl <<
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
564 _("File Type: ") << p->gettype () << std::endl <<
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
565 _("Subsongs: ") << p->getsubsongs () << std::endl <<
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
566 _("Instruments: ") << p->getinstruments ();
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
567 if (plr.p == p)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
568 infotext << std::ends;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
569 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
570 {
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
571 infotext << std::endl << _("Orders: ") << p->getorders () << std::endl <<
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
572 _("Patterns: ") << p->getpatterns () << std::ends;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
573 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
574 gtk_container_add (GTK_CONTAINER (hbox),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
575 make_framed (print_left (infotext.str ().c_str ()),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
576 _("Song")));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
577
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
578 // Add "Playback info" section if currently playing
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
579 if (plr.p == p)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
580 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
581 plr.infobox = GTK_LABEL (gtk_label_new (""));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
582 gtk_label_set_justify (plr.infobox, GTK_JUSTIFY_LEFT);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
583 gtk_misc_set_padding (GTK_MISC (plr.infobox), 2, 2);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
584 gtk_container_add (GTK_CONTAINER (hbox),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
585 make_framed (GTK_WIDGET (plr.infobox), _("Playback")));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
586 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
587
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
588 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
589 // gtk_packer_add_defaults(packer, GTK_WIDGET(hbox), GTK_SIDE_TOP,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
590 // GTK_ANCHOR_CENTER, GTK_FILL_X);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
591 gtk_box_pack_end (GTK_BOX (hbox2), GTK_WIDGET (hbox), TRUE, TRUE, 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
592
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
593 // Add instrument names section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
594 if (p->getinstruments ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
595 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
596 GtkScrolledWindow *instwnd =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
597 GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
598 GtkCList *instnames;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
599 gchar tmpstr[10];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
600
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
601 {
1532
d19b625f9144 - continued German translation
mf0102 <0102@gmx.at>
parents: 1529
diff changeset
602 const gchar *rowstr[] = { "#", _("Instrument name") };
1044
b1128efde471 [svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents: 955
diff changeset
603 instnames = GTK_CLIST (gtk_clist_new_with_titles (2, (gchar **)rowstr));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
604 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
605 gtk_clist_set_column_justification (instnames, 0, GTK_JUSTIFY_RIGHT);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
606
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
607 for (i = 0; i < p->getinstruments (); i++)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
608 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
609 sprintf (tmpstr, "%d", i + 1);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
610 add_instlist (instnames, tmpstr, p->getinstrument (i).c_str ());
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
611 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
612
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
613 gtk_clist_columns_autosize (instnames);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
614 gtk_scrolled_window_set_policy (instwnd, GTK_POLICY_AUTOMATIC,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
615 GTK_POLICY_AUTOMATIC);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
616 gtk_container_add (GTK_CONTAINER (instwnd), GTK_WIDGET (instnames));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
617 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
618 // gtk_packer_add(packer, GTK_WIDGET(instwnd), GTK_SIDE_TOP,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
619 // GTK_ANCHOR_CENTER, GTK_FILL_X, 0, 0, 0, 0, 50);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
620 gtk_box_pack_end (GTK_BOX (hbox2), GTK_WIDGET (instwnd), TRUE, TRUE, 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
621 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
622
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
623 // Add "Song message" section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
624 if (!p->getdesc ().empty ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
625 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
626 GtkScrolledWindow *msgwnd =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
627 GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
628 GtkTextView *msg = GTK_TEXT_VIEW (gtk_text_view_new ());
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
629
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
630 gtk_scrolled_window_set_policy (msgwnd, GTK_POLICY_AUTOMATIC,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
631 GTK_POLICY_AUTOMATIC);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
632 gtk_text_view_set_editable (msg, FALSE);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
633 gtk_text_view_set_wrap_mode (msg, GTK_WRAP_WORD_CHAR);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
634
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
635 gtk_text_buffer_set_text (gtk_text_view_get_buffer (msg),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
636 p->getdesc ().c_str (),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
637 p->getdesc ().length ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
638 gtk_container_add (GTK_CONTAINER (msgwnd), GTK_WIDGET (msg));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
639
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
640 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
641 // gtk_packer_add(packer, make_framed(GTK_WIDGET(msgwnd), "Song message"),
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
642 // GTK_SIDE_TOP, GTK_ANCHOR_CENTER, GTK_FILL_X, 2, 0, 0, 200, 50);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
643 gtk_box_pack_end (GTK_BOX (hbox2),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
644 make_framed (GTK_WIDGET (msgwnd), _("Song message")), TRUE,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
645 TRUE, 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
646 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
647
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
648 // Add subsong slider section
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
649 if (p == plr.p && p->getsubsongs () > 1)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
650 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
651 GtkAdjustment *adj =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
652 GTK_ADJUSTMENT (gtk_adjustment_new (plr.subsong + 1, 1,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
653 p->getsubsongs () + 1,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
654 1, 5, 1));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
655 GtkHScale *slider = GTK_HSCALE (gtk_hscale_new (adj));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
656
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
657 g_signal_connect (G_OBJECT (adj), "value_changed",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
658 G_CALLBACK (subsong_slider), NULL);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
659 gtk_range_set_update_policy (GTK_RANGE (slider),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
660 GTK_UPDATE_DISCONTINUOUS);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
661 gtk_scale_set_digits (GTK_SCALE (slider), 0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
662 // Former packer layout, for future reproduction
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
663 // gtk_packer_add_defaults(packer, make_framed(GTK_WIDGET(slider), "Subsong selection"),
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
664 // GTK_SIDE_TOP, GTK_ANCHOR_CENTER, GTK_FILL_X);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
665 gtk_box_pack_end (GTK_BOX (hbox2),
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
666 make_framed (GTK_WIDGET (slider), _("Subsong selection")),
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
667 TRUE, TRUE, 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
668 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
669
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
670 // Show dialog box
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
671 gtk_widget_show_all (GTK_WIDGET (infobox));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
672 if (p == plr.p)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
673 { // Remember widget, so we could destroy it later
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
674 plr.infodlg = infobox;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
675 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
676 else // Delete temporary player
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
677 delete p;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
678 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
679
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
680 /***** Main player (!! threaded !!) *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
681
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
682 static Tuple*
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
683 adplug_get_tuple (char *filename)
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
684 {
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
685 CSilentopl tmpopl;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
686 VFSFile *fd = vfs_buffered_file_new_from_uri (filename);
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
687
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
688 if (!fd)
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
689 return NULL;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
690
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
691 CPlayer *p = factory (fd, &tmpopl);
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
692
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
693 if (p)
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
694 {
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
695 Tuple *ti = tuple_new_from_filename(filename);
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
696 if (! p->getauthor().empty())
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
697 tuple_associate_string(ti, "artist", p->getauthor().c_str());
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
698 if (! p->gettitle().empty())
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
699 tuple_associate_string(ti, "title", p->gettitle().c_str());
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
700 else if (! p->getdesc().empty())
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
701 tuple_associate_string(ti, "title", p->getdesc().c_str());
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
702 else
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
703 tuple_associate_string(ti, "title", g_path_get_basename(filename));
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
704 tuple_associate_string(ti, "codec", p->gettype().c_str());
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
705 tuple_associate_string(ti, "quality", "sequenced");
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
706 tuple_associate_int(ti, "length", p->songlength (plr.subsong));
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
707 delete p;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
708 return ti;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
709 }
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
710
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
711 return NULL;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
712 }
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
713
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
714 static char* format_and_free_ti( Tuple* ti, int* length )
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
715 {
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
716 char* result = tuple_formatter_make_title_string(ti, get_gentitle_format());
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
717 if ( result )
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
718 *length = tuple_get_int(ti, "length");
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
719 tuple_free((void *) ti);
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
720
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
721 return result;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
722 }
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
723
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
724 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
725 update_infobox (void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
726 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
727 std::ostringstream infotext;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
728
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
729 // Recreate info string
1538
da1aa3c38cda i'm currently "update-po"ing like a madman with a Chainsaw ;-)
mf0102 <0102@gmx.at>
parents: 1532
diff changeset
730 infotext << _("Order: ") << plr.p->getorder () << " / " << plr.p->
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
731 getorders () << std::endl << _("Pattern: ") << plr.p->
1538
da1aa3c38cda i'm currently "update-po"ing like a madman with a Chainsaw ;-)
mf0102 <0102@gmx.at>
parents: 1532
diff changeset
732 getpattern () << " / " << plr.p->
1286
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
733 getpatterns () << std::endl << _("Row: ") << plr.p->
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
734 getrow () << std::endl << _("Speed: ") << plr.p->
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
735 getspeed () << std::endl << _("Timer: ") << plr.p->
4462de7be194 "Ad-plug" is now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents: 1096
diff changeset
736 getrefresh () << _("Hz") << std::ends;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
737
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
738 GDK_THREADS_ENTER ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
739 gtk_label_set_text (plr.infobox, infotext.str ().c_str ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
740 GDK_THREADS_LEAVE ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
741 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
742
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
743 // Define sampsize macro (only usable inside play_loop()!)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
744 #define sampsize ((bit16 ? 2 : 1) * (stereo ? 2 : 1))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
745
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
746 static void *
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
747 play_loop (void *data)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
748 /* Main playback thread. Takes the filename to play as argument. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
749 {
561
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
750 InputPlayback *playback = (InputPlayback *) data;
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
751 char *filename = (char *) playback->filename;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
752 dbg_printf ("play_loop(\"%s\"): ", filename);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
753 CEmuopl opl (cfg.freq, cfg.bit16, cfg.stereo);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
754 long toadd = 0, i, towrite;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
755 char *sndbuf, *sndbufpos;
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
756 int songlength;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
757 bool playing = true, // Song self-end indicator.
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
758 bit16 = cfg.bit16, // Duplicate config, so it doesn't affect us if
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
759 stereo = cfg.stereo; // the user changes it while we're playing.
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
760 unsigned long freq = cfg.freq;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
761
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
762 // we use VfsBufferedFile class here because adplug does a lot of
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
763 // probing. a short delay before probing begins is better than
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
764 // a lot of delay during probing.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
765 VFSFile *fd = vfs_buffered_file_new_from_uri (playback->filename);
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
766
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
767 if (!fd)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
768 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
769 plr.playing = false;
1410
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
770 return (NULL);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
771 }
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
772
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
773 // Try to load module
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
774 dbg_printf ("factory, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
775 if (!(plr.p = factory (fd, &opl)))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
776 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
777 dbg_printf ("error!\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
778 // MessageBox("AdPlug :: Error", "File could not be opened!", "Ok");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
779 plr.playing = false;
1410
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
780 return (NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
781 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
782
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
783 // cache song title & length from tuple
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
784 dbg_printf ("title, ");
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
785 Tuple* ti = adplug_get_tuple(filename);
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
786 if (ti)
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
787 {
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
788 plr.songtitle = format_and_free_ti( ti, &songlength );
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
789 }
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
790 plr.songlength = songlength;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
791
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
792 // reset to first subsong on new file
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
793 dbg_printf ("subsong, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
794 if (strcmp (filename, plr.filename))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
795 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
796 strcpy (plr.filename, filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
797 plr.subsong = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
798 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
799
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
800 // Allocate audio buffer
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
801 dbg_printf ("buffer, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
802 sndbuf = (char *) malloc (SNDBUFSIZE * sampsize);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
803
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
804 // Set XMMS main window information
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
805 dbg_printf ("xmms, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
806 adplug_ip.set_info (plr.songtitle, plr.songlength, freq * sampsize * 8,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
807 freq, stereo ? 2 : 1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
808
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
809 // Rewind player to right subsong
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
810 dbg_printf ("rewind, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
811 plr.p->rewind (plr.subsong);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
812
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
813 // main playback loop
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
814 dbg_printf ("loop.\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
815 while ((playing || cfg.endless) && plr.playing)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
816 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
817 // seek requested ?
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
818 if (plr.seek != -1)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
819 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
820 // backward seek ?
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
821 if (plr.seek < plr.time_ms)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
822 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
823 plr.p->rewind (plr.subsong);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
824 plr.time_ms = 0.0f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
825 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
826
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
827 // seek to requested position
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
828 while ((plr.time_ms < plr.seek) && plr.p->update ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
829 plr.time_ms += 1000 / plr.p->getrefresh ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
830
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
831 // Reset output plugin and some values
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
832 playback->output->flush ((int) plr.time_ms);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
833 plr.seek = -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
834 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
835
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
836 // fill sound buffer
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
837 towrite = SNDBUFSIZE;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
838 sndbufpos = sndbuf;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
839 while (towrite > 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
840 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
841 while (toadd < 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
842 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
843 toadd += freq;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
844 playing = plr.p->update ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
845 plr.time_ms += 1000 / plr.p->getrefresh ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
846 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
847 i = MIN (towrite, (long) (toadd / plr.p->getrefresh () + 4) & ~3);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
848 opl.update ((short *) sndbufpos, i);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
849 sndbufpos += i * sampsize;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
850 towrite -= i;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
851 toadd -= (long) (plr.p->getrefresh () * i);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
852 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
853
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
854 // write sound buffer
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
855 while (playback->output->buffer_free () < SNDBUFSIZE * sampsize)
1676
aee4ebea943a xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents: 1634
diff changeset
856 g_usleep (10000);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
857 produce_audio (playback->output->written_time (),
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
858 bit16 ? FORMAT_16 : FORMAT_8,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
859 stereo ? 2 : 1, SNDBUFSIZE * sampsize, sndbuf, NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
860
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
861 // update infobox, if necessary
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
862 if (plr.infobox && plr.playing)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
863 update_infobox ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
864 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
865
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
866 // playback finished - deinit
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
867 dbg_printf ("play_loop(\"%s\"): ", filename);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
868 if (!playing)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
869 { // wait for output plugin to finish if song has self-ended
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
870 dbg_printf ("wait, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
871 while (playback->output->buffer_playing ())
1676
aee4ebea943a xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents: 1634
diff changeset
872 g_usleep (10000);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
873 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
874 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
875 { // or else, flush its output buffers
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
876 dbg_printf ("flush, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
877 playback->output->buffer_free ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
878 playback->output->buffer_free ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
879 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
880
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
881 // free everything and exit
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
882 dbg_printf ("free");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
883 delete plr.p;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
884 plr.p = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
885 if (plr.songtitle)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
886 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
887 free (plr.songtitle);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
888 plr.songtitle = NULL;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
889 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
890 free (sndbuf);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
891 plr.playing = false; // important! XMMS won't get a self-ended song without it.
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
892 dbg_printf (".\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
893 vfs_fclose (fd);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
894 return (NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
895 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
896
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
897 // sampsize macro not useful anymore.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
898 #undef sampsize
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
899
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
900 /***** Informational *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
901
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
902 static int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
903 adplug_is_our_fd (gchar * filename, VFSFile * fd)
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
904 {
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
905 CSilentopl tmpopl;
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
906
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
907 CPlayer *p = factory (fd, &tmpopl);
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
908
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
909 dbg_printf ("adplug_is_our_file(\"%s\"): returned ", filename);
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
910
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
911 if (p)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
912 {
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
913 delete p;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
914 dbg_printf ("TRUE\n");
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
915 return TRUE;
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
916 }
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
917
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
918 dbg_printf ("FALSE\n");
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
919 return FALSE;
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
920 }
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
921
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
922 static int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
923 adplug_is_our_file (char *filename)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
924 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
925 CSilentopl tmpopl;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
926 VFSFile *fd = vfs_buffered_file_new_from_uri (filename);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
927 if (!fd)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
928 return FALSE;
703
cae46214b8bf [svn] - rework AdPlug to use VFS properly
nenolod
parents: 561
diff changeset
929
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
930 CPlayer *p = factory (fd, &tmpopl);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
931
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
932 dbg_printf ("adplug_is_our_file(\"%s\"): returned ", filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
933
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
934 if (p)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
935 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
936 delete p;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
937 dbg_printf ("TRUE\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
938 return TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
939 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
940
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
941 dbg_printf ("FALSE\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
942 return FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
943 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
944
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
945 static int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
946 adplug_get_time (InputPlayback * data)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
947 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
948 if (audio_error)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
949 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
950 dbg_printf ("adplug_get_time(): returned -2\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
951 return -2;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
952 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
953 if (!plr.playing)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
954 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
955 dbg_printf ("adplug_get_time(): returned -1\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
956 return -1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
957 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
958 return playback->output->output_time ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
959 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
960
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
961 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
962 adplug_song_info (char *filename, char **title, int *length)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
963 {
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
964 *length = -1;
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
965 *title = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
966
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
967 Tuple* ti = adplug_get_tuple( filename );
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
968 if ( ti )
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
969 *title = format_and_free_ti( ti, length );
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
970 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
971
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
972 /***** Player control *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
973
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
974 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
975 adplug_play (InputPlayback * data)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
976 {
559
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
977 char *filename = data->filename;
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 528
diff changeset
978 playback = data;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
979 dbg_printf ("adplug_play(\"%s\"): ", filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
980 audio_error = FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
981
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
982 // On new song, re-open "Song info" dialog, if open
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
983 dbg_printf ("dialog, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
984 if (plr.infobox && strcmp (filename, plr.filename))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
985 gtk_widget_destroy (GTK_WIDGET (plr.infodlg));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
986
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
987 // open output plugin
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
988 dbg_printf ("open, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
989 if (!playback->output->
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
990 open_audio (cfg.bit16 ? FORMAT_16 : FORMAT_8, cfg.freq,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
991 cfg.stereo ? 2 : 1))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
992 {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
993 audio_error = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
994 return;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
995 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
996
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
997 // Initialize global player data (this is here to prevent a race condition
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
998 // between adplug_get_time() returning the playback state and adplug_loop()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
999 // initializing the playback state)
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1000 dbg_printf ("init, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1001 plr.playing = true;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1002 plr.time_ms = 0.0f;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1003 plr.seek = -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1004
1410
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
1005 // start player func
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
1006 dbg_printf ("play");
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
1007 plr.play_thread = g_thread_self();
1447
195b5657303e updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents: 1410
diff changeset
1008 playback->set_pb_ready(playback);
1410
cc6203a8cc9f Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents: 1395
diff changeset
1009 play_loop(playback);
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1010 dbg_printf (".\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1011 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1012
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1013 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1014 adplug_stop (InputPlayback * playback)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1015 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1016 dbg_printf ("adplug_stop(): join, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1017 plr.playing = false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1018 g_thread_join (plr.play_thread); // stop player thread
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1019 dbg_printf ("close");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1020 playback->output->close_audio ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1021 dbg_printf (".\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1022 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1023
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1024 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1025 adplug_pause (InputPlayback * playback, short paused)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1026 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1027 dbg_printf ("adplug_pause(%d)\n", paused);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1028 playback->output->pause (paused);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1029 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1030
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1031 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1032 adplug_seek (InputPlayback * data, int time)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1033 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1034 dbg_printf ("adplug_seek(%d)\n", time);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1035 plr.seek = time * 1000; // time is in seconds, but we count in ms
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1036 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1037
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1038 /***** Configuration file handling *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1039
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1040 #define CFG_VERSION "AdPlug"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1041
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1042 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1043 adplug_init (void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1044 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1045 dbg_printf ("adplug_init(): open, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1046 ConfigDb *db = bmp_cfg_db_open ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1047
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1048 // Read configuration
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1049 dbg_printf ("read, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1050 bmp_cfg_db_get_bool (db, CFG_VERSION, "16bit", (gboolean *) & cfg.bit16);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1051 bmp_cfg_db_get_bool (db, CFG_VERSION, "Stereo", (gboolean *) & cfg.stereo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1052 bmp_cfg_db_get_int (db, CFG_VERSION, "Frequency", (gint *) & cfg.freq);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1053 bmp_cfg_db_get_bool (db, CFG_VERSION, "Endless",
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1054 (gboolean *) & cfg.endless);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1055
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1056 // Read file type exclusion list
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1057 dbg_printf ("exclusion, ");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1058 {
1045
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1059 gchar *cfgstr = NULL, *exclude = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1060 gboolean cfgread;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1061
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1062 cfgread = bmp_cfg_db_get_string (db, CFG_VERSION, "Exclude", &cfgstr);
1045
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1063 if (cfgread) {
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1064 exclude = (char *) malloc (strlen (cfgstr) + 2);
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1065 strcpy (exclude, cfgstr);
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1066 exclude[strlen (exclude) + 1] = '\0';
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1067 g_strdelimit (exclude, ":", '\0');
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1068 for (gchar * p = exclude; *p; p += strlen (p) + 1)
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1069 cfg.players.remove (cfg.players.lookup_filetype (p));
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1070 free (exclude); free (cfgstr);
028b7ca16d30 [svn] - fix crash if Exclude does not exist.
yaz
parents: 1044
diff changeset
1071 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1072 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1073 bmp_cfg_db_close (db);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1074
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1075 // Load database from disk and hand it to AdPlug
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1076 dbg_printf ("database");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1077 plr.db = new CAdPlugDatabase;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1078
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1079 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1080 const char *homedir = getenv ("HOME");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1081
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1082 if (homedir)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1083 {
1301
df5d07d7ca7c AdPlug database loading fix by Christian "Joker" Birchinger.
Tony Vroon <chainsaw@gentoo.org>
parents: 1286
diff changeset
1084 std::string userdb;
df5d07d7ca7c AdPlug database loading fix by Christian "Joker" Birchinger.
Tony Vroon <chainsaw@gentoo.org>
parents: 1286
diff changeset
1085 userdb = "file://" + std::string(g_get_home_dir()) + "/" ADPLUG_CONFDIR "/" + ADPLUGDB_FILE;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1086 plr.db->load (userdb); // load user's database
1301
df5d07d7ca7c AdPlug database loading fix by Christian "Joker" Birchinger.
Tony Vroon <chainsaw@gentoo.org>
parents: 1286
diff changeset
1087 dbg_printf (" (userdb=\"%s\")", userdb.c_str());
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1088 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1089 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1090 CAdPlug::set_database (plr.db);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1091 dbg_printf (".\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1092 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1093
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1094 static void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1095 adplug_quit (void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1096 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1097 dbg_printf ("adplug_quit(): open, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1098 ConfigDb *db = bmp_cfg_db_open ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1099
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1100 // Close database
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1101 dbg_printf ("db, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1102 if (plr.db)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1103 delete plr.db;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1104
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1105 // Write configuration
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1106 dbg_printf ("write, ");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1107 bmp_cfg_db_set_bool (db, CFG_VERSION, "16bit", cfg.bit16);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1108 bmp_cfg_db_set_bool (db, CFG_VERSION, "Stereo", cfg.stereo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1109 bmp_cfg_db_set_int (db, CFG_VERSION, "Frequency", cfg.freq);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1110 bmp_cfg_db_set_bool (db, CFG_VERSION, "Endless", cfg.endless);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1111
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1112 dbg_printf ("exclude, ");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1113 std::string exclude;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1114 for (CPlayers::const_iterator i = CAdPlug::players.begin ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1115 i != CAdPlug::players.end (); i++)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1116 if (find (cfg.players.begin (), cfg.players.end (), *i) ==
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1117 cfg.players.end ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1118 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1119 if (!exclude.empty ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1120 exclude += ":";
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1121 exclude += (*i)->filetype;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1122 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1123 gchar *cfgval = g_strdup (exclude.c_str ());
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1124 bmp_cfg_db_set_string (db, CFG_VERSION, "Exclude", cfgval);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1125 free (cfgval);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1126
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1127 dbg_printf ("close");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1128 bmp_cfg_db_close (db);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1129 dbg_printf (".\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1130 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1131
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1132 /***** Plugin (exported) *****/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1133
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1134 InputPlugin adplug_ip = {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1135 NULL, // handle (filled by XMMS)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1136 NULL, // filename (filled by XMMS)
1044
b1128efde471 [svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents: 955
diff changeset
1137 (gchar *)ADPLUG_NAME, // plugin description
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1138 adplug_init, // plugin functions...
1634
98c9257d0a80 adplug: update
William Pitcock <nenolod@atheme.org>
parents: 1556
diff changeset
1139 adplug_quit,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1140 adplug_about,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1141 adplug_config,
1634
98c9257d0a80 adplug: update
William Pitcock <nenolod@atheme.org>
parents: 1556
diff changeset
1142 FALSE,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1143 adplug_is_our_file,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1144 NULL, // scan_dir (look in Input/cdaudio/cdaudio.c)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1145 adplug_play,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1146 adplug_stop,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1147 adplug_pause,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1148 adplug_seek,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1149 NULL, // set_eq
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1150 adplug_get_time,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1151 NULL, // get_volume (handled by output plugin)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1152 NULL, // set_volume (...)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1153 NULL, // OBSOLETE - DO NOT USE!
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1154 NULL, // add_vis_pcm (filled by XMMS)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1155 NULL, // set_info (filled by XMMS)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1156 NULL, // set_info_text (filled by XMMS)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1157 adplug_song_info,
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
1158 adplug_info_box,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1159 NULL, // output plugin (filled by XMMS)
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
1160 adplug_get_tuple,
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1161 NULL,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1162 NULL,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1163 adplug_is_our_fd,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1164 NULL,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 703
diff changeset
1165 };
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1166
1096
8b02086025f9 [svn] - adplug: convert to plugin API v2
nenolod
parents: 1045
diff changeset
1167 InputPlugin *adplug_iplist[] = { &adplug_ip, NULL };
8b02086025f9 [svn] - adplug: convert to plugin API v2
nenolod
parents: 1045
diff changeset
1168
1395
761e17b23e0c added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 1301
diff changeset
1169 DECLARE_PLUGIN(adplug, NULL, NULL, adplug_iplist, NULL, NULL, NULL, NULL,NULL);
1556
16b2bc9b9763 Add a tuple builder. With thanks to ccr for the fallback logic; I hate C++.
Tony Vroon <chainsaw@gentoo.org>
parents: 1538
diff changeset
1170