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