Mercurial > hg > xmms-sid
annotate src/xmms-sid.c @ 136:92952aeccb77
Minor fixes and improvements, nanosid support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 23 Feb 2004 18:00:00 +0000 |
parents | 4162a5370b9e |
children | 64a8fa2ba5f2 |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 #include "xmms-sid.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 #include "xs_support.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 #include "xs_config.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 #include "xs_length.h" |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
35 #include "xs_stil.h" |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 #include "xs_interface.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 #include "xs_glade.h" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
39 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 * Include player engines |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 */ |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
43 #ifdef HAVE_SIDPLAY1 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 #include "xs_sidplay1.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
45 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
46 #ifdef HAVE_SIDPLAY2 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 #include "xs_sidplay2.h" |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
48 #endif |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
49 #ifdef HAVE_NANOSID |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
50 #include "xs_nanosid.h" |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
51 #endif |
72
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 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
92 #ifdef HAVE_NANOSID |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
93 { XS_ENG_NANOSID, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
94 xs_nanosid_isourfile, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
95 xs_nanosid_init, xs_nanosid_close, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
96 xs_nanosid_initsong, xs_nanosid_fillbuffer, |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
97 xs_nanosid_loadsid, xs_nanosid_deletesid, |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
98 xs_nanosid_getsidinfo |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
99 }, |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
100 #endif |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
101 }; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
102 |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
103 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
|
104 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 * Global variables |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
109 static pthread_t xs_decode_thread; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
110 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
|
111 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
|
112 t_xs_status xs_status; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
113 t_xs_player *xs_player = NULL; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
114 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
115 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
116 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
117 * Initialize XMMS-SID |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 void xs_init(void) |
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 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 XSDEBUG("xs_init()\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 /* Initialize and get configuration */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 memset(&xs_cfg, 0, sizeof(xs_cfg)); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 xs_read_configuration(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 /* Initialize status */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 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
|
135 xs_status.audioFormat = -1; |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
136 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
137 /* Try to initialize emulator engine */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
138 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
|
139 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
140 iPlayer = 0; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
141 isInitialized = FALSE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
142 while ((iPlayer < xs_nplayerlist) && !isInitialized) |
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].plrIdent == xs_cfg.playerEngine) |
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 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
|
147 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
148 isInitialized = TRUE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
149 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
|
150 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
151 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
152 iPlayer++; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
153 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
154 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
155 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
|
156 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
157 iPlayer = 0; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
158 while ((iPlayer < xs_nplayerlist) && !isInitialized) |
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 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
|
161 { |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
162 isInitialized = TRUE; |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
163 xs_player = (t_xs_player *) &xs_playerlist[iPlayer]; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
164 } else |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
165 iPlayer++; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
166 } |
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
167 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
168 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
|
169 |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
170 /* Initialize song-length database */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
171 if (xs_cfg.songlenDBEnable && (xs_songlen_init() < 0)) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
172 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
173 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
|
174 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
175 |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
176 /* Initialize STIL database */ |
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 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
181 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 XSDEBUG("OK\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
183 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
184 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
185 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
187 * Shut down XMMS-SID |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
188 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
189 void xs_close(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
190 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
191 XSDEBUG("xs_close(): shutting down...\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
192 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
193 /* Stop playing, free structures */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
194 xs_stop(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
195 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
196 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
197 xs_status.pTune = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
198 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
199 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
|
200 xs_player->plrClose(&xs_status); |
71
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 xs_songlen_close(); |
99
2bc56809ec0b
STIL-support fixes, variable renaming
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
203 xs_stil_close(); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
204 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
205 XSDEBUG("shutdown finished.\n"); |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
208 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
209 /* |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
210 * 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
|
211 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
212 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
|
213 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
214 char *pcExt; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
215 assert(xs_player); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
216 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
217 /* Check the filename */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
218 if (pcFilename == NULL) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
219 return FALSE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
220 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
221 /* Try to detect via detection routine, if required */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
222 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
|
223 return TRUE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
224 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
225 /* Detect just by checking filename extension */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
226 pcExt = strrchr(pcFilename, '.'); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
227 if (pcExt) |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
228 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
229 pcExt++; |
84
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
230 switch (xs_cfg.playerEngine) { |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
231 case XS_ENG_SIDPLAY1: |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
232 case XS_ENG_SIDPLAY2: |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
233 if (!strcasecmp(pcExt, "psid")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
234 if (!strcasecmp(pcExt, "sid")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
235 if (!strcasecmp(pcExt, "dat")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
236 if (!strcasecmp(pcExt, "inf")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
237 if (!strcasecmp(pcExt, "info")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
238 break; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
239 |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
240 case XS_ENG_NANOSID: |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
241 if (!strcasecmp(pcExt, "zsid")) return TRUE; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
242 break; |
b6966a2447bc
Added some stuff for NanoSID
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
243 } |
73
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 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
246 return FALSE; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
247 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
248 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
249 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
250 /* |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
251 * Main playing thread loop |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
252 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
253 void *xs_play_loop(void *argPointer) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
254 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
255 t_xs_status myStatus; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
256 t_xs_tune *myTune; |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
257 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
|
258 guint audioGot; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
259 gint songLength; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
260 gchar audioBuffer[XS_BUFSIZE]; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
261 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
262 /* Initialize */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
263 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
264 XSDEBUG("entering play thread\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
265 memcpy(&myStatus, &xs_status, sizeof(t_xs_status)); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
266 myTune = xs_status.pTune; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
267 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
268 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
269 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
270 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
271 * 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
|
272 */ |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
273 doPlay = TRUE; |
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
274 while (xs_status.isPlaying && doPlay) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
275 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
276 pthread_mutex_lock(&xs_mutex); |
91 | 277 myStatus.currSong = xs_status.currSong; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
278 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 |
91 | 280 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
|
281 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
282 songLength = myTune->subTunes[myStatus.currSong - 1].tuneLength; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
283 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
284 /* Initialize song */ |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
285 if (!xs_player->plrInitSong(&myStatus)) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
286 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
287 XSERR("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n", |
91 | 288 myTune->tuneFilename, myStatus.currSong); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
289 goto err_exit; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
290 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
291 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
292 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
293 /* 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
|
294 xs_plugin_ip.set_info( |
91 | 295 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
|
296 (songLength > 0) ? (songLength * 1000) : -1, |
91 | 297 (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
|
298 myStatus.audioFrequency, |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
299 myStatus.audioChannels); |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
300 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
301 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
302 /* 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
|
303 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
|
304 { |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
305 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
|
306 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
|
307 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
308 xs_status.isError = TRUE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
309 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
310 goto err_exit; |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
313 audioOpen = TRUE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
314 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
315 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
316 * Play the subtune |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
317 */ |
91 | 318 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
|
319 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
320 /* Render audio data */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
321 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
|
322 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
323 /* I <3 visualice/haujobb */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
324 xs_plugin_ip.add_vis_pcm( |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
325 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
|
326 myStatus.audioFormat, myStatus.audioChannels, |
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
327 audioGot, audioBuffer); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
328 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
329 /* Wait a little */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
330 while (xs_status.isPlaying && |
91 | 331 (xs_status.currSong == myStatus.currSong) && |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
332 ((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
|
333 xmms_usleep(10000); |
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 /* Output audio */ |
91 | 336 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
|
337 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
|
338 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
339 /* Check if we have played enough */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
340 if (xs_cfg.playMaxTimeEnable) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
341 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
342 if (xs_cfg.playMaxTimeUnknown) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
343 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
344 if ((songLength == -1) && |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
345 (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
|
346 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
347 } else { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
348 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
|
349 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
350 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
351 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
352 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
353 if (songLength > 0) |
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 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
|
356 myStatus.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
357 } |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
360 XSDEBUG("subtune ended/stopped\n"); |
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 /* Close audio */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
363 if (audioOpen) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
364 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
365 XSDEBUG("close audio #1\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
366 xs_plugin_ip.output->close_audio(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
367 audioOpen = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
368 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
369 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
370 /* 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
|
371 if (!myStatus.isPlaying) doPlay = FALSE; |
71
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
374 err_exit: |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
375 /* Close audio */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
376 if (audioOpen) |
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 XSDEBUG("close audio #2\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
379 xs_plugin_ip.output->close_audio(); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
380 } |
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 /* Exit the playing thread */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
383 XSDEBUG("exiting thread, bye.\n"); |
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 pthread_mutex_lock(&xs_mutex); |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
386 xs_status.isPlaying = FALSE; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
387 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
388 pthread_exit(NULL); |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
391 |
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 * Start playing the given file |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
394 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
395 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
|
396 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
397 XSDEBUG("play '%s'\n", pcFilename); |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
398 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
399 /* Get tune information */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
400 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
|
401 return; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
402 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
403 /* Initialize the tune */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
404 if (!xs_player->plrLoadSID(&xs_status, pcFilename)) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
405 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
406 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
407 xs_status.pTune = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
408 return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
409 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
410 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
411 XSDEBUG("load ok\n"); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
412 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
413 /* Set general status information */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
414 xs_status.isPlaying = TRUE; |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
415 xs_status.isError = FALSE; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
416 xs_status.currSong = xs_status.pTune->startTune; |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
417 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
418 /* Start the playing thread! */ |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
419 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
|
420 { |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
421 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
|
422 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
423 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
|
424 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
|
425 } |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
426 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
427 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
|
428 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
429 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
430 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
431 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
432 * Stop playing |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
433 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
434 void xs_stop(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
435 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
436 XSDEBUG("STOP_REQ\n"); |
74 | 437 if (xs_status.isPlaying) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
438 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
439 /* Stop playing */ |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
440 XSDEBUG("stopping...\n"); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
441 pthread_mutex_lock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
442 xs_status.isPlaying = FALSE; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
443 pthread_mutex_unlock(&xs_mutex); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
444 pthread_join(xs_decode_thread, NULL); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
445 } |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
446 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
447 /* Free tune information */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
448 xs_player->plrDeleteSID(&xs_status); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
449 xs_tune_free(xs_status.pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
450 xs_status.pTune = NULL; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
451 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
452 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
453 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
454 /* |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
455 * Pause/unpause the playing |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
456 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
457 void xs_pause(short pauseState) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
458 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
459 xs_plugin_ip.output->pause(pauseState); |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
460 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
461 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
462 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
463 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
464 * Set the time-seek position |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
465 * (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
|
466 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
467 void xs_seek(gint iTime) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
468 { |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
469 /* Check status */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
470 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
|
471 |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
472 /* 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
|
473 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
|
474 case XS_SSC_SEEK: |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
475 pthread_mutex_lock(&xs_mutex); |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
476 if (iTime < xs_status.lastTime) |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
477 { |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
478 if (xs_status.currSong > 1) |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
479 xs_status.currSong--; |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
480 } else |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
481 if (iTime > xs_status.lastTime) |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
482 { |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
483 if (xs_status.currSong < xs_status.pTune->nsubTunes) |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
484 xs_status.currSong++; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
485 } |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
486 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
487 pthread_mutex_unlock(&xs_mutex); |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
488 break; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
489 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
490 /* 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
|
491 #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
|
492 case XS_SSC_PATCH: |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
493 pthread_mutex_lock(&xs_mutex); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
494 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
495 if ((iTime > 0) && (iTime <= xs_status.pTune->nsubTunes)) |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
496 xs_status.currSong = iTime; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
497 |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
498 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
|
499 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
500 #endif |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
501 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
502 default: |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
503 break; |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
504 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
505 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
506 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
507 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
508 /* |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
509 * Return the playing "position/time" |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
510 */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
511 gint xs_get_time(void) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
512 { |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
513 /* 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
|
514 if (xs_status.isError) |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
515 return -2; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
516 |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
517 /* If there is no tune, return -1 */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
518 if (!xs_status.pTune) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
519 return -1; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
520 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
521 /* 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
|
522 if (!xs_status.isPlaying) |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
523 return -1; |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
524 |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
525 /* 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
|
526 switch (xs_cfg.subsongControl) { |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
527 case XS_SSC_SEEK: |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
528 xs_status.lastTime = xs_plugin_ip.output->output_time() / 1000; |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
529 break; |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
530 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
531 #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
|
532 case XS_SSC_PATCH: |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
75
diff
changeset
|
533 pthread_mutex_lock(&xs_mutex); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
534 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
|
535 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
|
536 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
537 #endif |
132
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
538 } |
4162a5370b9e
Added "seek"-subsong control option, in style of xmms-sidplay.
Matti Hamalainen <ccr@tnsp.org>
parents:
127
diff
changeset
|
539 |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
540 /* Else, return output time reported by audio output plugin */ |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
541 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
|
542 } |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
543 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
544 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
545 /* |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
546 * Return song information |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
547 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
548 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
|
549 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
550 t_xs_tune *pInfo; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
551 gint tmpInt; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
552 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
553 pInfo = xs_player->plrGetSIDInfo(songFilename); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
554 if (!pInfo) return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
555 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
556 if ((pInfo->startTune >= 0) && (pInfo->startTune <= pInfo->nsubTunes)) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
557 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
558 (*songTitle) = g_strdup(pInfo->subTunes[pInfo->startTune - 1].tuneTitle); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
559 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
560 tmpInt = pInfo->subTunes[pInfo->startTune - 1].tuneLength; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
561 if (tmpInt < 0) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
562 (*songLength) = -1; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
563 else |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
564 (*songLength) = (tmpInt * 1000); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
565 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
566 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
567 xs_tune_free(pInfo); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
568 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
569 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
570 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
571 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
572 * Allocate a new tune structure |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
573 */ |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
574 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
|
575 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
|
576 { |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
577 t_xs_tune *pResult; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
578 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
579 pResult = (t_xs_tune *) g_malloc0(sizeof(t_xs_tune)); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
580 if (!pResult) return NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
581 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
582 pResult->tuneFilename = g_strdup(pcFilename); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
583 if (!pResult->tuneFilename) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
584 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
585 g_free(pResult); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
586 return NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
587 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
588 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
589 pResult->tuneName = g_strdup(tuneName); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
590 pResult->tuneComposer = g_strdup(tuneComposer); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
591 pResult->tuneCopyright = g_strdup(tuneCopyright); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
592 pResult->nsubTunes = nsubTunes; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
593 pResult->startTune = startTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
594 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
595 return pResult; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
596 } |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
597 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
598 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
599 /* |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
600 * Free tune information |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
601 */ |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
602 void xs_tune_free(t_xs_tune *pTune) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
603 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
604 gint i; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
605 if (!pTune) return; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
606 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 g_free(pTune->tuneCopyright); pTune->tuneCopyright = NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
611 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
612 for (i = 0; i < pTune->nsubTunes; i++) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
613 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
614 if (pTune->subTunes[i].tuneTitle) |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
615 { |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
616 g_free(pTune->subTunes[i].tuneTitle); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
617 pTune->subTunes[i].tuneTitle = NULL; |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
618 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
619 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
620 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
621 g_free(pTune); |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
622 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
623 |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
624 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
625 /* |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
626 * File-information window |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
627 */ |
136
92952aeccb77
Minor fixes and improvements, nanosid support.
Matti Hamalainen <ccr@tnsp.org>
parents:
132
diff
changeset
|
628 static GtkWidget *xs_fileinfowin = NULL; |
92952aeccb77
Minor fixes and improvements, nanosid support.
Matti Hamalainen <ccr@tnsp.org>
parents:
132
diff
changeset
|
629 static t_xs_tune *xs_fileinfotune = NULL; |
92952aeccb77
Minor fixes and improvements, nanosid support.
Matti Hamalainen <ccr@tnsp.org>
parents:
132
diff
changeset
|
630 static t_xs_stil_node *xs_fileinfostil = NULL; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
631 #define LUW(x...) lookup_widget(xs_fileinfowin, ## x) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
632 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
633 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
634 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
|
635 { |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
636 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
|
637 xs_fileinfowin = NULL; |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
638 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
639 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
640 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
641 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
|
642 { |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
643 t_xs_stil_subnode *tmpNode; |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
644 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
|
645 gint tmpIndex; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
646 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
647 if (!xs_fileinfostil) return; |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
648 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
649 /* Get number of subtune */ |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
650 tmpItem = gtk_menu_get_active(GTK_MENU(data)); |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
651 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
652 tmpNode = &xs_fileinfostil->subTune[tmpIndex]; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
653 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
654 /* Get and set subtune information */ |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
655 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), tmpNode->pName ? tmpNode->pName : ""); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
656 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), tmpNode->pAuthor ? tmpNode->pAuthor : ""); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
657 |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
658 /* Freeze the widget for update */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
659 tmpText = LUW("fileinfo_sub_info"); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
660 gtk_text_freeze(GTK_TEXT(tmpText)); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
661 |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
662 /* Delete the old text */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
663 gtk_text_set_point(GTK_TEXT(tmpText), 0); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
664 gtk_text_forward_delete(GTK_TEXT(tmpText), |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
665 gtk_text_get_length(GTK_TEXT(tmpText))); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
666 |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
667 if (tmpNode->pInfo) |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
668 { |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
669 /* Put in the new text */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
670 gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL, |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
671 tmpNode->pInfo, strlen(tmpNode->pInfo)); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
672 |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
673 } |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
674 |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
675 /* Un-freeze the widget */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
676 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
|
677 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
678 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
679 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
680 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
|
681 { |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
682 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
|
683 t_xs_stil_subnode *tmpNode; |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
684 gchar tmpStr[32], *tmpS; |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
685 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
|
686 |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
687 /* Free old info, if set */ |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
688 if (xs_fileinfotune) |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
689 xs_tune_free(xs_fileinfotune); |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
690 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
691 /* 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
|
692 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
|
693 return; |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
694 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
695 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
|
696 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
|
697 else |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
698 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
|
699 |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
700 |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
701 /* 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
|
702 if (xs_fileinfowin) |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
703 { |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
704 /* Raise old window */ |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
705 gdk_window_raise(xs_fileinfowin->window); |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
706 |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
707 /* Delete items */ |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
708 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
709 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu); |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
710 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
|
711 } else { |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
712 /* If not, create a new one */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
713 xs_fileinfowin = create_xs_fileinfowin(); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
714 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
715 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
716 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
717 /* Set the song informations */ |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
718 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
|
719 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
|
720 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
|
721 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
|
722 |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
723 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
724 /* Main tune - the pseudo tune */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
725 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
726 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu; |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
727 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
728 tmpMenuItem = gtk_menu_item_new_with_label ("General info"); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
729 gtk_widget_show (tmpMenuItem); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
730 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
731 gtk_signal_connect (GTK_OBJECT (tmpMenuItem), "activate", |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
732 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
733 |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
734 /* Other menu items */ |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
735 for (n = 1; n <= xs_fileinfotune->nsubTunes; n++) |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
736 { |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
737 if (xs_fileinfostil) |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
738 { |
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
739 tmpNode = &xs_fileinfostil->subTune[n]; |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
740 tmpS = (tmpNode->pName) ? tmpNode->pName : "-"; |
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
741 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS); |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
742 } else |
118
5bddcad25ef7
Finalized the fileinfo window code.
Matti Hamalainen <ccr@tnsp.org>
parents:
109
diff
changeset
|
743 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: -", n); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
744 |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
745 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
746 gtk_widget_show (tmpMenuItem); |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
747 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
748 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
749 gtk_signal_connect (GTK_OBJECT(tmpMenuItem), "activate", |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
750 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); |
103
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
751 } |
fe83646e6baa
Changed plrFillBuffer()-functions to return actual number of samples computed.
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
752 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
753 /* Set the sub-tune information */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
754 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
|
755 |
106
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
756 /* Show the window */ |
98a72c44f56b
Fileinfo now working with rudimentary informations. Slightly buggy.
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
757 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
|
758 } |