Mercurial > hg > xmms-sid
annotate src/xmms-sid.c @ 200:ec8b735f5418
Support for libNanoSID dropped.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 19 Aug 2004 19:06:02 +0000 |
parents | 2422fb451db1 |
children | fe684a2ccdc7 |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 Written by Matti "ccr" Hamalainen <ccr@tnsp.org> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 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
|
9 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
|
10 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
|
11 (at your option) any later version. |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 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
|
14 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
|
15 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
|
16 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
|
17 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 along with this program; if not, write to the Free Software |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 #include <pthread.h> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 #include <stdlib.h> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 #include <string.h> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 #include <stdio.h> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 #include <errno.h> |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 #include <xmms/plugin.h> |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
29 #include <xmms/util.h> |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
31 #include <gdk/gdkkeysyms.h> |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
32 #include <gtk/gtk.h> |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
33 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 #include "xmms-sid.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 #include "xs_support.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 #include "xs_config.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 #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
|
38 #include "xs_stil.h" |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 #include "xs_interface.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 #include "xs_glade.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
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 * Include player engines |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
46 #ifdef HAVE_SIDPLAY1 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 #include "xs_sidplay1.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
48 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
49 #ifdef HAVE_SIDPLAY2 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 #include "xs_sidplay2.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
51 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
52 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
53 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
54 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
55 * Structure defining methods/functions of each player |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
56 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
57 typedef struct { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
58 gint plrIdent; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
59 gboolean (*plrIsOurFile)(gchar *); |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
60 gboolean (*plrInit)(t_xs_status *); |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
61 void (*plrClose)(t_xs_status *); |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
62 gboolean (*plrInitSong)(t_xs_status *); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
63 guint (*plrFillBuffer)(t_xs_status *, gchar *, guint); |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
64 gboolean (*plrLoadSID)(t_xs_status *, gchar *); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
65 void (*plrDeleteSID)(t_xs_status *); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
66 t_xs_tune* (*plrGetSIDInfo)(gchar *); |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
67 } t_xs_player; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
68 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
69 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
70 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
71 * List of players and links to their functions |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
72 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
73 t_xs_player xs_playerlist[] = { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
74 #ifdef HAVE_SIDPLAY1 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
75 { XS_ENG_SIDPLAY1, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
76 xs_sidplay1_isourfile, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
77 xs_sidplay1_init, xs_sidplay1_close, |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
78 xs_sidplay1_initsong, xs_sidplay1_fillbuffer, |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
79 xs_sidplay1_loadsid, xs_sidplay1_deletesid, |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
80 xs_sidplay1_getsidinfo |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
81 }, |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
82 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
83 #ifdef HAVE_SIDPLAY2 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
84 { XS_ENG_SIDPLAY2, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
85 xs_sidplay2_isourfile, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
86 xs_sidplay2_init, xs_sidplay2_close, |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
87 xs_sidplay2_initsong, xs_sidplay2_fillbuffer, |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
88 xs_sidplay2_loadsid, xs_sidplay2_deletesid, |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
89 xs_sidplay2_getsidinfo |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
90 }, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
91 #endif |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
92 }; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
93 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
94 const gint xs_nplayerlist = (sizeof(xs_playerlist) / sizeof(t_xs_player)); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
95 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 * Global variables |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 static pthread_t xs_decode_thread; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
101 static pthread_mutex_t xs_mutex = PTHREAD_MUTEX_INITIALIZER; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 struct t_xs_cfg xs_cfg; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
103 t_xs_status xs_status; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
104 t_xs_player *xs_player = NULL; |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
105 static GtkWidget *xs_fileinfowin = NULL, |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
106 *xs_subctrl = NULL; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
107 static GtkObject *xs_subctrl_adj = NULL; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
108 static t_xs_tune *xs_fileinfotune = NULL; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
109 static t_xs_stil_node *xs_fileinfostil = NULL; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
110 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
111 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
112 void xs_subctrl_close(void); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
113 void xs_subctrl_update(void); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
114 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
115 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
116 /* |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
117 * Re-initialize some settings |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 */ |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
119 void xs_reinit(void) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 { |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
121 gint iPlayer; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
122 gboolean isInitialized; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
123 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
124 /* Stop playing, if we are */ |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
125 if (xs_status.isPlaying) |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
126 xs_stop(); |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
127 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 /* Initialize status */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 memset(&xs_status, 0, sizeof(xs_status)); |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
130 xs_status.audioFrequency = xs_cfg.audioFrequency; |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
131 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
132 xs_status.audioChannels = xs_cfg.audioChannels; |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
133 xs_status.audioFormat = -1; |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
134 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
135 /* Try to initialize emulator engine */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
136 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
138 iPlayer = 0; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
139 isInitialized = FALSE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
140 while ((iPlayer < xs_nplayerlist) && !isInitialized) |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
141 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
142 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
143 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
144 if (xs_playerlist[iPlayer].plrInit(&xs_status)) |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
145 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
146 isInitialized = TRUE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
147 xs_player = (t_xs_player *) &xs_playerlist[iPlayer]; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
148 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
149 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
150 iPlayer++; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
151 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
152 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
153 XSDEBUG("init#1: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
154 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
155 iPlayer = 0; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
156 while ((iPlayer < xs_nplayerlist) && !isInitialized) |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
157 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
158 if (xs_playerlist[iPlayer].plrInit(&xs_status)) |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
159 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
160 isInitialized = TRUE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
161 xs_player = (t_xs_player *) &xs_playerlist[iPlayer]; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
162 } else |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
163 iPlayer++; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
164 } |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
165 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
166 XSDEBUG("init#2: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
167 |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
168 /* Initialize song-length database */ |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
169 xs_songlen_close(); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
170 if (xs_cfg.songlenDBEnable && (xs_songlen_init() < 0)) |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
171 { |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
172 XSERR("Error initializing song-length database!\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
173 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
174 |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
175 /* Initialize STIL database */ |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
176 xs_stil_close(); |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
177 if (xs_cfg.stilDBEnable && (xs_stil_init() < 0)) |
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
178 { |
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
179 XSERR("Error initializing STIL database!\n"); |
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
180 } |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
181 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
183 |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
184 /* |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
185 * Initialize XMMS-SID |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
186 */ |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
187 void xs_init(void) |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
188 { |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
189 XSDEBUG("xs_init()\n"); |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
190 |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
191 /* Initialize and get configuration */ |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
192 memset(&xs_cfg, 0, sizeof(xs_cfg)); |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
193 xs_read_configuration(); |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
194 |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
195 /* Initialize subsystems */ |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
196 xs_reinit(); |
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
197 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
198 XSDEBUG("OK\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
199 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
200 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
201 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
202 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
203 * Shut down XMMS-SID |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
204 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
205 void xs_close(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
206 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
207 XSDEBUG("xs_close(): shutting down...\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
208 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
209 /* Stop playing, free structures */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
210 xs_stop(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
211 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
212 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
213 xs_status.pTune = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
214 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
215 xs_player->plrDeleteSID(&xs_status); |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
216 xs_player->plrClose(&xs_status); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
217 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
218 xs_songlen_close(); |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
219 xs_stil_close(); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
220 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
221 XSDEBUG("shutdown finished.\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
222 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
223 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
224 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
225 /* |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
226 * 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
|
227 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
228 gint xs_is_our_file(gchar *pcFilename) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
229 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
230 char *pcExt; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
231 assert(xs_player); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
232 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
233 /* Check the filename */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
234 if (pcFilename == NULL) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
235 return FALSE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
236 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
237 /* Try to detect via detection routine, if required */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
238 if (xs_cfg.detectMagic && xs_player->plrIsOurFile(pcFilename)) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
239 return TRUE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
240 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
241 /* Detect just by checking filename extension */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
242 pcExt = strrchr(pcFilename, '.'); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
243 if (pcExt) |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
244 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
245 pcExt++; |
84
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
246 switch (xs_cfg.playerEngine) { |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
247 case XS_ENG_SIDPLAY1: |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
248 case XS_ENG_SIDPLAY2: |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
249 if (!strcasecmp(pcExt, "psid")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
250 if (!strcasecmp(pcExt, "sid")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
251 if (!strcasecmp(pcExt, "dat")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
252 if (!strcasecmp(pcExt, "inf")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
253 if (!strcasecmp(pcExt, "info")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
254 break; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
255 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
256 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
257 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
258 return FALSE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
259 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
260 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
261 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
262 /* |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
263 * Main playing thread loop |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
264 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
265 void *xs_play_loop(void *argPointer) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
266 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
267 t_xs_status myStatus; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
268 t_xs_tune *myTune; |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
269 gboolean audioOpen = FALSE, doPlay = FALSE; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
270 guint audioGot; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
271 gint songLength; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
272 gchar audioBuffer[XS_BUFSIZE]; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
273 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
274 /* Initialize */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
275 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
276 XSDEBUG("entering play thread\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
277 memcpy(&myStatus, &xs_status, sizeof(t_xs_status)); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
278 myTune = xs_status.pTune; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
280 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
281 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
282 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
283 * Main player loop: while not stopped, loop here - play subtunes |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
284 */ |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
285 doPlay = TRUE; |
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
286 while (xs_status.isPlaying && doPlay) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
287 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
288 pthread_mutex_lock(&xs_mutex); |
91 | 289 myStatus.currSong = xs_status.currSong; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
290 pthread_mutex_unlock(&xs_mutex); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
291 xs_subctrl_update(); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
292 |
91 | 293 XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
294 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
295 songLength = myTune->subTunes[myStatus.currSong - 1].tuneLength; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
296 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
297 /* Check minimum playtime */ |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
298 if (xs_cfg.playMinTimeEnable) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
299 { |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
300 if (songLength < xs_cfg.playMinTime) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
301 songLength = xs_cfg.playMinTime; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
302 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
303 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
304 /* Initialize song */ |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
305 if (!xs_player->plrInitSong(&myStatus)) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
306 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
307 XSERR("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n", |
91 | 308 myTune->tuneFilename, myStatus.currSong); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
309 goto xs_err_exit; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
310 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
311 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
312 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
313 /* Get song information for current subtune */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
314 xs_plugin_ip.set_info( |
91 | 315 myTune->subTunes[myStatus.currSong - 1].tuneTitle, |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
316 (songLength > 0) ? (songLength * 1000) : -1, |
91 | 317 (myTune->subTunes[myStatus.currSong - 1].tuneSpeed > 0) ? (myTune->subTunes[myStatus.currSong - 1].tuneSpeed * 1000) : -1, |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
318 myStatus.audioFrequency, |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
319 myStatus.audioChannels); |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
320 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
321 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
322 /* Open the audio output */ |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
323 if (!xs_plugin_ip.output->open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
324 { |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
325 XSERR("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n", |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
326 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
327 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
328 xs_status.isError = TRUE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
329 pthread_mutex_unlock(&xs_mutex); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
330 goto xs_err_exit; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
331 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
332 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
333 audioOpen = TRUE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
334 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
335 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
336 * Play the subtune |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
337 */ |
91 | 338 while (xs_status.isPlaying && myStatus.isPlaying && (xs_status.currSong == myStatus.currSong)) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
339 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
340 /* Render audio data */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
341 audioGot = xs_player->plrFillBuffer(&myStatus, audioBuffer, XS_BUFSIZE); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
342 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
343 /* I <3 visualice/haujobb */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
344 xs_plugin_ip.add_vis_pcm( |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
345 xs_plugin_ip.output->written_time(), |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
346 myStatus.audioFormat, myStatus.audioChannels, |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
347 audioGot, audioBuffer); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
348 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
349 /* Wait a little */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
350 while (xs_status.isPlaying && |
91 | 351 (xs_status.currSong == myStatus.currSong) && |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
352 ((guint) xs_plugin_ip.output->buffer_free() < audioGot)) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
353 xmms_usleep(10000); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
354 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
355 /* Output audio */ |
91 | 356 if (xs_status.isPlaying && (xs_status.currSong == myStatus.currSong)) |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
357 xs_plugin_ip.output->write_audio(audioBuffer, audioGot); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
358 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
359 /* Check if we have played enough */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
360 if (xs_cfg.playMaxTimeEnable) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
361 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
362 if (xs_cfg.playMaxTimeUnknown) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
363 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
364 if ((songLength == -1) && |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
365 (xs_plugin_ip.output->output_time() >= (xs_cfg.playMaxTime * 1000))) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
366 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
367 } else { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
368 if (xs_plugin_ip.output->output_time() >= (xs_cfg.playMaxTime * 1000)) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
369 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
370 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
371 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
372 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
373 if (songLength > 0) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
374 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
375 if (xs_plugin_ip.output->output_time() >= (songLength * 1000)) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
376 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
377 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
378 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
379 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
380 XSDEBUG("subtune ended/stopped\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
381 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
382 /* Close audio */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
383 if (audioOpen) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
384 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
385 XSDEBUG("close audio #1\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
386 xs_plugin_ip.output->close_audio(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
387 audioOpen = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
388 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
389 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
390 /* Now determine if we continue by selecting other subtune or something */ |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
391 if (!myStatus.isPlaying) doPlay = FALSE; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
392 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
393 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
394 xs_err_exit: |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
395 /* Close audio */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
396 if (audioOpen) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
397 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
398 XSDEBUG("close audio #2\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
399 xs_plugin_ip.output->close_audio(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
400 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
401 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
402 /* Exit the playing thread */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
403 XSDEBUG("exiting thread, bye.\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
404 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
405 pthread_mutex_lock(&xs_mutex); |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
406 xs_status.isPlaying = FALSE; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
407 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
408 pthread_exit(NULL); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
409 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
410 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
411 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
412 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
413 * Start playing the given file |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
414 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
415 void xs_play_file(gchar *pcFilename) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
416 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
417 XSDEBUG("play '%s'\n", pcFilename); |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
418 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
419 /* Get tune information */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
420 if ((xs_status.pTune = xs_player->plrGetSIDInfo(pcFilename)) == NULL) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
421 return; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
422 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
423 /* Initialize the tune */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
424 if (!xs_player->plrLoadSID(&xs_status, pcFilename)) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
425 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
426 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
427 xs_status.pTune = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
428 return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
429 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
430 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
431 XSDEBUG("load ok\n"); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
432 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
433 /* Set general status information */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
434 xs_status.isPlaying = TRUE; |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
435 xs_status.isError = FALSE; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
436 xs_status.currSong = xs_status.pTune->startTune; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
437 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
438 /* Start the playing thread! */ |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
439 if (pthread_create(&xs_decode_thread, NULL, xs_play_loop, NULL) < 0) |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
440 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
441 XSERR("Couldn't start playing thread! Possible reason reported by system: %s\n", strerror(errno)); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
442 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
443 xs_status.pTune = NULL; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
444 xs_player->plrDeleteSID(&xs_status); |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
445 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
446 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
447 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
|
448 } |
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 * Stop playing |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
453 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
454 void xs_stop(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
455 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
456 XSDEBUG("STOP_REQ\n"); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
457 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
458 xs_subctrl_close(); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
459 |
74 | 460 if (xs_status.isPlaying) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
461 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
462 /* Stop playing */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
463 XSDEBUG("stopping...\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
464 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
465 xs_status.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
466 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
467 pthread_join(xs_decode_thread, NULL); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
468 } |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
469 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
470 /* Free tune information */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
471 xs_player->plrDeleteSID(&xs_status); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
472 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
473 xs_status.pTune = NULL; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
474 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
475 /* Update subtune control */ |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
476 xs_subctrl_update(); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
477 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
478 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
479 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
480 /* |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
481 * Pause/unpause the playing |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
482 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
483 void xs_pause(short pauseState) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
484 { |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
485 xs_subctrl_close(); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
486 xs_plugin_ip.output->pause(pauseState); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
487 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
488 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
489 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
490 /* |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
491 * Pop-up subtune selector |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
492 */ |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
493 #define LUW(x...) lookup_widget(xs_fileinfowin, ## x) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
494 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
495 void xs_subctrl_update(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
496 { |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
497 GtkAdjustment *tmpAdj; |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
498 gboolean isEnabled; |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
499 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
500 /* Check if control window exists, we are currently playing and have a tune */ |
189
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
501 if (xs_subctrl) |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
502 { |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
503 if (xs_status.pTune && xs_status.isPlaying) |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
504 { |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
505 tmpAdj = GTK_ADJUSTMENT(xs_subctrl_adj); |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
506 |
189
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
507 tmpAdj->value = xs_status.currSong; |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
508 tmpAdj->lower = 1; |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
509 tmpAdj->upper = xs_status.pTune->nsubTunes; |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
510 gtk_adjustment_value_changed(tmpAdj); |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
511 } else |
e9e97670f7d7
Cosmetic fix: remove pop-up subsong control window if song changes and
Matti Hamalainen <ccr@tnsp.org>
parents:
184
diff
changeset
|
512 xs_subctrl_close(); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
513 } |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
514 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
515 if (xs_fileinfowin) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
516 { |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
517 /* Check if we are currently playing and have a tune */ |
197
2422fb451db1
Check number of subtunes and disable subtune control in fileinfo, if
Matti Hamalainen <ccr@tnsp.org>
parents:
194
diff
changeset
|
518 if (xs_status.pTune && xs_status.isPlaying && (xs_status.pTune->nsubTunes > 1)) |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
519 { |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
520 tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj"))); |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
521 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
522 tmpAdj->value = xs_status.currSong; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
523 tmpAdj->lower = 1; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
524 tmpAdj->upper = xs_status.pTune->nsubTunes; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
525 gtk_adjustment_value_changed(tmpAdj); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
526 isEnabled = TRUE; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
527 } else |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
528 isEnabled = FALSE; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
529 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
530 /* Enable or disable subtune-control in fileinfo window */ |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
531 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_prev"), isEnabled); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
532 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_adj"), isEnabled); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
533 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_next"), isEnabled); |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
534 } |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
535 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
536 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
537 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
538 void xs_fileinfo_setsong(void) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
539 { |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
540 pthread_mutex_lock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
541 xs_status.currSong = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))->value; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
542 pthread_mutex_unlock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
543 } |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
544 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
545 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
546 void xs_subctrl_setsong(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
547 { |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
548 pthread_mutex_lock(&xs_mutex); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
549 xs_status.currSong = GTK_ADJUSTMENT(xs_subctrl_adj)->value; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
550 pthread_mutex_unlock(&xs_mutex); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
551 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
552 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
553 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
554 void xs_subctrl_prevsong(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
555 { |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
556 if (xs_status.pTune && xs_status.isPlaying) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
557 { |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
558 pthread_mutex_lock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
559 if (xs_status.currSong > 1) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
560 xs_status.currSong--; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
561 pthread_mutex_unlock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
562 } |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
563 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
564 xs_subctrl_update(); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
565 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
566 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
567 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
568 void xs_subctrl_nextsong(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
569 { |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
570 if (xs_status.pTune && xs_status.isPlaying) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
571 { |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
572 pthread_mutex_lock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
573 if (xs_status.currSong < xs_status.pTune->nsubTunes) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
574 xs_status.currSong++; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
575 pthread_mutex_unlock(&xs_mutex); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
576 } |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
577 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
578 xs_subctrl_update(); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
579 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
580 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
581 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
582 void xs_subctrl_close(void) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
583 { |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
584 if (xs_subctrl) |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
585 { |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
586 gtk_widget_destroy(xs_subctrl); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
587 xs_subctrl = NULL; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
588 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
589 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
590 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
591 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
592 gboolean xs_subctrl_keypress(GtkWidget *win, GdkEventKey *ev) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
593 { |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
594 if (ev->keyval == GDK_Escape) |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
595 xs_subctrl_close(); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
596 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
597 return FALSE; |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
598 } |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
599 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
600 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
601 void xs_subctrl_open() |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
602 { |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
603 GtkWidget *frame25, *hbox15, *subctrl_prev, *subctrl_current, *subctrl_next; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
604 |
192
bef2d77bada5
Check tune and playing status before opening pop-up song control.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
605 if (!xs_status.pTune || !xs_status.isPlaying || |
194 | 606 xs_subctrl || (xs_status.pTune->nsubTunes <= 1)) return; |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
607 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
608 /* Create the pop-up window */ |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
609 xs_subctrl = gtk_window_new (GTK_WINDOW_DIALOG); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
610 gtk_widget_set_name (xs_subctrl, "xs_subctrl"); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
611 gtk_object_set_data (GTK_OBJECT (xs_subctrl), "xs_subctrl", xs_subctrl); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
612 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
613 gtk_window_set_title(GTK_WINDOW(xs_subctrl), "Subtune Control"); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
614 gtk_window_set_position(GTK_WINDOW(xs_subctrl), GTK_WIN_POS_MOUSE); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
615 gtk_container_set_border_width(GTK_CONTAINER(xs_subctrl), 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
616 gtk_window_set_policy(GTK_WINDOW(xs_subctrl), FALSE, FALSE, FALSE); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
617 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
618 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "destroy", |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
619 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &xs_subctrl); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
620 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
621 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "focus_out_event", |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
622 GTK_SIGNAL_FUNC(xs_subctrl_close), NULL); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
623 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
624 gtk_widget_realize(xs_subctrl); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
625 gdk_window_set_decorations(xs_subctrl->window, 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
626 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
627 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
628 /* Create the control widgets */ |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
629 frame25 = gtk_frame_new (NULL); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
630 gtk_container_add (GTK_CONTAINER (xs_subctrl), frame25); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
631 gtk_container_set_border_width (GTK_CONTAINER (frame25), 2); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
632 gtk_frame_set_shadow_type (GTK_FRAME (frame25), GTK_SHADOW_OUT); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
633 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
634 hbox15 = gtk_hbox_new (FALSE, 4); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
635 gtk_container_add (GTK_CONTAINER (frame25), hbox15); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
636 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
637 subctrl_prev = gtk_button_new_with_label (" < "); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
638 gtk_widget_set_name (subctrl_prev, "subctrl_prev"); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
639 gtk_box_pack_start (GTK_BOX (hbox15), subctrl_prev, FALSE, FALSE, 0); |
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 xs_subctrl_adj = gtk_adjustment_new (xs_status.currSong, 1, xs_status.pTune->nsubTunes, 1, 1, 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
642 gtk_signal_connect (GTK_OBJECT (xs_subctrl_adj), "value_changed", |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
643 GTK_SIGNAL_FUNC (xs_subctrl_setsong), NULL); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
644 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
645 subctrl_current = gtk_hscale_new (GTK_ADJUSTMENT(xs_subctrl_adj)); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
646 gtk_widget_set_name (subctrl_current, "subctrl_current"); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
647 gtk_box_pack_start (GTK_BOX (hbox15), subctrl_current, FALSE, TRUE, 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
648 gtk_scale_set_digits (GTK_SCALE (subctrl_current), 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
649 gtk_range_set_update_policy (GTK_RANGE (subctrl_current), GTK_UPDATE_DELAYED); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
650 gtk_widget_grab_focus (subctrl_current); |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
651 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
652 subctrl_next = gtk_button_new_with_label (" > "); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
653 gtk_widget_set_name (subctrl_next, "subctrl_next"); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
654 gtk_box_pack_start (GTK_BOX (hbox15), subctrl_next, FALSE, FALSE, 0); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
655 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
656 gtk_signal_connect (GTK_OBJECT (subctrl_prev), "clicked", |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
657 GTK_SIGNAL_FUNC (xs_subctrl_prevsong), NULL); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
658 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
659 gtk_signal_connect (GTK_OBJECT (subctrl_next), "clicked", |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
660 GTK_SIGNAL_FUNC (xs_subctrl_nextsong), NULL); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
661 |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
662 gtk_signal_connect (GTK_OBJECT (xs_subctrl), "key_press_event", |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
663 GTK_SIGNAL_FUNC (xs_subctrl_keypress), NULL); |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
664 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
665 gtk_widget_show_all(xs_subctrl); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
666 } |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
667 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
668 |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
669 /* |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
670 * Set the time-seek position |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
671 * (the playing thread will do the "seeking" aka song-change) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
672 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
673 void xs_seek(gint iTime) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
674 { |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
675 /* Check status */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
676 if (!xs_status.pTune || !xs_status.isPlaying) return; |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
677 |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
678 /* Act according to settings */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
679 switch (xs_cfg.subsongControl) { |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
680 case XS_SSC_SEEK: |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
681 if (iTime < xs_status.lastTime) |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
682 xs_subctrl_prevsong(); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
683 else |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
684 if (iTime > xs_status.lastTime) |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
685 xs_subctrl_nextsong(); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
686 break; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
687 |
140
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
688 case XS_SSC_POPUP: |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
689 xs_subctrl_open(); |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
690 break; |
8b9c14540e53
- Added UADE-style popup subsong-selector
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
691 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
692 /* If we have song-position patch, check settings */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
693 #ifdef HAVE_SONG_POSITION |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
694 case XS_SSC_PATCH: |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
695 pthread_mutex_lock(&xs_mutex); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
696 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
697 if ((iTime > 0) && (iTime <= xs_status.pTune->nsubTunes)) |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
698 xs_status.currSong = iTime; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
699 |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
700 pthread_mutex_unlock(&xs_mutex); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
701 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
702 #endif |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
703 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
704 default: |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
705 break; |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
706 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
707 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
708 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
709 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
710 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
711 * Return the playing "position/time" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
712 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
713 gint xs_get_time(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
714 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
715 /* If errorflag is set, return -2 to signal it to XMMS's idle callback */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
716 if (xs_status.isError) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
717 return -2; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
718 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
719 /* If there is no tune, return -1 */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
720 if (!xs_status.pTune) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
721 return -1; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
722 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
723 /* If tune has ended, return -1 */ |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
724 if (!xs_status.isPlaying) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
725 return -1; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
726 |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
727 /* Let's see what we do */ |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
728 switch (xs_cfg.subsongControl) { |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
729 case XS_SSC_SEEK: |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
730 xs_status.lastTime = (xs_plugin_ip.output->output_time() / 1000); |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
731 break; |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
732 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
733 #ifdef HAVE_SONG_POSITION |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
734 case XS_SSC_PATCH: |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
735 pthread_mutex_lock(&xs_mutex); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
736 set_song_position(xs_status.currSong, 1, xs_status.pTune->nsubTunes); |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
737 pthread_mutex_unlock(&xs_mutex); |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
738 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
739 #endif |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
740 } |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
741 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
742 /* Return output time reported by audio output plugin */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
743 return xs_plugin_ip.output->output_time(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
744 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
745 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
746 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
747 /* |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
748 * Return song information |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
749 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
750 void xs_get_song_info(gchar *songFilename, gchar **songTitle, gint *songLength) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
751 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
752 t_xs_tune *pInfo; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
753 gint tmpInt; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
754 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
755 /* Get tune information from emulation engine */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
756 pInfo = xs_player->plrGetSIDInfo(songFilename); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
757 if (!pInfo) return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
758 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
759 /* Get sub-tune information, if available */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
760 if ((pInfo->startTune >= 0) && (pInfo->startTune <= pInfo->nsubTunes)) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
761 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
762 (*songTitle) = g_strdup(pInfo->subTunes[pInfo->startTune - 1].tuneTitle); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
763 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
764 tmpInt = pInfo->subTunes[pInfo->startTune - 1].tuneLength; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
765 if (tmpInt < 0) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
766 (*songLength) = -1; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
767 else |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
768 (*songLength) = (tmpInt * 1000); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
769 } |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
770 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
771 /* Free tune information */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
772 xs_tune_free(pInfo); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
773 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
774 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
775 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
776 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
777 * Allocate a new tune structure |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
778 */ |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
779 t_xs_tune *xs_tune_new(gchar *pcFilename, gint nsubTunes, gint startTune, |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
780 gchar *tuneName, gchar *tuneComposer, gchar *tuneCopyright) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
781 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
782 t_xs_tune *pResult; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
783 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
784 pResult = (t_xs_tune *) g_malloc0(sizeof(t_xs_tune)); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
785 if (!pResult) return NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
786 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
787 pResult->tuneFilename = g_strdup(pcFilename); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
788 if (!pResult->tuneFilename) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
789 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
790 g_free(pResult); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
791 return NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
792 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
793 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
794 pResult->tuneName = g_strdup(tuneName); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
795 pResult->tuneComposer = g_strdup(tuneComposer); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
796 pResult->tuneCopyright = g_strdup(tuneCopyright); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
797 pResult->nsubTunes = nsubTunes; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
798 pResult->startTune = startTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
799 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
800 return pResult; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
801 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
802 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
803 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
804 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
805 * Free tune information |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
806 */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
807 void xs_tune_free(t_xs_tune *pTune) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
808 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
809 gint i; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
810 if (!pTune) return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
811 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
812 g_free(pTune->tuneFilename); pTune->tuneFilename = NULL; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
813 g_free(pTune->tuneName); pTune->tuneName = NULL; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
814 g_free(pTune->tuneComposer); pTune->tuneComposer = NULL; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
815 g_free(pTune->tuneCopyright); pTune->tuneCopyright = NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
816 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
817 for (i = 0; i < pTune->nsubTunes; i++) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
818 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
819 if (pTune->subTunes[i].tuneTitle) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
820 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
821 g_free(pTune->subTunes[i].tuneTitle); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
822 pTune->subTunes[i].tuneTitle = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
823 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
824 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
825 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
826 g_free(pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
827 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
828 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
829 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
830 /* |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
831 * File-information window |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
832 */ |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
833 void xs_fileinfo_ok(void) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
834 { |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
835 gtk_widget_destroy(xs_fileinfowin); |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
836 xs_fileinfowin = NULL; |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
837 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
838 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
839 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
840 void xs_fileinfo_subtune(GtkWidget *widget, void *data) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
841 { |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
842 t_xs_stil_subnode *tmpNode; |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
843 GtkWidget *tmpItem, *tmpText; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
844 gint tmpIndex; |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
845 gchar *subName, *subAuthor; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
846 |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
847 /* Freeze text-widget and delete the old text */ |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
848 tmpText = LUW("fileinfo_sub_info"); |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
849 gtk_text_freeze(GTK_TEXT(tmpText)); |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
850 gtk_text_set_point(GTK_TEXT(tmpText), 0); |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
851 gtk_text_forward_delete(GTK_TEXT(tmpText), |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
852 gtk_text_get_length(GTK_TEXT(tmpText))); |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
853 |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
854 if (xs_fileinfostil) |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
855 { |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
856 /* Get subtune number */ |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
857 tmpItem = gtk_menu_get_active(GTK_MENU(data)); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
858 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
859 |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
860 /* Get subtune information */ |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
861 tmpNode = &xs_fileinfostil->subTune[tmpIndex]; |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
862 subName = tmpNode->pName; |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
863 subAuthor = tmpNode->pAuthor; |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
864 |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
865 /* Put in the new text, if available */ |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
866 if (tmpNode->pInfo) |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
867 { |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
868 gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL, |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
869 tmpNode->pInfo, strlen(tmpNode->pInfo)); |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
870 } |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
871 } else { |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
872 /* We don't have any information */ |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
873 subName = NULL; |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
874 subAuthor = NULL; |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
875 } |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
876 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
877 /* Get and set subtune information */ |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
878 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : ""); |
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
879 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : ""); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
880 |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
881 /* Un-freeze the widget */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
882 gtk_text_thaw(GTK_TEXT(tmpText)); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
883 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
884 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
885 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
886 void xs_fileinfo(gchar *pcFilename) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
887 { |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
888 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
889 t_xs_stil_subnode *tmpNode; |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
890 gchar tmpStr[32], *tmpS; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
891 gint n; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
892 |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
893 /* Free old info, if set */ |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
894 if (xs_fileinfotune) |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
895 xs_tune_free(xs_fileinfotune); |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
896 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
897 /* Get new tune information */ |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
898 if ((xs_fileinfotune = xs_player->plrGetSIDInfo(pcFilename)) == NULL) |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
899 return; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
900 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
901 if (xs_cfg.stilDBEnable) |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
902 xs_fileinfostil = xs_stil_get(pcFilename); |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
903 else |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
904 xs_fileinfostil = NULL; |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
905 |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
906 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
907 /* Check if there already is an open fileinfo window */ |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
908 if (xs_fileinfowin) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
909 { |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
910 /* Raise old window */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
911 gdk_window_raise(xs_fileinfowin->window); |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
912 |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
913 /* Delete items */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
914 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
915 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
916 GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new(); |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
917 } else { |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
918 /* If not, create a new one */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
919 xs_fileinfowin = create_xs_fileinfowin(); |
184
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
920 |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
921 /* Connect additional signals */ |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
922 gtk_signal_connect(GTK_OBJECT( |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
923 gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))), |
4406e91d2da3
Subtune control slider in fileinfo-window now works. Various fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
924 "value_changed", GTK_SIGNAL_FUNC (xs_fileinfo_setsong), NULL); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
925 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
926 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
927 |
138
64a8fa2ba5f2
Fixed the file-info window, which did not update correctly in some cases
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
928 /* Set the generic song information */ |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
929 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename); |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
930 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), xs_fileinfotune->tuneName); |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
931 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), xs_fileinfotune->tuneComposer); |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
932 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), xs_fileinfotune->tuneCopyright); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
933 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
934 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
935 /* Main tune - the pseudo tune */ |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
936 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
937 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
938 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
939 tmpMenuItem = gtk_menu_item_new_with_label ("General info"); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
940 gtk_widget_show (tmpMenuItem); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
941 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
942 gtk_signal_connect (GTK_OBJECT (tmpMenuItem), "activate", |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
943 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
944 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
945 /* Other menu items */ |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
946 for (n = 1; n <= xs_fileinfotune->nsubTunes; n++) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
947 { |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
948 if (xs_fileinfostil) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
949 { |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
950 tmpNode = &xs_fileinfostil->subTune[n]; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
951 if (tmpNode->pName) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
952 tmpS = tmpNode->pName; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
953 else |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
954 if (tmpNode->pInfo) |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
955 tmpS = tmpNode->pInfo; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
956 else |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
957 tmpS = "---"; |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
958 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
959 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
960 } else |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
961 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
962 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
963 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
964 gtk_widget_show (tmpMenuItem); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
965 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
966 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
967 gtk_signal_connect (GTK_OBJECT(tmpMenuItem), "activate", |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
968 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
969 } |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
970 |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
971 /* Set the subtune information */ |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
972 xs_fileinfo_subtune(NULL, tmpMenu); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
973 |
177
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
974 /* Update subtune controls */ |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
975 xs_subctrl_update(); |
6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
976 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
977 /* Show the window */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
978 gtk_widget_show(xs_fileinfowin); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
979 } |