Mercurial > audlegacy-plugins
annotate src/sid/xmms-sid.c @ 1307:fbeb9446aa2e audacious-plugins-1.4.0-DR1
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 20 Jul 2007 10:30:28 -0500 |
parents | 05a1a27805c5 |
children | 6aaf2b06f056 |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 Main source file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
19 You should have received a copy of the GNU General Public License along along |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include "xmms-sid.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #ifdef HAVE_STDLIB_H |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 #include <stdarg.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 #include <gdk/gdkkeysyms.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #include <gtk/gtk.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #include "xs_config.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #include "xs_length.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 #include "xs_stil.h" |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
36 #include "xs_title.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #include "xs_filter.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 #include "xs_fileinfo.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 #include "xs_interface.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 #include "xs_glade.h" |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
41 #include "xs_player.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 * Include player engines |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 #ifdef HAVE_SIDPLAY1 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 #include "xs_sidplay1.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 #ifdef HAVE_SIDPLAY2 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 #include "xs_sidplay2.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 * List of players and links to their functions |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 t_xs_player xs_playerlist[] = { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 #ifdef HAVE_SIDPLAY1 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 {XS_ENG_SIDPLAY1, |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
60 xs_sidplay1_probe, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 xs_sidplay1_init, xs_sidplay1_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 xs_sidplay1_initsong, xs_sidplay1_fillbuffer, |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
63 xs_sidplay1_load, xs_sidplay1_delete, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
64 xs_sidplay1_getinfo, xs_sidplay1_updateinfo, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
65 NULL |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 }, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 #ifdef HAVE_SIDPLAY2 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 {XS_ENG_SIDPLAY2, |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
70 xs_sidplay2_probe, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 xs_sidplay2_init, xs_sidplay2_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 xs_sidplay2_initsong, xs_sidplay2_fillbuffer, |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
73 xs_sidplay2_load, xs_sidplay2_delete, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
74 xs_sidplay2_getinfo, xs_sidplay2_updateinfo, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
75 xs_sidplay2_flush |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 }, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 const gint xs_nplayerlist = (sizeof(xs_playerlist) / sizeof(t_xs_player)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 * Global variables |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 t_xs_status xs_status; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
87 XS_MUTEX(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
88 static XS_THREAD_T xs_decode_thread; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 static GtkWidget *xs_subctrl = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 static GtkObject *xs_subctrl_adj = NULL; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
92 XS_MUTEX(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
94 void xs_subctrl_close(void); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
95 void xs_subctrl_update(void); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
96 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
97 static t_xs_sldb *xs_sldb_db = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
98 XS_MUTEX(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
99 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
100 gint xs_songlen_init(void); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
101 void xs_songlen_close(void); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
102 t_xs_sldb_node *xs_songlen_get(const gchar *); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 * Error messages |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
108 void xs_error(const char *fmt, ...) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 va_list ap; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 fprintf(stderr, "XMMS-SID: "); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 va_start(ap, fmt); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 vfprintf(stderr, fmt, ap); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 va_end(ap); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 #ifndef DEBUG_NP |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 void XSDEBUG(const char *fmt, ...) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 #ifdef DEBUG |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 va_list ap; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 fprintf(stderr, "XSDEBUG: "); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 va_start(ap, fmt); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 vfprintf(stderr, fmt, ap); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 va_end(ap); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
130 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 * Initialization functions |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 void xs_reinit(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 gint iPlayer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 gboolean isInitialized; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 /* Stop playing, if we are */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
140 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 if (xs_status.isPlaying) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
142 XS_MUTEX_UNLOCK(xs_status); |
563 | 143 xs_stop(NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 } else { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
145 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
147 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 /* Initialize status and sanitize configuration */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 xs_memset(&xs_status, 0, sizeof(xs_status)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 if (xs_cfg.audioFrequency < 8000) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 xs_cfg.audioFrequency = 8000; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 if (xs_cfg.audioChannels != XS_CHN_MONO) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 xs_cfg.oversampleEnable = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 xs_status.audioFrequency = xs_cfg.audioFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 xs_status.audioChannels = xs_cfg.audioChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 xs_status.audioFormat = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 xs_status.oversampleEnable = xs_cfg.oversampleEnable; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 xs_status.oversampleFactor = xs_cfg.oversampleFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 /* Try to initialize emulator engine */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 iPlayer = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 isInitialized = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 while ((iPlayer < xs_nplayerlist) && !isInitialized) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 isInitialized = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 iPlayer++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 XSDEBUG("init#1: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 iPlayer = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 while ((iPlayer < xs_nplayerlist) && !isInitialized) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 isInitialized = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 } else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 iPlayer++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 XSDEBUG("init#2: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 /* Get settings back, in case the chosen emulator backend changed them */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 xs_cfg.audioFrequency = xs_status.audioFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 xs_cfg.audioChannels = xs_status.audioChannels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 xs_cfg.oversampleEnable = xs_status.oversampleEnable; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 /* Initialize song-length database */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 xs_songlen_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
207 xs_error(_("Error initializing song-length database!\n")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 /* Initialize STIL database */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 xs_stil_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
213 xs_error(_("Error initializing STIL database!\n")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 * Initialize XMMS-SID |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 void xs_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 XSDEBUG("xs_init()\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 /* Initialize and get configuration */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 xs_memset(&xs_cfg, 0, sizeof(xs_cfg)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 xs_init_configuration(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 xs_read_configuration(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 /* Initialize subsystems */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 xs_reinit(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 XSDEBUG("OK\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 * Shut down XMMS-SID |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 void xs_close(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 XSDEBUG("xs_close(): shutting down...\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 /* Stop playing, free structures */ |
563 | 245 xs_stop(NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 xs_tuneinfo_free(xs_status.tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 xs_status.tuneInfo = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 xs_status.sidPlayer->plrClose(&xs_status); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 xs_songlen_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 xs_stil_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 XSDEBUG("shutdown finished.\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 * Check whether the given file is handled by this plugin |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
262 gint xs_is_our_file(gchar *pcFilename) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
263 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
264 t_xs_file *f; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
265 assert(xs_status.sidPlayer); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
266 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
267 /* Check the filename */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
268 if (pcFilename == NULL) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
269 return FALSE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
270 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
271 if ((f = xs_fopen(pcFilename, "rb")) != NULL) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
272 if (xs_status.sidPlayer->plrProbe(f)) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
273 return TRUE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
274 xs_fclose(f); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
275 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
276 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
277 return FALSE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
278 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
279 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
280 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
281 gint xs_is_our_file_vfs(gchar *pcFilename, t_xs_file *f) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 assert(xs_status.sidPlayer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 /* Check the filename */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 if (pcFilename == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
289 return xs_status.sidPlayer->plrProbe(f); |
463
1e5cb7a00cb0
[svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents:
462
diff
changeset
|
290 } |
1e5cb7a00cb0
[svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents:
462
diff
changeset
|
291 |
1e5cb7a00cb0
[svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents:
462
diff
changeset
|
292 |
1e5cb7a00cb0
[svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents:
462
diff
changeset
|
293 /* |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 * Main playing thread loop |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 void *xs_playthread(void *argPointer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
298 InputPlayback *pb = argPointer; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 t_xs_status myStatus; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 t_xs_tuneinfo *myTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 gint audioGot, songLength, i; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
303 gchar *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
304 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
305 (void) argPointer; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 /* Initialize */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 XSDEBUG("entering player thread\n"); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
309 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 memcpy(&myStatus, &xs_status, sizeof(t_xs_status)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 myTune = xs_status.tuneInfo; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
312 for (i = 0; i <= myTune->nsubTunes; i++) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
313 myTune->subTunes[i].tunePlayed = FALSE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
314 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 /* Allocate audio buffer */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 if (audioBuffer == NULL) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
319 xs_error(_("Couldn't allocate memory for audio data buffer!\n")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 goto xs_err_exit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 if (myStatus.oversampleEnable) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 if (oversampleBuffer == NULL) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
326 xs_error(_("Couldn't allocate memory for audio oversampling buffer!\n")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 goto xs_err_exit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 * Main player loop: while not stopped, loop here - play subtunes |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 audioOpen = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 doPlay = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 while (xs_status.isPlaying && doPlay) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 /* Automatic sub-tune change logic */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
338 XS_MUTEX_LOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
339 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 myStatus.isPlaying = TRUE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
341 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
342 if (xs_status.currSong < 1 || myStatus.currSong < 1) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
343 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
344 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
345 goto xs_err_exit; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
346 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
347 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 if (xs_cfg.subAutoEnable && (myStatus.currSong == xs_status.currSong)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 /* Check if currently selected sub-tune has been played already */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
350 if (myTune->subTunes[myStatus.currSong-1].tunePlayed) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 /* Find a tune that has not been played */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 XSDEBUG("tune #%i already played, finding next match ...\n", myStatus.currSong); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 isFound = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 i = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 while (!isFound && (++i <= myTune->nsubTunes)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 if (xs_cfg.subAutoMinOnly) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 /* A tune with minimum length must be found */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
358 if (!myTune->subTunes[i-1].tunePlayed && |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
359 myTune->subTunes[i-1].tuneLength >= xs_cfg.subAutoMinTime) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 isFound = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 /* Any unplayed tune is okay */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
363 if (!myTune->subTunes[i-1].tunePlayed) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 isFound = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 if (isFound) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 /* Set the new sub-tune */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 XSDEBUG("found #%i\n", i); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 xs_status.currSong = i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 } else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 /* This is the end */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 doPlay = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
376 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
377 XS_MUTEX_UNLOCK(xs_cfg); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 continue; /* This is ugly, but ... */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 /* Tell that we are initializing, update sub-tune controls */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 myStatus.currSong = xs_status.currSong; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
384 myTune->subTunes[myStatus.currSong-1].tunePlayed = TRUE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
385 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
386 XS_MUTEX_UNLOCK(xs_cfg); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 GDK_THREADS_ENTER(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 xs_subctrl_update(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 GDK_THREADS_LEAVE(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 /* Check minimum playtime */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
395 songLength = myTune->subTunes[myStatus.currSong-1].tuneLength; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 if (xs_cfg.playMinTimeEnable && (songLength >= 0)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 if (songLength < xs_cfg.playMinTime) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 songLength = xs_cfg.playMinTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 /* Initialize song */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
403 xs_error(_("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n"), |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 myTune->sidFilename, myStatus.currSong); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 goto xs_err_exit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 } |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
407 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 /* Open the audio output */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
409 XSDEBUG("open audio output (%d, %d, %d)\n", |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
410 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
411 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
412 if (!pb->output-> |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
413 open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
414 xs_error(_("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n"), |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
415 myStatus.audioFormat, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
416 myStatus.audioFrequency, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
417 myStatus.audioChannels); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
419 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 xs_status.isError = TRUE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
421 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 goto xs_err_exit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 audioOpen = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 /* Set song information for current subtune */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
428 XSDEBUG("set tune info\n"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
429 myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
430 tmpTitle = xs_make_titlestring(myTune, myStatus.currSong); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
431 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
432 xs_plugin_ip.set_info( |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
433 tmpTitle, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
434 (songLength > 0) ? (songLength * 1000) : 0, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
435 -1, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
436 myStatus.audioFrequency, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
437 myStatus.audioChannels); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
438 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
439 g_free(tmpTitle); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
440 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 XSDEBUG("playing\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 * Play the subtune |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 while (xs_status.isPlaying && myStatus.isPlaying && (xs_status.currSong == myStatus.currSong)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 /* Render audio data */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 if (myStatus.oversampleEnable) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 /* Perform oversampled rendering */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
450 audioGot = myStatus.sidPlayer->plrFillBuffer( |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
451 &myStatus, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
452 oversampleBuffer, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
453 (XS_AUDIOBUF_SIZE * myStatus.oversampleFactor)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 audioGot /= myStatus.oversampleFactor; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 /* Execute rate-conversion with filtering */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 if (xs_filter_rateconv(audioBuffer, oversampleBuffer, |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
459 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
460 xs_error(_("Oversampling rate-conversion pass failed.\n")); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
461 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 xs_status.isError = TRUE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
463 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 goto xs_err_exit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 } |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
466 } else { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
467 audioGot = myStatus.sidPlayer->plrFillBuffer( |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
468 &myStatus, audioBuffer, XS_AUDIOBUF_SIZE); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
469 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 /* I <3 visualice/haujobb */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
472 produce_audio(pb->output->written_time(), |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
473 myStatus.audioFormat, myStatus.audioChannels, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
474 audioGot, audioBuffer, NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 /* Wait a little */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 while (xs_status.isPlaying && |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
478 (xs_status.currSong == myStatus.currSong) && |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
479 (pb->output->buffer_free() < audioGot)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 xmms_usleep(500); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 /* Check if we have played enough */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 if (xs_cfg.playMaxTimeEnable) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 if (xs_cfg.playMaxTimeUnknown) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 if ((songLength < 0) && |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
486 (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000))) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 myStatus.isPlaying = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 } else { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
489 if (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 myStatus.isPlaying = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 if (songLength >= 0) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
495 if (pb->output->output_time() >= (songLength * 1000)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 myStatus.isPlaying = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 XSDEBUG("subtune ended/stopped\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 /* Close audio output plugin */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 if (audioOpen) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 XSDEBUG("close audio #1\n"); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
505 pb->output->close_audio(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 audioOpen = FALSE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
507 XSDEBUG("closed\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 /* Now determine if we continue by selecting other subtune or something */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 if (!myStatus.isPlaying && !xs_cfg.subAutoEnable) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 doPlay = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
515 xs_err_exit: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
516 XSDEBUG("out of playing loop\n"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
517 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 /* Close audio output plugin */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 if (audioOpen) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 XSDEBUG("close audio #2\n"); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
521 pb->output->close_audio(); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
522 XSDEBUG("closed\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
525 g_free(audioBuffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 g_free(oversampleBuffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
527 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 /* Set playing status to false (stopped), thus when |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
529 * XMMS next calls xs_get_time(), it can return appropriate |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 * value "not playing" status and XMMS knows to move to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
531 * next entry in the playlist .. or whatever it wishes. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
533 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 xs_status.isPlaying = FALSE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
535 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 /* Exit the playing thread */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 XSDEBUG("exiting thread, bye.\n"); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
539 XS_THREAD_EXIT(NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
540 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 * Start playing the given file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 * Here we load the tune and initialize the playing thread. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 * Usually you would also initialize the output-plugin, but |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 * this is XMMS-SID and we do it on the player thread instead. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
549 void xs_play_file(InputPlayback *pb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
550 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
551 assert(pb); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 assert(xs_status.sidPlayer); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
553 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
554 XSDEBUG("play '%s'\n", pb->filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 /* Get tune information */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
557 if ((xs_status.tuneInfo = xs_status.sidPlayer->plrGetSIDInfo(pb->filename)) == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
560 /* Initialize the tune */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
561 if (!xs_status.sidPlayer->plrLoadSID(&xs_status, pb->filename)) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
562 xs_tuneinfo_free(xs_status.tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
563 xs_status.tuneInfo = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
564 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 XSDEBUG("load ok\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 /* Set general status information */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 xs_status.isPlaying = TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 xs_status.isError = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 xs_status.currSong = xs_status.tuneInfo->startTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 /* Start the playing thread! */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
575 xs_decode_thread = g_thread_create((GThreadFunc) xs_playthread, pb, TRUE, NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 if (xs_decode_thread == NULL) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
577 xs_error(_("Couldn't create playing thread!\n")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 xs_tuneinfo_free(xs_status.tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 xs_status.tuneInfo = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 /* Okay, here the playing thread has started up and we |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 * return from here to XMMS. Rest is up to XMMS's GUI |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 * and playing thread. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 XSDEBUG("systems should be up?\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 * Stop playing |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 * Here we set the playing status to stop and wait for playing |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 * thread to shut down. In any "correctly" done plugin, this is |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 * also the function where you close the output-plugin, but since |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 * XMMS-SID has special behaviour (audio opened/closed in the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 * playing thread), we don't do that here. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 * Finally tune and other memory allocations are free'd. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
601 void xs_stop(InputPlayback *pb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
603 (void) pb; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
604 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
605 XSDEBUG("stop requested\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 /* Close the sub-tune control window, if any */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 xs_subctrl_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 /* Lock xs_status and stop playing thread */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
611 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 if (xs_status.isPlaying) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 XSDEBUG("stopping...\n"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 xs_status.isPlaying = FALSE; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
615 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
616 XS_THREAD_JOIN(xs_decode_thread); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 } else { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
618 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
621 XSDEBUG("done, updating status\n"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
622 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 /* Status is now stopped, update the sub-tune |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 * controller in fileinfo window (if open) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 xs_fileinfo_update(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 /* Free tune information */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
629 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 xs_status.sidPlayer->plrDeleteSID(&xs_status); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 xs_tuneinfo_free(xs_status.tuneInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 xs_status.tuneInfo = NULL; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
633 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
634 XSDEBUG("ok\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 * Pause/unpause the playing |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
641 void xs_pause(InputPlayback *pb, short pauseState) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 xs_subctrl_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 xs_fileinfo_update(); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
645 pb->output->pause(pauseState); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 * Pop-up subtune selector |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 void xs_subctrl_setsong(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 gint n; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
656 XS_MUTEX_LOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
657 XS_MUTEX_LOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 if (xs_status.tuneInfo && xs_status.isPlaying) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 n = (gint) GTK_ADJUSTMENT(xs_subctrl_adj)->value; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 xs_status.currSong = n; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
665 XS_MUTEX_UNLOCK(xs_subctrl); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
666 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 void xs_subctrl_prevsong(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
672 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 if (xs_status.tuneInfo && xs_status.isPlaying) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 if (xs_status.currSong > 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 xs_status.currSong--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
679 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 xs_subctrl_update(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 void xs_subctrl_nextsong(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
687 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 if (xs_status.tuneInfo && xs_status.isPlaying) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 xs_status.currSong++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
694 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 xs_subctrl_update(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 void xs_subctrl_update(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 GtkAdjustment *tmpAdj; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
704 XS_MUTEX_LOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
705 XS_MUTEX_LOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 /* Check if control window exists, we are currently playing and have a tune */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 if (xs_subctrl) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 if (xs_status.tuneInfo && xs_status.isPlaying) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 tmpAdj = GTK_ADJUSTMENT(xs_subctrl_adj); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 tmpAdj->value = xs_status.currSong; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 tmpAdj->lower = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 tmpAdj->upper = xs_status.tuneInfo->nsubTunes; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
715 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
716 XS_MUTEX_UNLOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 gtk_adjustment_value_changed(tmpAdj); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 } else { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
719 XS_MUTEX_UNLOCK(xs_status); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
720 XS_MUTEX_UNLOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 xs_subctrl_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 } else { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
724 XS_MUTEX_UNLOCK(xs_subctrl); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
725 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
726 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 xs_fileinfo_update(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
730 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
732 void xs_subctrl_close(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
734 XS_MUTEX_LOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 if (xs_subctrl) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 gtk_widget_destroy(xs_subctrl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
738 xs_subctrl = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
739 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
740 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
741 XS_MUTEX_UNLOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
743 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
745 gboolean xs_subctrl_keypress(GtkWidget * win, GdkEventKey * ev) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
746 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
747 (void) win; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
749 if (ev->keyval == GDK_Escape) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 xs_subctrl_close(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
751 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
752 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
753 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 void xs_subctrl_open(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 GtkWidget *frame25, *hbox15, *subctrl_prev, *subctrl_current, *subctrl_next; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
760 XS_MUTEX_LOCK(xs_subctrl); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
761 if (!xs_status.tuneInfo || !xs_status.isPlaying || |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
762 xs_subctrl || (xs_status.tuneInfo->nsubTunes <= 1)) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
763 XS_MUTEX_UNLOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 /* Create the pop-up window */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 xs_subctrl = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
769 gtk_window_set_type_hint(GTK_WINDOW(xs_subctrl), GDK_WINDOW_TYPE_HINT_DIALOG); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 gtk_widget_set_name(xs_subctrl, "xs_subctrl"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 g_object_set_data(G_OBJECT(xs_subctrl), "xs_subctrl", xs_subctrl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
773 gtk_window_set_title(GTK_WINDOW(xs_subctrl), _("Subtune Control")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 gtk_window_set_position(GTK_WINDOW(xs_subctrl), GTK_WIN_POS_MOUSE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 gtk_container_set_border_width(GTK_CONTAINER(xs_subctrl), 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 gtk_window_set_policy(GTK_WINDOW(xs_subctrl), FALSE, FALSE, FALSE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 g_signal_connect(G_OBJECT(xs_subctrl), "destroy", G_CALLBACK(gtk_widget_destroyed), &xs_subctrl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 g_signal_connect(G_OBJECT(xs_subctrl), "focus_out_event", G_CALLBACK(xs_subctrl_close), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 gtk_widget_realize(xs_subctrl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 gdk_window_set_decorations(xs_subctrl->window, (GdkWMDecoration) 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 /* Create the control widgets */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 frame25 = gtk_frame_new(NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 gtk_container_add(GTK_CONTAINER(xs_subctrl), frame25); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 gtk_container_set_border_width(GTK_CONTAINER(frame25), 2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 gtk_frame_set_shadow_type(GTK_FRAME(frame25), GTK_SHADOW_OUT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 hbox15 = gtk_hbox_new(FALSE, 4); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 gtk_container_add(GTK_CONTAINER(frame25), hbox15); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 subctrl_prev = gtk_button_new_with_label(" < "); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 gtk_widget_set_name(subctrl_prev, "subctrl_prev"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_prev, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 xs_subctrl_adj = gtk_adjustment_new(xs_status.currSong, 1, xs_status.tuneInfo->nsubTunes, 1, 1, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 g_signal_connect(G_OBJECT(xs_subctrl_adj), "value_changed", G_CALLBACK(xs_subctrl_setsong), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 subctrl_current = gtk_hscale_new(GTK_ADJUSTMENT(xs_subctrl_adj)); |
771 | 803 gtk_widget_set_size_request(subctrl_current, 80, -1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
804 gtk_widget_set_name(subctrl_current, "subctrl_current"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_current, FALSE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
806 gtk_scale_set_digits(GTK_SCALE(subctrl_current), 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 gtk_range_set_update_policy(GTK_RANGE(subctrl_current), GTK_UPDATE_DELAYED); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 gtk_widget_grab_focus(subctrl_current); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 subctrl_next = gtk_button_new_with_label(" > "); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 gtk_widget_set_name(subctrl_next, "subctrl_next"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 gtk_box_pack_start(GTK_BOX(hbox15), subctrl_next, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 g_signal_connect(G_OBJECT(subctrl_prev), "clicked", G_CALLBACK(xs_subctrl_prevsong), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
815 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
816 g_signal_connect(G_OBJECT(subctrl_next), "clicked", G_CALLBACK(xs_subctrl_nextsong), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
817 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
818 g_signal_connect(G_OBJECT(xs_subctrl), "key_press_event", G_CALLBACK(xs_subctrl_keypress), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
819 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
820 gtk_widget_show_all(xs_subctrl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
821 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
822 XS_MUTEX_UNLOCK(xs_subctrl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
824 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 * Set the time-seek position |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
828 * The playing thread will do the "seeking", which means sub-tune |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
829 * changing in XMMS-SID's case. iTime argument is time in seconds, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
830 * in contrast to milliseconds used in other occasions. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
831 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
832 * This function is called whenever position slider is clicked or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
833 * other method of seeking is used (keyboard, etc.) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
834 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
835 void xs_seek(InputPlayback *pb, gint iTime) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
836 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
837 /* Check status */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
838 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
839 if (!xs_status.tuneInfo || !xs_status.isPlaying) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
840 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
841 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
842 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
843 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
844 /* Act according to settings */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
845 switch (xs_cfg.subsongControl) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
846 case XS_SSC_SEEK: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
847 if (iTime < xs_status.lastTime) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
848 if (xs_status.currSong > 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
849 xs_status.currSong--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
850 } else if (iTime > xs_status.lastTime) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
851 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
852 xs_status.currSong++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
853 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
854 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
855 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
856 case XS_SSC_POPUP: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
857 xs_subctrl_open(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
858 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
859 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
860 /* If we have song-position patch, check settings */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
861 #ifdef HAVE_SONG_POSITION |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
862 case XS_SSC_PATCH: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
863 if ((iTime > 0) && (iTime <= xs_status.tuneInfo->nsubTunes)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
864 xs_status.currSong = iTime; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
865 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
866 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
867 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
868 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
869 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
870 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
871 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
872 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
873 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
874 * Return the playing "position/time" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
875 * Determine current position/time in song. Used by XMMS to update |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
876 * the song clock and position slider and MOST importantly to determine |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
877 * END OF SONG! Return value of -2 means error, XMMS opens an audio |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
878 * error dialog. -1 means end of song (if one was playing currently). |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
879 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
880 gint xs_get_time(InputPlayback *pb) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
881 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
882 /* If errorflag is set, return -2 to signal it to XMMS's idle callback */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
883 XS_MUTEX_LOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
884 if (xs_status.isError) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
885 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
886 return -2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
887 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
888 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
889 /* If there is no tune, return -1 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
890 if (!xs_status.tuneInfo) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
891 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
892 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
893 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
894 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
895 /* If tune has ended, return -1 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
896 if (!xs_status.isPlaying) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
897 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
898 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
899 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
900 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
901 /* Let's see what we do */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
902 switch (xs_cfg.subsongControl) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
903 case XS_SSC_SEEK: |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
904 xs_status.lastTime = (pb->output->output_time() / 1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
905 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
906 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
907 #ifdef HAVE_SONG_POSITION |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
908 case XS_SSC_PATCH: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
909 set_song_position(xs_status.currSong, 1, xs_status.tuneInfo->nsubTunes); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
910 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
911 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
912 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
913 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
914 XS_MUTEX_UNLOCK(xs_status); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
915 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
916 /* Return output time reported by audio output plugin */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
917 return pb->output->output_time(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
918 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
919 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
920 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
921 /* Return song information: called by XMMS when initially loading the playlist. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
922 * Subsequent changes to information are made by the player thread, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
923 * which uses xs_plugin_ip.set_info(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
924 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
925 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
926 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
927 t_xs_tuneinfo *pInfo; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
928 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
929 /* Get tune information from emulation engine */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
930 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
931 if (!pInfo) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
932 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
933 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
934 /* Get sub-tune information, if available */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
935 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
936 gint tmpInt; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
937 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
938 (*songTitle) = xs_make_titlestring(pInfo, pInfo->startTune); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
939 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
940 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
941 if (tmpInt < 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
942 (*songLength) = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
943 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
944 (*songLength) = (tmpInt * 1000); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
945 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
946 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
947 /* Free tune information */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
948 xs_tuneinfo_free(pInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
949 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
950 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
951 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
952 TitleInput * xs_get_song_tuple(gchar *songFilename) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
953 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
954 t_xs_tuneinfo *pInfo; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
955 TitleInput *pResult = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
956 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
957 /* Get tune information from emulation engine */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
958 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
959 if (!pInfo) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
960 return NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
961 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
962 /* Get sub-tune information, if available */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
963 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
964 gint tmpInt; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
965 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
966 pResult = xs_make_titletuple(pInfo, pInfo->startTune); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
967 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
968 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
969 if (tmpInt < 0) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
970 pResult->length = -1; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
971 else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
972 pResult->length = (tmpInt * 1000); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
973 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
974 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
975 /* Free tune information */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
976 xs_tuneinfo_free(pInfo); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
977 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
978 return pResult; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
979 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
980 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
981 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
982 /* Allocate a new tune information structure |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
983 */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
984 t_xs_tuneinfo *xs_tuneinfo_new(const gchar * pcFilename, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
985 gint nsubTunes, gint startTune, const gchar * sidName, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
986 const gchar * sidComposer, const gchar * sidCopyright, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
987 gint loadAddr, gint initAddr, gint playAddr, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
988 gint dataFileLen, const gchar *sidFormat, gint sidModel) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
989 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
990 t_xs_tuneinfo *pResult; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
991 t_xs_sldb_node *tmpLength; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
992 gint i; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
993 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
994 /* Allocate structure */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
995 pResult = (t_xs_tuneinfo *) g_malloc0(sizeof(t_xs_tuneinfo)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
996 if (!pResult) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
997 xs_error(_("Could not allocate memory for t_xs_tuneinfo ('%s')\n"), |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
998 pcFilename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
999 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1000 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1001 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1002 pResult->sidFilename = g_filename_to_utf8(pcFilename, -1, NULL, NULL, NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1003 if (!pResult->sidFilename) { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1004 xs_error(_("Could not allocate sidFilename ('%s')\n"), |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1005 pcFilename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1006 g_free(pResult); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1007 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1008 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1009 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1010 /* Allocate space for subtune information */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1011 pResult->subTunes = g_malloc0(sizeof(t_xs_subtuneinfo) * (nsubTunes + 1)); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1012 if (!pResult->subTunes) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1013 xs_error(_("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n"), |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1014 pcFilename, nsubTunes); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1015 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1016 g_free(pResult->sidFilename); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1017 g_free(pResult); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1018 return NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1019 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1020 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1021 /* The following allocations don't matter if they fail */ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1022 pResult->sidName = XS_CS_SID(sidName); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1023 pResult->sidComposer = XS_CS_SID(sidComposer); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1024 pResult->sidCopyright = XS_CS_SID(sidCopyright); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1025 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1026 pResult->nsubTunes = nsubTunes; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1027 pResult->startTune = startTune; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1028 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1029 pResult->loadAddr = loadAddr; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1030 pResult->initAddr = initAddr; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1031 pResult->playAddr = playAddr; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1032 pResult->dataFileLen = dataFileLen; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1033 pResult->sidFormat = XS_CS_SID(sidFormat); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1034 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1035 pResult->sidModel = sidModel; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1036 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1037 /* Get length information (NOTE: Do not free this!) */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1038 tmpLength = xs_songlen_get(pcFilename); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1039 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1040 /* Fill in sub-tune information */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1041 for (i = 0; i < pResult->nsubTunes; i++) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1042 if (tmpLength && (i < tmpLength->nLengths)) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1043 pResult->subTunes[i].tuneLength = tmpLength->sLengths[i]; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1044 else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1045 pResult->subTunes[i].tuneLength = -1; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1046 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1047 pResult->subTunes[i].tuneSpeed = -1; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1048 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1049 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1050 return pResult; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1051 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1052 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1053 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1054 /* Free given tune information structure |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1055 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1056 void xs_tuneinfo_free(t_xs_tuneinfo * pTune) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1057 { |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1058 if (!pTune) return; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1059 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1060 g_free(pTune->subTunes); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1061 g_free(pTune->sidFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1062 g_free(pTune->sidName); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1063 g_free(pTune->sidComposer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1064 g_free(pTune->sidCopyright); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1065 g_free(pTune->sidFormat); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1066 g_free(pTune); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1067 } |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1068 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1069 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1070 /* Song length database handling glue |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1071 */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1072 gint xs_songlen_init(void) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1073 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1074 XS_MUTEX_LOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1075 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1076 if (!xs_cfg.songlenDBPath) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1077 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1078 return -1; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1079 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1080 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1081 XS_MUTEX_LOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1082 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1083 /* Check if already initialized */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1084 if (xs_sldb_db) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1085 xs_sldb_free(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1086 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1087 /* Allocate database */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1088 xs_sldb_db = (t_xs_sldb *) g_malloc0(sizeof(t_xs_sldb)); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1089 if (!xs_sldb_db) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1090 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1091 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1092 return -2; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1093 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1094 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1095 /* Read the database */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1096 if (xs_sldb_read(xs_sldb_db, xs_cfg.songlenDBPath) != 0) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1097 xs_sldb_free(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1098 xs_sldb_db = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1099 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1100 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1101 return -3; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1102 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1103 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1104 /* Create index */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1105 if (xs_sldb_index(xs_sldb_db) != 0) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1106 xs_sldb_free(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1107 xs_sldb_db = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1108 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1109 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1110 return -4; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1111 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1112 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1113 XS_MUTEX_UNLOCK(xs_cfg); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1114 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1115 return 0; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1116 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1117 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1118 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1119 void xs_songlen_close(void) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1120 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1121 XS_MUTEX_LOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1122 xs_sldb_free(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1123 xs_sldb_db = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1124 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1125 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1126 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1127 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1128 t_xs_sldb_node *xs_songlen_get(const gchar * pcFilename) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1129 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1130 t_xs_sldb_node *pResult; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1131 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1132 XS_MUTEX_LOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1133 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1134 if (xs_cfg.songlenDBEnable && xs_sldb_db) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1135 pResult = xs_sldb_get(xs_sldb_db, pcFilename); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1136 else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1137 pResult = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1138 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1139 XS_MUTEX_UNLOCK(xs_sldb_db); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1140 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1141 return pResult; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
563
diff
changeset
|
1142 } |