annotate src/xmms-sid.c @ 659:04ea91a61225

Constify a table.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Apr 2008 21:29:26 +0300
parents acaba070cf49
children b0743dc9165d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Main source file
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 313
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
422
d2e6682d3ef8 Copyright year update
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
19 You should have received a copy of the GNU General Public License along along
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
235
d04191d1ea64 Add xs_fileinfo.h, move appropriate function prototypes there.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
23 #include "xmms-sid.h"
223
16e3b2446a73 On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
24
16e3b2446a73 On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
25 #ifdef HAVE_STDLIB_H
16e3b2446a73 On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
26 #include <stdlib.h>
16e3b2446a73 On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
27 #endif
16e3b2446a73 On some systems stdlib.h has prerequisite of stdio.h, corrected order of
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
28
297
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
29 #include <stdarg.h>
184
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
30 #include <gdk/gdkkeysyms.h>
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
31 #include <gtk/gtk.h>
235
d04191d1ea64 Add xs_fileinfo.h, move appropriate function prototypes there.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
32
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #include "xs_config.h"
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #include "xs_length.h"
103
fe83646e6baa Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
35 #include "xs_stil.h"
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
36 #include "xs_title.h"
313
b2707c970c9c #include "xs_filter.h"
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
37 #include "xs_filter.h"
235
d04191d1ea64 Add xs_fileinfo.h, move appropriate function prototypes there.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
38 #include "xs_fileinfo.h"
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #include "xs_interface.h"
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 #include "xs_glade.h"
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
41 #include "xs_player.h"
622
d7389ea52113 Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
42 #include "xs_slsup.h"
d7389ea52113 Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents: 606
diff changeset
43
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 * Include player engines
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 */
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
48 #ifdef HAVE_SIDPLAY1
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 #include "xs_sidplay1.h"
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
50 #endif
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
51 #ifdef HAVE_SIDPLAY2
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 #include "xs_sidplay2.h"
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
53 #endif
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
54
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
55
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
56 /*
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
57 * List of players and links to their functions
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
58 */
659
04ea91a61225 Constify a table.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
59 static const xs_player_t xs_playerlist[] = {
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
60 #ifdef HAVE_SIDPLAY1
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
61 {XS_ENG_SIDPLAY1,
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
62 xs_sidplay1_probe,
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
63 xs_sidplay1_init, xs_sidplay1_close,
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
64 xs_sidplay1_initsong, xs_sidplay1_fillbuffer,
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
65 xs_sidplay1_load, xs_sidplay1_delete,
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
66 xs_sidplay1_getinfo, xs_sidplay1_updateinfo,
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
67 NULL
365
5a92a2aee74c Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
68 },
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
69 #endif
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
70 #ifdef HAVE_SIDPLAY2
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
71 {XS_ENG_SIDPLAY2,
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
72 xs_sidplay2_probe,
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
73 xs_sidplay2_init, xs_sidplay2_close,
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
74 xs_sidplay2_initsong, xs_sidplay2_fillbuffer,
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
75 xs_sidplay2_load, xs_sidplay2_delete,
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
76 xs_sidplay2_getinfo, xs_sidplay2_updateinfo,
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
77 xs_sidplay2_flush
365
5a92a2aee74c Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
78 },
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
79 #endif
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
80 };
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
81
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
82 const gint xs_nplayerlist = (sizeof(xs_playerlist) / sizeof(xs_playerlist[0]));
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 * Global variables
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 */
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
88 xs_status_t xs_status;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
89 XS_MUTEX(xs_status);
532
bc548249464a Audacious glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
90 static XS_THREAD_T xs_decode_thread;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
92 static GtkWidget *xs_subctrl = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
93 static GtkObject *xs_subctrl_adj = NULL;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
94 XS_MUTEX(xs_subctrl);
184
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
95
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
96 void xs_subctrl_close(void);
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
97 void xs_subctrl_update(void);
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
98
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
99
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 /*
297
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
101 * Error messages
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
102 */
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 383
diff changeset
103 void xs_error(const char *fmt, ...)
297
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
104 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
105 va_list ap;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
106 fprintf(stderr, "XMMS-SID: ");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
107 va_start(ap, fmt);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
108 vfprintf(stderr, fmt, ap);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
109 va_end(ap);
297
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
110 }
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
111
299
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
112 #ifndef DEBUG_NP
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
113 void XSDEBUG(const char *fmt, ...)
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
114 {
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
115 #ifdef DEBUG
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
116 va_list ap;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
117 fprintf(stderr, "XSDEBUG: ");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
118 va_start(ap, fmt);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
119 vfprintf(stderr, fmt, ap);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
120 va_end(ap);
299
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
121 #endif
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
122 }
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
123 #endif
Matti Hamalainen <ccr@tnsp.org>
parents: 298
diff changeset
124
461
a1224c1f8670 STILdb handling glue moved to xmms-sid.c
Matti Hamalainen <ccr@tnsp.org>
parents: 455
diff changeset
125
297
ac9a484e3430 Make XSERR into function.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
126 /*
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
127 * Initialization functions
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 */
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
129 void xs_reinit(void)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
131 gint iPlayer;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
132 gboolean isInitialized;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
133
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
134 /* Stop playing, if we are */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
135 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
136 if (xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
137 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
138 xs_stop();
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
139 } else {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
140 XS_MUTEX_UNLOCK(xs_status);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
141 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
142
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
143 XS_MUTEX_LOCK(xs_status);
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
144 XS_MUTEX_LOCK(xs_cfg);
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
145
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
146 /* Initialize status and sanitize configuration */
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
147 memset(&xs_status, 0, sizeof(xs_status));
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
148
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
149 if (xs_cfg.audioFrequency < 8000)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
150 xs_cfg.audioFrequency = 8000;
273
f6daddca03c7 Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
151
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
152 if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
153 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
154 else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
155 xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
156
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
157 if (xs_cfg.audioChannels != XS_CHN_MONO)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
158 xs_cfg.oversampleEnable = FALSE;
273
f6daddca03c7 Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
159
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
160 xs_status.audioFrequency = xs_cfg.audioFrequency;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
161 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
162 xs_status.audioChannels = xs_cfg.audioChannels;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
163 xs_status.audioFormat = -1;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
164 xs_status.oversampleEnable = xs_cfg.oversampleEnable;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
165 xs_status.oversampleFactor = xs_cfg.oversampleFactor;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
166
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
167 /* Try to initialize emulator engine */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
168 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
170 iPlayer = 0;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
171 isInitialized = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
172 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
173 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
174 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
175 isInitialized = TRUE;
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
176 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[iPlayer];
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
177 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
178 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
179 iPlayer++;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
180 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
182 XSDEBUG("init#1: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
184 iPlayer = 0;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
185 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
186 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
187 isInitialized = TRUE;
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
188 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[iPlayer];
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
189 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
190 } else
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
191 iPlayer++;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
192 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
193
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
194 XSDEBUG("init#2: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
196
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
197 /* Get settings back, in case the chosen emulator backend changed them */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
198 xs_cfg.audioFrequency = xs_status.audioFrequency;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
199 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
200 xs_cfg.audioChannels = xs_status.audioChannels;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
201 xs_cfg.oversampleEnable = xs_status.oversampleEnable;
273
f6daddca03c7 Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
202
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
203 XS_MUTEX_UNLOCK(xs_status);
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
204 XS_MUTEX_UNLOCK(xs_cfg);
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
205
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
206 /* Initialize song-length database */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
207 xs_songlen_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
208 if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
209 xs_error("Error initializing song-length database!\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
211
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
212 /* Initialize STIL database */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
213 xs_stil_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
214 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
215 xs_error("Error initializing STIL database!\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
216 }
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
217
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
218 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
220
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
221 /*
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
222 * Initialize XMMS-SID
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
223 */
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
224 void xs_init(void)
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
225 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
226 XSDEBUG("xs_init()\n");
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
227
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
228 /* Initialize and get configuration */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
229 xs_init_configuration();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
230 xs_read_configuration();
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 140
diff changeset
231
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
232 /* Initialize subsystems */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
233 xs_reinit();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
234
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
235 XSDEBUG("OK\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 * Shut down XMMS-SID
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 */
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 void xs_close(void)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
244 XSDEBUG("xs_close(): shutting down...\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
246 /* Stop playing, free structures */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
247 xs_stop();
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
249 xs_tuneinfo_free(xs_status.tuneInfo);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
250 xs_status.tuneInfo = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
251 xs_status.sidPlayer->plrDeleteSID(&xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
252 xs_status.sidPlayer->plrClose(&xs_status);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
254 xs_songlen_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
255 xs_stil_close();
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
256
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
257 XSDEBUG("shutdown finished.\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 /*
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
262 * Check whether the given file is handled by this plugin
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
263 */
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
264 gint xs_is_our_file(gchar *pcFilename)
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
265 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
266 gchar *pcExt;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
267 assert(xs_status.sidPlayer);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
268
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
269 /* Check the filename */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
270 if (pcFilename == NULL)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
271 return FALSE;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
272
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
273 /* Try to detect via detection routine, if required */
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
274 if (xs_cfg.detectMagic) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
275 xs_file_t *f;
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
276 if ((f = xs_fopen(pcFilename, "rb")) != NULL) {
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 477
diff changeset
277 if (xs_status.sidPlayer->plrProbe(f))
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
278 return TRUE;
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
279 xs_fclose(f);
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
280 }
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
281 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
282
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
283 /* Detect just by checking filename extension */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
284 pcExt = xs_strrchr(pcFilename, '.');
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
285 if (pcExt) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
286 pcExt++;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
287 switch (xs_cfg.playerEngine) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
288 case XS_ENG_SIDPLAY1:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
289 case XS_ENG_SIDPLAY2:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
290 if (!g_strcasecmp(pcExt, "psid"))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
291 return TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
292 if (!g_strcasecmp(pcExt, "sid"))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
293 return TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
294 if (!g_strcasecmp(pcExt, "dat"))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
295 return TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
296 if (!g_strcasecmp(pcExt, "inf"))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
297 return TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
298 if (!g_strcasecmp(pcExt, "info"))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
299 return TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
300 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
301 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
302 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
303
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
304 return FALSE;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
305 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
306
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
307
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
308 /*
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 * Main playing thread loop
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 */
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
311 void *xs_playthread(void *argPointer)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
313 xs_status_t myStatus;
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
314 xs_tuneinfo_t *myTune;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
315 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
316 gint audioGot, songLength, i;
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
317 gchar *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
319 (void) argPointer;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
320
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
321 /* Initialize */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
322 XSDEBUG("entering player thread\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
323 XS_MUTEX_LOCK(xs_status);
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
324 memcpy(&myStatus, &xs_status, sizeof(xs_status_t));
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
325 myTune = xs_status.tuneInfo;
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
326 for (i = 0; i <= myTune->nsubTunes; i++)
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
327 myTune->subTunes[i].tunePlayed = FALSE;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
328 XS_MUTEX_UNLOCK(xs_status);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
330 /* Allocate audio buffer */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
331 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
332 if (audioBuffer == NULL) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
333 xs_error("Couldn't allocate memory for audio data buffer!\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
334 goto xs_err_exit;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
335 }
273
f6daddca03c7 Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
336
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
337 if (myStatus.oversampleEnable) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
338 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
339 if (oversampleBuffer == NULL) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
340 xs_error("Couldn't allocate memory for audio oversampling buffer!\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
341 goto xs_err_exit;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
342 }
273
f6daddca03c7 Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents: 264
diff changeset
343 }
241
291715a519e2 Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents: 235
diff changeset
344
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
345 /*
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
346 * Main player loop: while not stopped, loop here - play subtunes
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
347 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
348 audioOpen = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
349 doPlay = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
350 while (xs_status.isPlaying && doPlay) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
351 /* Automatic sub-tune change logic */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
352 XS_MUTEX_LOCK(xs_cfg);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
353 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
354 myStatus.isPlaying = TRUE;
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
355
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
356 if (xs_status.currSong < 1 || myStatus.currSong < 1) {
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
357 XS_MUTEX_UNLOCK(xs_status);
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
358 XS_MUTEX_UNLOCK(xs_cfg);
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
359 goto xs_err_exit;
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
360 }
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
361
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
362 if (xs_cfg.subAutoEnable && (myStatus.currSong == xs_status.currSong)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
363 /* Check if currently selected sub-tune has been played already */
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
364 if (myTune->subTunes[myStatus.currSong-1].tunePlayed) {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
365 /* Find a tune that has not been played */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
366 XSDEBUG("tune #%i already played, finding next match ...\n", myStatus.currSong);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
367 isFound = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
368 i = 0;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
369 while (!isFound && (++i <= myTune->nsubTunes)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
370 if (xs_cfg.subAutoMinOnly) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
371 /* A tune with minimum length must be found */
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
372 if (!myTune->subTunes[i-1].tunePlayed &&
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
373 myTune->subTunes[i-1].tuneLength >= xs_cfg.subAutoMinTime)
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
374 isFound = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
375 } else {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
376 /* Any unplayed tune is okay */
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
377 if (!myTune->subTunes[i-1].tunePlayed)
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
378 isFound = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
379 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
380 }
281
d913f0f69487 Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents: 277
diff changeset
381
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
382 if (isFound) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
383 /* Set the new sub-tune */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
384 XSDEBUG("found #%i\n", i);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
385 xs_status.currSong = i;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
386 } else
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
387 /* This is the end */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
388 doPlay = FALSE;
281
d913f0f69487 Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents: 277
diff changeset
389
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
390 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
391 XS_MUTEX_UNLOCK(xs_cfg);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
392 continue; /* This is ugly, but ... */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
393 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
394 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
395
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
396 /* Tell that we are initializing, update sub-tune controls */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
397 myStatus.currSong = xs_status.currSong;
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
398 myTune->subTunes[myStatus.currSong-1].tunePlayed = TRUE;
306
e6dec620b1b3 Improved locking, still some unlocked parts left, but nothing dangerous.
Matti Hamalainen <ccr@tnsp.org>
parents: 299
diff changeset
399 XS_MUTEX_UNLOCK(xs_status);
e6dec620b1b3 Improved locking, still some unlocked parts left, but nothing dangerous.
Matti Hamalainen <ccr@tnsp.org>
parents: 299
diff changeset
400 XS_MUTEX_UNLOCK(xs_cfg);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
401
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
402 XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong);
281
d913f0f69487 Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents: 277
diff changeset
403
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
404 GDK_THREADS_ENTER();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
405 xs_subctrl_update();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
406 GDK_THREADS_LEAVE();
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
407
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
408 /* Check minimum playtime */
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
409 songLength = myTune->subTunes[myStatus.currSong-1].tuneLength;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
410 if (xs_cfg.playMinTimeEnable && (songLength >= 0)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
411 if (songLength < xs_cfg.playMinTime)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
412 songLength = xs_cfg.playMinTime;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
413 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
415 /* Initialize song */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
416 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
417 xs_error("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n",
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
418 myTune->sidFilename, myStatus.currSong);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
419 goto xs_err_exit;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
420 }
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 464
diff changeset
421
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
422 /* Open the audio output */
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
423 XSDEBUG("open audio output (%d, %d, %d)\n",
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
424 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels);
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
425
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
426 if (!xs_plugin_ip.output->
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
427 open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
428 xs_error("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n",
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
429 myStatus.audioFormat,
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
430 myStatus.audioFrequency,
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
431 myStatus.audioChannels);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
432
277
c27763d388d9 Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents: 276
diff changeset
433 XS_MUTEX_LOCK(xs_status);
c27763d388d9 Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents: 276
diff changeset
434 xs_status.isError = TRUE;
c27763d388d9 Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents: 276
diff changeset
435 XS_MUTEX_UNLOCK(xs_status);
c27763d388d9 Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents: 276
diff changeset
436 goto xs_err_exit;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
437 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
438
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
439 audioOpen = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
440
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
441 /* Set song information for current subtune */
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
442 XSDEBUG("set tune info\n");
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 464
diff changeset
443 myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus);
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
444 tmpTitle = xs_make_titlestring(myTune, myStatus.currSong);
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
445
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
446 xs_plugin_ip.set_info(
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
447 tmpTitle,
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
448 (songLength > 0) ? (songLength * 1000) : 0,
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
449 -1,
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
450 myStatus.audioFrequency,
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
451 myStatus.audioChannels);
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
452
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
453 g_free(tmpTitle);
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
454
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
455 XSDEBUG("playing\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
457 /*
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
458 * Play the subtune
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
459 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
460 while (xs_status.isPlaying && myStatus.isPlaying && (xs_status.currSong == myStatus.currSong)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
461 /* Render audio data */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
462 if (myStatus.oversampleEnable) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
463 /* Perform oversampled rendering */
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
464 audioGot = myStatus.sidPlayer->plrFillBuffer(
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
465 &myStatus,
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
466 oversampleBuffer,
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
467 (XS_AUDIOBUF_SIZE * myStatus.oversampleFactor));
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
469 audioGot /= myStatus.oversampleFactor;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
471 /* Execute rate-conversion with filtering */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
472 if (xs_filter_rateconv(audioBuffer, oversampleBuffer,
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
473 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
474 xs_error("Oversampling rate-conversion pass failed.\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
475 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
476 xs_status.isError = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
477 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
478 goto xs_err_exit;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
479 }
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
480 } else {
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
481 audioGot = myStatus.sidPlayer->plrFillBuffer(
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
482 &myStatus, audioBuffer, XS_AUDIOBUF_SIZE);
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
483 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
484
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
485 /* I <3 visualice/haujobb */
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
486 xs_plugin_ip.add_vis_pcm(
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
487 xs_plugin_ip.output->written_time(),
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
488 myStatus.audioFormat, myStatus.audioChannels,
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
489 audioGot, audioBuffer);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
491 /* Wait a little */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
492 while (xs_status.isPlaying &&
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
493 (xs_status.currSong == myStatus.currSong) &&
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
494 (xs_plugin_ip.output->buffer_free() < audioGot))
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
495 xmms_usleep(500);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
496
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
497 /* Output audio */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
498 if (xs_status.isPlaying && (xs_status.currSong == myStatus.currSong))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
499 xs_plugin_ip.output->write_audio(audioBuffer, audioGot);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
500
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
501 /* Check if we have played enough */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
502 if (xs_cfg.playMaxTimeEnable) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
503 if (xs_cfg.playMaxTimeUnknown) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
504 if ((songLength < 0) &&
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
505 (xs_plugin_ip.output->output_time() >= (xs_cfg.playMaxTime * 1000)))
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
506 myStatus.isPlaying = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
507 } else {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
508 if (xs_plugin_ip.output->output_time() >= (xs_cfg.playMaxTime * 1000))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
509 myStatus.isPlaying = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
510 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
511 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
512
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
513 if (songLength >= 0) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
514 if (xs_plugin_ip.output->output_time() >= (songLength * 1000))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
515 myStatus.isPlaying = FALSE;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
519 XSDEBUG("subtune ended/stopped\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
521 /* Close audio output plugin */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
522 if (audioOpen) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
523 XSDEBUG("close audio #1\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
524 xs_plugin_ip.output->close_audio();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
525 audioOpen = FALSE;
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
526 XSDEBUG("closed\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
527 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
529 /* Now determine if we continue by selecting other subtune or something */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
530 if (!myStatus.isPlaying && !xs_cfg.subAutoEnable)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
531 doPlay = FALSE;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
534 xs_err_exit:
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
535 XSDEBUG("out of playing loop\n");
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
536
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
537 /* Close audio output plugin */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
538 if (audioOpen) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
539 XSDEBUG("close audio #2\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
540 xs_plugin_ip.output->close_audio();
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
541 XSDEBUG("closed\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
544 g_free(audioBuffer);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
545 g_free(oversampleBuffer);
241
291715a519e2 Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents: 235
diff changeset
546
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
547 /* Set playing status to false (stopped), thus when
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
548 * XMMS next calls xs_get_time(), it can return appropriate
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
549 * value "not playing" status and XMMS knows to move to
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
550 * next entry in the playlist .. or whatever it wishes.
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
551 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
552 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
553 xs_status.isPlaying = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
554 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
555
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
556 /* Exit the playing thread */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
557 XSDEBUG("exiting thread, bye.\n");
532
bc548249464a Audacious glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
558 XS_THREAD_EXIT(NULL);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 * Start playing the given file
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
564 * Here we load the tune and initialize the playing thread.
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
565 * Usually you would also initialize the output-plugin, but
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
566 * this is XMMS-SID and we do it on the player thread instead.
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
568 void xs_play_file(gchar * pcFilename)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
570 assert(xs_status.sidPlayer);
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
571
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
572 XSDEBUG("play '%s'\n", pcFilename);
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
573
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
574 /* Get tune information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
575 if ((xs_status.tuneInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename)) == NULL)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
576 return;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
577
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
578 /* Initialize the tune */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
579 if (!xs_status.sidPlayer->plrLoadSID(&xs_status, pcFilename)) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
580 xs_tuneinfo_free(xs_status.tuneInfo);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
581 xs_status.tuneInfo = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
582 return;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
583 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
584
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
585 XSDEBUG("load ok\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
586
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
587 /* Set general status information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
588 xs_status.isPlaying = TRUE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
589 xs_status.isError = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
590 xs_status.currSong = xs_status.tuneInfo->startTune;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
591
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
592 /* Start the playing thread! */
536
8cdd288ebb53 Removed cruft.
Matti Hamalainen <ccr@tnsp.org>
parents: 535
diff changeset
593 if (pthread_create(&xs_decode_thread, NULL, xs_playthread, NULL) < 0) {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
594 xs_error("Couldn't create playing thread!\n");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
595 xs_tuneinfo_free(xs_status.tuneInfo);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
596 xs_status.tuneInfo = NULL;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
597 xs_status.sidPlayer->plrDeleteSID(&xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
598 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
599
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
600 /* Okay, here the playing thread has started up and we
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
601 * return from here to XMMS. Rest is up to XMMS's GUI
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
602 * and playing thread.
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
603 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
604 XSDEBUG("systems should be up?\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609 * Stop playing
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
610 * Here we set the playing status to stop and wait for playing
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
611 * thread to shut down. In any "correctly" done plugin, this is
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
612 * also the function where you close the output-plugin, but since
264
2316e524d67b Improved comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
613 * XMMS-SID has special behaviour (audio opened/closed in the
2316e524d67b Improved comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
614 * playing thread), we don't do that here.
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
615 *
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
616 * Finally tune and other memory allocations are free'd.
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 */
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 void xs_stop(void)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 {
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
620 XSDEBUG("stop requested\n");
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
621
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
622 /* Close the sub-tune control window, if any */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
623 xs_subctrl_close();
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
624
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
625 /* Lock xs_status and stop playing thread */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
626 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
627 if (xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
628 XSDEBUG("stopping...\n");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
629 xs_status.isPlaying = FALSE;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
630 XS_MUTEX_UNLOCK(xs_status);
532
bc548249464a Audacious glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
631 XS_THREAD_JOIN(xs_decode_thread);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
632 } else {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
633 XS_MUTEX_UNLOCK(xs_status);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 }
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
635
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
636 XSDEBUG("done, updating status\n");
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
637
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
638 /* Status is now stopped, update the sub-tune
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
639 * controller in fileinfo window (if open)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
640 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
641 xs_fileinfo_update();
241
291715a519e2 Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents: 235
diff changeset
642
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
643 /* Free tune information */
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
644 XS_MUTEX_LOCK(xs_status);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
645 xs_status.sidPlayer->plrDeleteSID(&xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
646 xs_tuneinfo_free(xs_status.tuneInfo);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
647 xs_status.tuneInfo = NULL;
403
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
648 XS_MUTEX_UNLOCK(xs_status);
b2d233cd01ba Add more debugging output.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
649 XSDEBUG("ok\n");
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 /*
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
654 * Pause/unpause the playing
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 */
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656 void xs_pause(short pauseState)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
658 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
659 /* FIXME FIX ME todo: pause should disable sub-tune controls */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
660 XS_MUTEX_UNLOCK(xs_status);
264
2316e524d67b Improved comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 253
diff changeset
661
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
662 xs_subctrl_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
663 xs_fileinfo_update();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
664 xs_plugin_ip.output->pause(pauseState);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
668 /*
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
669 * Pop-up subtune selector
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
670 */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
671 void xs_subctrl_setsong(void)
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
672 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
673 gint n;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
674
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
675 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
676 XS_MUTEX_LOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
677
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
678 if (xs_status.tuneInfo && xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
679 n = (gint) GTK_ADJUSTMENT(xs_subctrl_adj)->value;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
680 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
681 xs_status.currSong = n;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
682 }
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
683
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
684 XS_MUTEX_UNLOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
685 XS_MUTEX_UNLOCK(xs_status);
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
686 }
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
687
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
688
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
689 void xs_subctrl_prevsong(void)
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
690 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
691 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
692
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
693 if (xs_status.tuneInfo && xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
694 if (xs_status.currSong > 1)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
695 xs_status.currSong--;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
696 }
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
697
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
698 XS_MUTEX_UNLOCK(xs_status);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
699
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
700 xs_subctrl_update();
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
701 }
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
702
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
703
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
704 void xs_subctrl_nextsong(void)
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
705 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
706 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
707
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
708 if (xs_status.tuneInfo && xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
709 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
710 xs_status.currSong++;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
711 }
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
712
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
713 XS_MUTEX_UNLOCK(xs_status);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
714
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
715 xs_subctrl_update();
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
716 }
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
717
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
718
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
719 void xs_subctrl_update(void)
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
720 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
721 GtkAdjustment *tmpAdj;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
722
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
723 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
724 XS_MUTEX_LOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
725
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
726 /* Check if control window exists, we are currently playing and have a tune */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
727 if (xs_subctrl) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
728 if (xs_status.tuneInfo && xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
729 tmpAdj = GTK_ADJUSTMENT(xs_subctrl_adj);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
730
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
731 tmpAdj->value = xs_status.currSong;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
732 tmpAdj->lower = 1;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
733 tmpAdj->upper = xs_status.tuneInfo->nsubTunes;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
734 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
735 XS_MUTEX_UNLOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
736 gtk_adjustment_value_changed(tmpAdj);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
737 } else {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
738 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
739 XS_MUTEX_UNLOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
740 xs_subctrl_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
741 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
742 } else {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
743 XS_MUTEX_UNLOCK(xs_subctrl);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
744 XS_MUTEX_UNLOCK(xs_status);
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
745 }
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
746
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
747 xs_fileinfo_update();
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
748 }
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
749
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
750
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
751 void xs_subctrl_close(void)
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
752 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
753 XS_MUTEX_LOCK(xs_subctrl);
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
754
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
755 if (xs_subctrl) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
756 gtk_widget_destroy(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
757 xs_subctrl = NULL;
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
758 }
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
759
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
760 XS_MUTEX_UNLOCK(xs_subctrl);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
761 }
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
762
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
763
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
764 gboolean xs_subctrl_keypress(GtkWidget * win, GdkEventKey * ev)
184
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
765 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
766 (void) win;
184
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
767
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
768 if (ev->keyval == GDK_Escape)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
769 xs_subctrl_close();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
770
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
771 return FALSE;
184
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
772 }
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
773
4406e91d2da3 Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
774
294
f0ece2d20094 Do correct typecasts and declare xs_subctrl_open arguments as void.
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
775 void xs_subctrl_open(void)
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
776 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
777 GtkWidget *frame25, *hbox15, *subctrl_prev, *subctrl_current, *subctrl_next;
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
778
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
779 XS_MUTEX_LOCK(xs_subctrl);
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
780 if (!xs_status.tuneInfo || !xs_status.isPlaying ||
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
781 xs_subctrl || (xs_status.tuneInfo->nsubTunes <= 1)) {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
782 XS_MUTEX_UNLOCK(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
783 return;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
784 }
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
785
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
786 /* Create the pop-up window */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
787 xs_subctrl = gtk_window_new(GTK_WINDOW_DIALOG);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
788 gtk_widget_set_name(xs_subctrl, "xs_subctrl");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
789 gtk_object_set_data(GTK_OBJECT(xs_subctrl), "xs_subctrl", xs_subctrl);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
790
424
faf12767a6f1 Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
791 gtk_window_set_title(GTK_WINDOW(xs_subctrl), _("Subtune Control"));
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
792 gtk_window_set_position(GTK_WINDOW(xs_subctrl), GTK_WIN_POS_MOUSE);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
793 gtk_container_set_border_width(GTK_CONTAINER(xs_subctrl), 0);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
794 gtk_window_set_policy(GTK_WINDOW(xs_subctrl), FALSE, FALSE, FALSE);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
795
627
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
796 XS_SIGNAL_CONNECT(xs_subctrl, "destroy", gtk_widget_destroyed, &xs_subctrl);
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
797 XS_SIGNAL_CONNECT(xs_subctrl, "focus_out_event", xs_subctrl_close, NULL);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
798
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
799 gtk_widget_realize(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
800 gdk_window_set_decorations(xs_subctrl->window, (GdkWMDecoration) 0);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
801
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
802
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
803 /* Create the control widgets */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
804 frame25 = gtk_frame_new(NULL);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
805 gtk_container_add(GTK_CONTAINER(xs_subctrl), frame25);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
806 gtk_container_set_border_width(GTK_CONTAINER(frame25), 2);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
807 gtk_frame_set_shadow_type(GTK_FRAME(frame25), GTK_SHADOW_OUT);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
808
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
809 hbox15 = gtk_hbox_new(FALSE, 4);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
810 gtk_container_add(GTK_CONTAINER(frame25), hbox15);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
811
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
812 subctrl_prev = gtk_button_new_with_label(" < ");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
813 gtk_widget_set_name(subctrl_prev, "subctrl_prev");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
814 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_prev, FALSE, FALSE, 0);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
815
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
816 xs_subctrl_adj = gtk_adjustment_new(xs_status.currSong, 1, xs_status.tuneInfo->nsubTunes, 1, 1, 0);
627
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
817 XS_SIGNAL_CONNECT(xs_subctrl_adj, "value_changed", xs_subctrl_setsong, NULL);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
818
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
819 subctrl_current = gtk_hscale_new(GTK_ADJUSTMENT(xs_subctrl_adj));
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
820 gtk_widget_set_name(subctrl_current, "subctrl_current");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
821 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_current, FALSE, TRUE, 0);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
822 gtk_scale_set_digits(GTK_SCALE(subctrl_current), 0);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
823 gtk_range_set_update_policy(GTK_RANGE(subctrl_current), GTK_UPDATE_DELAYED);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
824 gtk_widget_grab_focus(subctrl_current);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
825
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
826 subctrl_next = gtk_button_new_with_label(" > ");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
827 gtk_widget_set_name(subctrl_next, "subctrl_next");
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
828 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_next, FALSE, FALSE, 0);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
829
627
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
830 XS_SIGNAL_CONNECT(subctrl_prev, "clicked", xs_subctrl_prevsong, NULL);
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
831 XS_SIGNAL_CONNECT(subctrl_next, "clicked", xs_subctrl_nextsong, NULL);
109445214255 More gtk_signal_connect() -> XS_SIGNAL_CONNECT() changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
832 XS_SIGNAL_CONNECT(xs_subctrl, "key_press_event", xs_subctrl_keypress, NULL);
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
833
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
834 gtk_widget_show_all(xs_subctrl);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
835
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
836 XS_MUTEX_UNLOCK(xs_subctrl);
140
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
837 }
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
838
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
839
8b9c14540e53 - Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
840 /*
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
841 * Set the time-seek position
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
842 * The playing thread will do the "seeking", which means sub-tune
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
843 * changing in XMMS-SID's case. iTime argument is time in seconds,
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
844 * in contrast to milliseconds used in other occasions.
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
845 *
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
846 * This function is called whenever position slider is clicked or
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
847 * other method of seeking is used (keyboard, etc.)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
848 */
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
849 void xs_seek(gint iTime)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
850 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
851 /* Check status */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
852 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
853 if (!xs_status.tuneInfo || !xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
854 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
855 return;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
856 }
132
4162a5370b9e Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
857
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
858 /* Act according to settings */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
859 switch (xs_cfg.subsongControl) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
860 case XS_SSC_SEEK:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
861 if (iTime < xs_status.lastTime) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
862 if (xs_status.currSong > 1)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
863 xs_status.currSong--;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
864 } else if (iTime > xs_status.lastTime) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
865 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
866 xs_status.currSong++;
232
e613873c3379 Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents: 230
diff changeset
867 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
868 break;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
869
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
870 case XS_SSC_POPUP:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
871 xs_subctrl_open();
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
872 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
873
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
874 /* If we have song-position patch, check settings */
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
875 #ifdef HAVE_SONG_POSITION
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
876 case XS_SSC_PATCH:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
877 if ((iTime > 0) && (iTime <= xs_status.tuneInfo->nsubTunes))
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
878 xs_status.currSong = iTime;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
879 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
880 #endif
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
881 }
103
fe83646e6baa Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
882
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
883 XS_MUTEX_UNLOCK(xs_status);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
884 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
885
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
886
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
887 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
888 * Return the playing "position/time"
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
889 * Determine current position/time in song. Used by XMMS to update
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
890 * the song clock and position slider and MOST importantly to determine
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
891 * END OF SONG! Return value of -2 means error, XMMS opens an audio
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
892 * error dialog. -1 means end of song (if one was playing currently).
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
893 */
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
894 gint xs_get_time(void)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
895 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
896 /* If errorflag is set, return -2 to signal it to XMMS's idle callback */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
897 XS_MUTEX_LOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
898 if (xs_status.isError) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
899 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
900 return -2;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
901 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
902
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
903 /* If there is no tune, return -1 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
904 if (!xs_status.tuneInfo) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
905 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
906 return -1;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
907 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
908
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
909 /* If tune has ended, return -1 */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
910 if (!xs_status.isPlaying) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
911 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
912 return -1;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
913 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
914
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
915 /* Let's see what we do */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
916 switch (xs_cfg.subsongControl) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
917 case XS_SSC_SEEK:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
918 xs_status.lastTime = (xs_plugin_ip.output->output_time() / 1000);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
919 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
920
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
921 #ifdef HAVE_SONG_POSITION
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
922 case XS_SSC_PATCH:
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
923 set_song_position(xs_status.currSong, 1, xs_status.tuneInfo->nsubTunes);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
924 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
925 #endif
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
926 }
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 225
diff changeset
927
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
928 XS_MUTEX_UNLOCK(xs_status);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
929
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
930 /* Return output time reported by audio output plugin */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
931 return xs_plugin_ip.output->output_time();
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
932 }
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
933
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
934
477
53bdac2e0dcb Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
935 /* Return song information: called by XMMS when initially loading the playlist.
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
936 * Subsequent changes to information are made by the player thread,
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
937 * which uses xs_plugin_ip.set_info();
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
938 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
939 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength)
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
940 {
657
acaba070cf49 Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
941 xs_tuneinfo_t *pInfo;
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
942
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
943 XS_MUTEX_LOCK(xs_status);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
944
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
945 /* Get tune information from emulation engine */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
946 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename);
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
947 if (!pInfo) {
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
948 XS_MUTEX_UNLOCK(xs_status);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
949 return;
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
950 }
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
951
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
952 /* Get sub-tune information, if available */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
953 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) {
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
954 gint tmpInt;
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
955
464
08038c161936 Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents: 462
diff changeset
956 (*songTitle) = xs_make_titlestring(pInfo, pInfo->startTune);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
957
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
958 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
959 if (tmpInt < 0)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
960 (*songLength) = -1;
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
961 else
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
962 (*songLength) = (tmpInt * 1000);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
963 }
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
964
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
965 /* Free tune information */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 354
diff changeset
966 xs_tuneinfo_free(pInfo);
606
59046d70c0ef Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents: 543
diff changeset
967 XS_MUTEX_UNLOCK(xs_status);
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
968 }
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
969