Mercurial > hg > xmms-sid
annotate src/xmms-sid.c @ 606:59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 31 Aug 2007 16:54:04 +0000 |
parents | 358b2770d32d |
children | d7389ea52113 |
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 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
422 | 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 | 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 | 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" |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 * Include player engines |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
46 #ifdef HAVE_SIDPLAY1 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 #include "xs_sidplay1.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
48 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
49 #ifdef HAVE_SIDPLAY2 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 #include "xs_sidplay2.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
51 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
52 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
53 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
54 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
55 * List of players and links to their functions |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
56 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
57 t_xs_player xs_playerlist[] = { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
58 #ifdef HAVE_SIDPLAY1 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
59 {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
|
60 xs_sidplay1_probe, |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
61 xs_sidplay1_init, xs_sidplay1_close, |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
62 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
|
63 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
|
64 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
|
65 NULL |
365
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
66 }, |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
67 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
68 #ifdef HAVE_SIDPLAY2 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
69 {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
|
70 xs_sidplay2_probe, |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
71 xs_sidplay2_init, xs_sidplay2_close, |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 xs_sidplay2_flush |
365
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
76 }, |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
77 #endif |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
78 }; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
79 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
80 const gint xs_nplayerlist = (sizeof(xs_playerlist) / sizeof(t_xs_player)); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 |
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 * Global variables |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
85 */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
86 t_xs_status xs_status; |
230 | 87 XS_MUTEX(xs_status); |
532 | 88 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
|
89 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
90 static GtkWidget *xs_subctrl = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
91 static GtkObject *xs_subctrl_adj = NULL; |
230 | 92 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
|
93 |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
94 void xs_subctrl_close(void); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
95 void xs_subctrl_update(void); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
96 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
97 static t_xs_sldb *xs_sldb_db = NULL; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
98 XS_MUTEX(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
99 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
100 gint xs_songlen_init(void); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
101 void xs_songlen_close(void); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
102 t_xs_sldb_node *xs_songlen_get(const gchar *); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
103 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
104 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 /* |
297 | 106 * Error messages |
107 */ | |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
383
diff
changeset
|
108 void xs_error(const char *fmt, ...) |
297 | 109 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
110 va_list ap; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
111 fprintf(stderr, "XMMS-SID: "); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
112 va_start(ap, fmt); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
113 vfprintf(stderr, fmt, ap); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
114 va_end(ap); |
297 | 115 } |
116 | |
299 | 117 #ifndef DEBUG_NP |
118 void XSDEBUG(const char *fmt, ...) | |
119 { | |
120 #ifdef DEBUG | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
121 va_list ap; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
122 fprintf(stderr, "XSDEBUG: "); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
123 va_start(ap, fmt); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
124 vfprintf(stderr, fmt, ap); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
125 va_end(ap); |
299 | 126 #endif |
127 } | |
128 #endif | |
129 | |
461
a1224c1f8670
STILdb handling glue moved to xmms-sid.c
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
130 |
297 | 131 /* |
230 | 132 * Initialization functions |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
133 */ |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
134 void xs_reinit(void) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
135 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
136 gint iPlayer; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
137 gboolean isInitialized; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
138 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
139 /* Stop playing, if we are */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
140 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
141 if (xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
142 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
143 xs_stop(); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
144 } else { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
145 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
|
146 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
147 |
606
59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents:
543
diff
changeset
|
148 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
|
149 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
|
150 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
151 /* Initialize status and sanitize configuration */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
152 xs_memset(&xs_status, 0, sizeof(xs_status)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
153 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
154 if (xs_cfg.audioFrequency < 8000) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
155 xs_cfg.audioFrequency = 8000; |
273
f6daddca03c7
Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
156 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
157 if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
158 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
159 else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
160 xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
161 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
162 if (xs_cfg.audioChannels != XS_CHN_MONO) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
163 xs_cfg.oversampleEnable = FALSE; |
273
f6daddca03c7
Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
164 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
165 xs_status.audioFrequency = xs_cfg.audioFrequency; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
166 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
167 xs_status.audioChannels = xs_cfg.audioChannels; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
168 xs_status.audioFormat = -1; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
169 xs_status.oversampleEnable = xs_cfg.oversampleEnable; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
170 xs_status.oversampleFactor = xs_cfg.oversampleFactor; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
171 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
172 /* Try to initialize emulator engine */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
173 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
|
174 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
175 iPlayer = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
176 isInitialized = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
177 while ((iPlayer < xs_nplayerlist) && !isInitialized) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
178 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
179 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
180 isInitialized = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
181 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer]; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
182 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
183 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
184 iPlayer++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
185 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
187 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
|
188 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
189 iPlayer = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
190 while ((iPlayer < xs_nplayerlist) && !isInitialized) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
191 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
192 isInitialized = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
193 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer]; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
194 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
195 } else |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
196 iPlayer++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
197 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
198 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
199 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
|
200 |
606
59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents:
543
diff
changeset
|
201 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
202 /* 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
|
203 xs_cfg.audioFrequency = xs_status.audioFrequency; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
204 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
205 xs_cfg.audioChannels = xs_status.audioChannels; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
206 xs_cfg.oversampleEnable = xs_status.oversampleEnable; |
273
f6daddca03c7
Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
207 |
606
59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents:
543
diff
changeset
|
208 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
|
209 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
|
210 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
211 /* Initialize song-length database */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
212 xs_songlen_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
213 if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
214 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
|
215 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
216 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
217 /* Initialize STIL database */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
218 xs_stil_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
219 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
220 xs_error(_("Error initializing STIL database!\n")); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
221 } |
606
59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents:
543
diff
changeset
|
222 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
223 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
224 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
225 |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
226 /* |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
227 * Initialize XMMS-SID |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
228 */ |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
229 void xs_init(void) |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
230 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
231 XSDEBUG("xs_init()\n"); |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
232 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
233 /* Initialize and get configuration */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
234 xs_memset(&xs_cfg, 0, sizeof(xs_cfg)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
235 xs_init_configuration(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
236 xs_read_configuration(); |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
237 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
238 /* Initialize subsystems */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
239 xs_reinit(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
240 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
241 XSDEBUG("OK\n"); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
242 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
243 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
244 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
245 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
246 * Shut down XMMS-SID |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
247 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
248 void xs_close(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
249 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
250 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
|
251 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
252 /* Stop playing, free structures */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
253 xs_stop(); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
254 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
255 xs_tuneinfo_free(xs_status.tuneInfo); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
256 xs_status.tuneInfo = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
257 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
258 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
|
259 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
260 xs_songlen_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
261 xs_stil_close(); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
262 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
263 XSDEBUG("shutdown finished.\n"); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
264 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
265 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
266 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
267 /* |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
268 * 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
|
269 */ |
464
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
270 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
|
271 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
272 gchar *pcExt; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
273 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
|
274 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
275 /* Check the filename */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
276 if (pcFilename == NULL) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
277 return FALSE; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
278 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
279 /* 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
|
280 if (xs_cfg.detectMagic) { |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
281 t_xs_file *f; |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
282 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
|
283 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
|
284 return TRUE; |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
285 xs_fclose(f); |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
286 } |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
287 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
288 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
289 /* Detect just by checking filename extension */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
290 pcExt = xs_strrchr(pcFilename, '.'); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
291 if (pcExt) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
292 pcExt++; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
293 switch (xs_cfg.playerEngine) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
294 case XS_ENG_SIDPLAY1: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
295 case XS_ENG_SIDPLAY2: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
296 if (!g_strcasecmp(pcExt, "psid")) |
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, "sid")) |
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 if (!g_strcasecmp(pcExt, "dat")) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
301 return TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
302 if (!g_strcasecmp(pcExt, "inf")) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
303 return TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
304 if (!g_strcasecmp(pcExt, "info")) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
305 return TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
306 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
307 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
308 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
309 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
310 return FALSE; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
311 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
312 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
313 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
314 /* |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
315 * Main playing thread loop |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
316 */ |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
317 void *xs_playthread(void *argPointer) |
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 t_xs_status myStatus; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
320 t_xs_tuneinfo *myTune; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
321 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
322 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
|
323 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
|
324 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
325 (void) argPointer; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
326 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
327 /* Initialize */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
328 XSDEBUG("entering player thread\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
329 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
330 memcpy(&myStatus, &xs_status, sizeof(t_xs_status)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
331 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
|
332 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
|
333 myTune->subTunes[i].tunePlayed = FALSE; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
334 XS_MUTEX_UNLOCK(xs_status); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
335 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
336 /* Allocate audio buffer */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
337 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
338 if (audioBuffer == NULL) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
339 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
|
340 goto xs_err_exit; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
341 } |
273
f6daddca03c7
Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
342 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
343 if (myStatus.oversampleEnable) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
344 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
|
345 if (oversampleBuffer == NULL) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
346 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
|
347 goto xs_err_exit; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
348 } |
273
f6daddca03c7
Merging in oversampling support, audio settings sanitation.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
349 } |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
350 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
351 /* |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
352 * 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
|
353 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
354 audioOpen = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
355 doPlay = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
356 while (xs_status.isPlaying && doPlay) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
357 /* Automatic sub-tune change logic */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
358 XS_MUTEX_LOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
359 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
360 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
|
361 |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
362 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
|
363 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
|
364 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
|
365 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
|
366 } |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
367 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
368 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
|
369 /* 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
|
370 if (myTune->subTunes[myStatus.currSong-1].tunePlayed) { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
371 /* Find a tune that has not been played */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
372 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
|
373 isFound = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
374 i = 0; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
375 while (!isFound && (++i <= myTune->nsubTunes)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
376 if (xs_cfg.subAutoMinOnly) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
377 /* 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
|
378 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
|
379 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
|
380 isFound = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
381 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
382 /* 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
|
383 if (!myTune->subTunes[i-1].tunePlayed) |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
384 isFound = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
385 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
386 } |
281
d913f0f69487
Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents:
277
diff
changeset
|
387 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
388 if (isFound) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
389 /* Set the new sub-tune */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
390 XSDEBUG("found #%i\n", i); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
391 xs_status.currSong = i; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
392 } else |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
393 /* This is the end */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
394 doPlay = FALSE; |
281
d913f0f69487
Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents:
277
diff
changeset
|
395 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
396 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
397 XS_MUTEX_UNLOCK(xs_cfg); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
398 continue; /* This is ugly, but ... */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
399 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
400 } |
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 /* 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
|
403 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
|
404 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
|
405 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
|
406 XS_MUTEX_UNLOCK(xs_cfg); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
407 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
408 XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong); |
281
d913f0f69487
Automatic sub-tune changing.
Matti Hamalainen <ccr@tnsp.org>
parents:
277
diff
changeset
|
409 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
410 GDK_THREADS_ENTER(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
411 xs_subctrl_update(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
412 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
|
413 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
414 /* 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
|
415 songLength = myTune->subTunes[myStatus.currSong-1].tuneLength; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
416 if (xs_cfg.playMinTimeEnable && (songLength >= 0)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
417 if (songLength < xs_cfg.playMinTime) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
418 songLength = xs_cfg.playMinTime; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
419 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
420 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
421 /* Initialize song */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
422 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
423 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
|
424 myTune->sidFilename, myStatus.currSong); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
425 goto xs_err_exit; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
426 } |
472 | 427 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
428 /* Open the audio output */ |
403 | 429 XSDEBUG("open audio output (%d, %d, %d)\n", |
430 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels); | |
431 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
432 if (!xs_plugin_ip.output-> |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
433 open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
434 xs_error(_("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n"), |
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
435 myStatus.audioFormat, |
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
436 myStatus.audioFrequency, |
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
437 myStatus.audioChannels); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
438 |
277
c27763d388d9
Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
439 XS_MUTEX_LOCK(xs_status); |
c27763d388d9
Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
440 xs_status.isError = TRUE; |
c27763d388d9
Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
441 XS_MUTEX_UNLOCK(xs_status); |
c27763d388d9
Fixed oversampling buffer overflow problems.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
442 goto xs_err_exit; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
443 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
444 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
445 audioOpen = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
446 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
447 /* Set song information for current subtune */ |
403 | 448 XSDEBUG("set tune info\n"); |
472 | 449 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
|
450 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
|
451 |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
452 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
|
453 tmpTitle, |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
454 (songLength > 0) ? (songLength * 1000) : 0, |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
455 -1, |
464
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
456 myStatus.audioFrequency, |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
457 myStatus.audioChannels); |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
458 |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
459 g_free(tmpTitle); |
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
460 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
461 XSDEBUG("playing\n"); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
462 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
463 /* |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
464 * Play the subtune |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
465 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
466 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
|
467 /* Render audio data */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
468 if (myStatus.oversampleEnable) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
469 /* Perform oversampled rendering */ |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
470 audioGot = myStatus.sidPlayer->plrFillBuffer( |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
471 &myStatus, |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
472 oversampleBuffer, |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
473 (XS_AUDIOBUF_SIZE * myStatus.oversampleFactor)); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
474 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
475 audioGot /= myStatus.oversampleFactor; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
476 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
477 /* Execute rate-conversion with filtering */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
478 if (xs_filter_rateconv(audioBuffer, oversampleBuffer, |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
479 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
480 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
|
481 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
482 xs_status.isError = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
483 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
484 goto xs_err_exit; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
485 } |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
486 } else { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
487 audioGot = myStatus.sidPlayer->plrFillBuffer( |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
488 &myStatus, audioBuffer, XS_AUDIOBUF_SIZE); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
489 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
490 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
491 /* I <3 visualice/haujobb */ |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
492 xs_plugin_ip.add_vis_pcm( |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
493 xs_plugin_ip.output->written_time(), |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
494 myStatus.audioFormat, myStatus.audioChannels, |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
495 audioGot, audioBuffer); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
496 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
497 /* Wait a little */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
498 while (xs_status.isPlaying && |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
499 (xs_status.currSong == myStatus.currSong) && |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
500 (xs_plugin_ip.output->buffer_free() < audioGot)) |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
501 xmms_usleep(500); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
502 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
503 /* Output audio */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
504 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
|
505 xs_plugin_ip.output->write_audio(audioBuffer, audioGot); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
506 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
507 /* Check if we have played enough */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
508 if (xs_cfg.playMaxTimeEnable) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
509 if (xs_cfg.playMaxTimeUnknown) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
510 if ((songLength < 0) && |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
511 (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
|
512 myStatus.isPlaying = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
513 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
514 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
|
515 myStatus.isPlaying = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
516 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
517 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
518 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
519 if (songLength >= 0) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
520 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
|
521 myStatus.isPlaying = FALSE; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
522 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
523 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
524 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
525 XSDEBUG("subtune ended/stopped\n"); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
526 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
527 /* Close audio output plugin */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
528 if (audioOpen) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
529 XSDEBUG("close audio #1\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
530 xs_plugin_ip.output->close_audio(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
531 audioOpen = FALSE; |
403 | 532 XSDEBUG("closed\n"); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
533 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
534 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
535 /* 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
|
536 if (!myStatus.isPlaying && !xs_cfg.subAutoEnable) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
537 doPlay = FALSE; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
538 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
539 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
540 xs_err_exit: |
403 | 541 XSDEBUG("out of playing loop\n"); |
542 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
543 /* Close audio output plugin */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
544 if (audioOpen) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
545 XSDEBUG("close audio #2\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
546 xs_plugin_ip.output->close_audio(); |
403 | 547 XSDEBUG("closed\n"); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
548 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
549 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
550 g_free(audioBuffer); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
551 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
|
552 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
553 /* Set playing status to false (stopped), thus when |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
554 * 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
|
555 * 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
|
556 * 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
|
557 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
558 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
559 xs_status.isPlaying = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
560 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
561 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
562 /* Exit the playing thread */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
563 XSDEBUG("exiting thread, bye.\n"); |
532 | 564 XS_THREAD_EXIT(NULL); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
565 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
566 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
567 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
568 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
569 * Start playing the given file |
202 | 570 * Here we load the tune and initialize the playing thread. |
571 * Usually you would also initialize the output-plugin, but | |
572 * 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
|
573 */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
574 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
|
575 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
576 assert(xs_status.sidPlayer); |
230 | 577 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
578 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
|
579 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
580 /* Get tune information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
581 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
|
582 return; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
583 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
584 /* Initialize the tune */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
585 if (!xs_status.sidPlayer->plrLoadSID(&xs_status, pcFilename)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
586 xs_tuneinfo_free(xs_status.tuneInfo); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
587 xs_status.tuneInfo = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
588 return; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
589 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
590 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
591 XSDEBUG("load ok\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
592 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
593 /* Set general status information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
594 xs_status.isPlaying = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
595 xs_status.isError = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
596 xs_status.currSong = xs_status.tuneInfo->startTune; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
597 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
598 /* Start the playing thread! */ |
536 | 599 if (pthread_create(&xs_decode_thread, NULL, xs_playthread, NULL) < 0) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
600 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
|
601 xs_tuneinfo_free(xs_status.tuneInfo); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
602 xs_status.tuneInfo = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
603 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
604 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
605 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
606 /* 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
|
607 * 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
|
608 * and playing thread. |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
609 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
610 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
|
611 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
612 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
613 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
614 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
615 * Stop playing |
202 | 616 * Here we set the playing status to stop and wait for playing |
617 * thread to shut down. In any "correctly" done plugin, this is | |
618 * also the function where you close the output-plugin, but since | |
264 | 619 * XMMS-SID has special behaviour (audio opened/closed in the |
620 * playing thread), we don't do that here. | |
202 | 621 * |
622 * 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
|
623 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
624 void xs_stop(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
625 { |
403 | 626 XSDEBUG("stop requested\n"); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
627 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
628 /* Close the sub-tune control window, if any */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
629 xs_subctrl_close(); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
630 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
631 /* Lock xs_status and stop playing thread */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
632 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
633 if (xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
634 XSDEBUG("stopping...\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
635 xs_status.isPlaying = FALSE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
636 XS_MUTEX_UNLOCK(xs_status); |
532 | 637 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
|
638 } else { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
639 XS_MUTEX_UNLOCK(xs_status); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
640 } |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
641 |
403 | 642 XSDEBUG("done, updating status\n"); |
643 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
644 /* Status is now stopped, update the sub-tune |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
645 * controller in fileinfo window (if open) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
646 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
647 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
|
648 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
649 /* Free tune information */ |
403 | 650 XS_MUTEX_LOCK(xs_status); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
651 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
652 xs_tuneinfo_free(xs_status.tuneInfo); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
653 xs_status.tuneInfo = NULL; |
403 | 654 XS_MUTEX_UNLOCK(xs_status); |
655 XSDEBUG("ok\n"); | |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
656 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
657 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
658 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
659 /* |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
660 * Pause/unpause the playing |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
661 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
662 void xs_pause(short pauseState) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
663 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
664 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
665 /* 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
|
666 XS_MUTEX_UNLOCK(xs_status); |
264 | 667 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
668 xs_subctrl_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
669 xs_fileinfo_update(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
670 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
|
671 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
672 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
673 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
674 /* |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
675 * Pop-up subtune selector |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
676 */ |
230 | 677 void xs_subctrl_setsong(void) |
678 { | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
679 gint n; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
680 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
681 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
682 XS_MUTEX_LOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
683 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
684 if (xs_status.tuneInfo && xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
685 n = (gint) GTK_ADJUSTMENT(xs_subctrl_adj)->value; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
686 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes)) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
687 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
|
688 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
689 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
690 XS_MUTEX_UNLOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
691 XS_MUTEX_UNLOCK(xs_status); |
230 | 692 } |
693 | |
694 | |
695 void xs_subctrl_prevsong(void) | |
696 { | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
697 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
698 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
699 if (xs_status.tuneInfo && xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
700 if (xs_status.currSong > 1) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
701 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
|
702 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
703 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
704 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
|
705 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
706 xs_subctrl_update(); |
230 | 707 } |
708 | |
709 | |
710 void xs_subctrl_nextsong(void) | |
711 { | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
712 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
713 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
714 if (xs_status.tuneInfo && xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
715 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
716 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
|
717 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
718 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
719 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
|
720 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
721 xs_subctrl_update(); |
230 | 722 } |
723 | |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
724 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
725 void xs_subctrl_update(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
726 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
727 GtkAdjustment *tmpAdj; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
728 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
729 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
730 XS_MUTEX_LOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
731 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
732 /* 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
|
733 if (xs_subctrl) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
734 if (xs_status.tuneInfo && xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
735 tmpAdj = GTK_ADJUSTMENT(xs_subctrl_adj); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
736 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
737 tmpAdj->value = xs_status.currSong; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
738 tmpAdj->lower = 1; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
739 tmpAdj->upper = xs_status.tuneInfo->nsubTunes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
740 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
741 XS_MUTEX_UNLOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
742 gtk_adjustment_value_changed(tmpAdj); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
743 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
744 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
745 XS_MUTEX_UNLOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
746 xs_subctrl_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
747 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
748 } else { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
749 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
|
750 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
|
751 } |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
752 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
753 xs_fileinfo_update(); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
754 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
755 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
756 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
757 void xs_subctrl_close(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
758 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
759 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
|
760 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
761 if (xs_subctrl) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
762 gtk_widget_destroy(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
763 xs_subctrl = NULL; |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
764 } |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
765 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
766 XS_MUTEX_UNLOCK(xs_subctrl); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
767 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
768 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
769 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
770 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
|
771 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
772 (void) win; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
773 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
774 if (ev->keyval == GDK_Escape) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
775 xs_subctrl_close(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
776 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
777 return FALSE; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
778 } |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
779 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
780 |
294
f0ece2d20094
Do correct typecasts and declare xs_subctrl_open arguments as void.
Matti Hamalainen <ccr@tnsp.org>
parents:
281
diff
changeset
|
781 void xs_subctrl_open(void) |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
782 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
783 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
|
784 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
785 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
|
786 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
|
787 xs_subctrl || (xs_status.tuneInfo->nsubTunes <= 1)) { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
788 XS_MUTEX_UNLOCK(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
789 return; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
790 } |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
791 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
792 /* Create the pop-up window */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
793 xs_subctrl = gtk_window_new(GTK_WINDOW_DIALOG); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
794 gtk_widget_set_name(xs_subctrl, "xs_subctrl"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
795 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
|
796 |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
797 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
|
798 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
|
799 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
|
800 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
|
801 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
802 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &xs_subctrl); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
803 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
804 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "focus_out_event", GTK_SIGNAL_FUNC(xs_subctrl_close), NULL); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
805 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
806 gtk_widget_realize(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
807 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
|
808 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
809 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
810 /* Create the control widgets */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
811 frame25 = gtk_frame_new(NULL); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
812 gtk_container_add(GTK_CONTAINER(xs_subctrl), frame25); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
813 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
|
814 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
|
815 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
816 hbox15 = gtk_hbox_new(FALSE, 4); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
817 gtk_container_add(GTK_CONTAINER(frame25), hbox15); |
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_prev = gtk_button_new_with_label(" < "); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
820 gtk_widget_set_name(subctrl_prev, "subctrl_prev"); |
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_prev, FALSE, FALSE, 0); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
822 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
823 xs_subctrl_adj = gtk_adjustment_new(xs_status.currSong, 1, xs_status.tuneInfo->nsubTunes, 1, 1, 0); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
824 gtk_signal_connect(GTK_OBJECT(xs_subctrl_adj), "value_changed", GTK_SIGNAL_FUNC(xs_subctrl_setsong), NULL); |
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_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
|
827 gtk_widget_set_name(subctrl_current, "subctrl_current"); |
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_current, FALSE, TRUE, 0); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
829 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
|
830 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
|
831 gtk_widget_grab_focus(subctrl_current); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
832 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
833 subctrl_next = gtk_button_new_with_label(" > "); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
834 gtk_widget_set_name(subctrl_next, "subctrl_next"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
835 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
|
836 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
837 gtk_signal_connect(GTK_OBJECT(subctrl_prev), "clicked", GTK_SIGNAL_FUNC(xs_subctrl_prevsong), NULL); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
838 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
839 gtk_signal_connect(GTK_OBJECT(subctrl_next), "clicked", GTK_SIGNAL_FUNC(xs_subctrl_nextsong), NULL); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
840 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
841 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "key_press_event", GTK_SIGNAL_FUNC(xs_subctrl_keypress), NULL); |
230 | 842 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
843 gtk_widget_show_all(xs_subctrl); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
844 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
845 XS_MUTEX_UNLOCK(xs_subctrl); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
846 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
847 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
848 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
849 /* |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
850 * Set the time-seek position |
202 | 851 * The playing thread will do the "seeking", which means sub-tune |
852 * changing in XMMS-SID's case. iTime argument is time in seconds, | |
853 * in contrast to milliseconds used in other occasions. | |
854 * | |
855 * This function is called whenever position slider is clicked or | |
856 * 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
|
857 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
858 void xs_seek(gint iTime) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
859 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
860 /* Check status */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
861 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
862 if (!xs_status.tuneInfo || !xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
863 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
864 return; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
865 } |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
866 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
867 /* Act according to settings */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
868 switch (xs_cfg.subsongControl) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
869 case XS_SSC_SEEK: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
870 if (iTime < xs_status.lastTime) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
871 if (xs_status.currSong > 1) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
872 xs_status.currSong--; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
873 } else if (iTime > xs_status.lastTime) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
874 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
875 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
|
876 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
877 break; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
878 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
879 case XS_SSC_POPUP: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
880 xs_subctrl_open(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
881 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
882 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
883 /* 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
|
884 #ifdef HAVE_SONG_POSITION |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
885 case XS_SSC_PATCH: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
886 if ((iTime > 0) && (iTime <= xs_status.tuneInfo->nsubTunes)) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
887 xs_status.currSong = iTime; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
888 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
889 #endif |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
890 } |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
891 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
892 XS_MUTEX_UNLOCK(xs_status); |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
895 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
896 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
897 * Return the playing "position/time" |
202 | 898 * Determine current position/time in song. Used by XMMS to update |
899 * the song clock and position slider and MOST importantly to determine | |
900 * END OF SONG! Return value of -2 means error, XMMS opens an audio | |
901 * 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
|
902 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
903 gint xs_get_time(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
904 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
905 /* 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
|
906 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
907 if (xs_status.isError) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
908 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
909 return -2; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
910 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
911 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
912 /* If there is no tune, return -1 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
913 if (!xs_status.tuneInfo) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
914 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
915 return -1; |
230 | 916 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
917 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
918 /* If tune has ended, return -1 */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
919 if (!xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
920 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
921 return -1; |
230 | 922 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
923 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
924 /* Let's see what we do */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
925 switch (xs_cfg.subsongControl) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
926 case XS_SSC_SEEK: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
927 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
|
928 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
929 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
930 #ifdef HAVE_SONG_POSITION |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
931 case XS_SSC_PATCH: |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
932 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
|
933 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
934 #endif |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
935 } |
230 | 936 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
937 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
938 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
939 /* Return output time reported by audio output plugin */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
940 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
|
941 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
942 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
943 |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
944 /* Return song information: called by XMMS when initially loading the playlist. |
202 | 945 * Subsequent changes to information are made by the player thread, |
946 * 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
|
947 */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
948 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
|
949 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
950 t_xs_tuneinfo *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
|
951 |
59046d70c0ef
Fixed a thread race conds in xs_reinit() and xs_get_song_info()
Matti Hamalainen <ccr@tnsp.org>
parents:
543
diff
changeset
|
952 XS_MUTEX_LOCK(xs_status); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
953 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
954 /* Get tune information from emulation engine */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
955 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
|
956 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
|
957 XS_MUTEX_UNLOCK(xs_status); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
958 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
|
959 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
960 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
961 /* Get sub-tune information, if available */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
962 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
|
963 gint tmpInt; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
964 |
464
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
965 (*songTitle) = xs_make_titlestring(pInfo, pInfo->startTune); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
966 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
967 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
968 if (tmpInt < 0) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
969 (*songLength) = -1; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
970 else |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
971 (*songLength) = (tmpInt * 1000); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
972 } |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
973 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
974 /* Free tune information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
975 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
|
976 XS_MUTEX_UNLOCK(xs_status); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
977 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
978 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
979 |
230 | 980 /* Allocate a new tune information structure |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
981 */ |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
982 t_xs_tuneinfo *xs_tuneinfo_new(const gchar * pcFilename, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
983 gint nsubTunes, gint startTune, const gchar * sidName, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
984 const gchar * sidComposer, const gchar * sidCopyright, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
985 gint loadAddr, gint initAddr, gint playAddr, |
464
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
986 gint dataFileLen, const gchar *sidFormat, gint sidModel) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
987 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
988 t_xs_tuneinfo *pResult; |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
989 t_xs_sldb_node *tmpLength; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
990 gint i; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
991 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
992 /* Allocate structure */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
993 pResult = (t_xs_tuneinfo *) g_malloc0(sizeof(t_xs_tuneinfo)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
994 if (!pResult) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
995 xs_error(_("Could not allocate memory for t_xs_tuneinfo ('%s')\n"), |
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
996 pcFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
997 return NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
998 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
999 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1000 pResult->sidFilename = g_strdup(pcFilename); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1001 if (!pResult->sidFilename) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
1002 xs_error(_("Could not allocate sidFilename ('%s')\n"), |
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
1003 pcFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1004 g_free(pResult); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1005 return NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1006 } |
333 | 1007 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1008 /* Allocate space for subtune information */ |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1009 pResult->subTunes = g_malloc0(sizeof(t_xs_subtuneinfo) * (nsubTunes + 1)); |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1010 if (!pResult->subTunes) { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
1011 xs_error(_("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n"), |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1012 pcFilename, nsubTunes); |
333 | 1013 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1014 g_free(pResult->sidFilename); |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1015 g_free(pResult); |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1016 return NULL; |
333 | 1017 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1018 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1019 /* The following allocations don't matter if they fail */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1020 pResult->sidName = g_strdup(sidName); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1021 pResult->sidComposer = g_strdup(sidComposer); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1022 pResult->sidCopyright = g_strdup(sidCopyright); |
333 | 1023 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1024 pResult->nsubTunes = nsubTunes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1025 pResult->startTune = startTune; |
230 | 1026 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1027 pResult->loadAddr = loadAddr; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1028 pResult->initAddr = initAddr; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1029 pResult->playAddr = playAddr; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1030 pResult->dataFileLen = dataFileLen; |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1031 pResult->sidFormat = g_strdup(sidFormat); |
455 | 1032 |
1033 pResult->sidModel = sidModel; | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1034 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1035 /* Get length information (NOTE: Do not free this!) */ |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1036 tmpLength = xs_songlen_get(pcFilename); |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1037 |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1038 /* Fill in sub-tune information */ |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1039 for (i = 0; i < pResult->nsubTunes; i++) { |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1040 if (tmpLength && (i < tmpLength->nLengths)) |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1041 pResult->subTunes[i].tuneLength = tmpLength->sLengths[i]; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1042 else |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1043 pResult->subTunes[i].tuneLength = -1; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1044 |
464
08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
1045 pResult->subTunes[i].tuneSpeed = -1; |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1046 } |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1047 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1048 return pResult; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
1049 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
1050 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
1051 |
230 | 1052 /* Free given tune information structure |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
1053 */ |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1054 void xs_tuneinfo_free(t_xs_tuneinfo * pTune) |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
1055 { |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1056 if (!pTune) return; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1057 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1058 g_free(pTune->subTunes); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1059 g_free(pTune->sidFilename); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1060 g_free(pTune->sidName); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1061 g_free(pTune->sidComposer); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1062 g_free(pTune->sidCopyright); |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
392
diff
changeset
|
1063 g_free(pTune->sidFormat); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
1064 g_free(pTune); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
1065 } |
461
a1224c1f8670
STILdb handling glue moved to xmms-sid.c
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
1066 |
477
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1067 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1068 /* Song length database handling glue |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1069 */ |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1070 gint xs_songlen_init(void) |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1071 { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1072 XS_MUTEX_LOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1073 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1074 if (!xs_cfg.songlenDBPath) { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1075 XS_MUTEX_UNLOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1076 return -1; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1077 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1078 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1079 XS_MUTEX_LOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1080 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1081 /* Check if already initialized */ |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1082 if (xs_sldb_db) |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1083 xs_sldb_free(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1084 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1085 /* Allocate database */ |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1086 xs_sldb_db = (t_xs_sldb *) g_malloc0(sizeof(t_xs_sldb)); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1087 if (!xs_sldb_db) { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1088 XS_MUTEX_UNLOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1089 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1090 return -2; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1091 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1092 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1093 /* Read the database */ |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1094 if (xs_sldb_read(xs_sldb_db, xs_cfg.songlenDBPath) != 0) { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1095 xs_sldb_free(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1096 xs_sldb_db = NULL; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1097 XS_MUTEX_UNLOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1098 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1099 return -3; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1100 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1101 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1102 /* Create index */ |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1103 if (xs_sldb_index(xs_sldb_db) != 0) { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1104 xs_sldb_free(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1105 xs_sldb_db = NULL; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1106 XS_MUTEX_UNLOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1107 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1108 return -4; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1109 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1110 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1111 XS_MUTEX_UNLOCK(xs_cfg); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1112 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1113 return 0; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1114 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1115 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1116 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1117 void xs_songlen_close(void) |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1118 { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1119 XS_MUTEX_LOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1120 xs_sldb_free(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1121 xs_sldb_db = NULL; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1122 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1123 } |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1124 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1125 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1126 t_xs_sldb_node *xs_songlen_get(const gchar * pcFilename) |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1127 { |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1128 t_xs_sldb_node *pResult; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1129 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1130 XS_MUTEX_LOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1131 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1132 if (xs_cfg.songlenDBEnable && xs_sldb_db) |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1133 pResult = xs_sldb_get(xs_sldb_db, pcFilename); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1134 else |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1135 pResult = NULL; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1136 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1137 XS_MUTEX_UNLOCK(xs_sldb_db); |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1138 |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1139 return pResult; |
53bdac2e0dcb
Moved sldb glue functions here; Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1140 } |