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