annotate src/sid/xmms-sid.c @ 2165:624eb07fe591

- set FIELD_LENGTH. - id3_file_open no longer needs unescaped file name.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 13 Nov 2007 05:25:42 +0900
parents 2f11848e0eb5
children 59e8f118ad34
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 #include "xs_config.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include "xs_length.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include "xs_stil.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 #include "xs_filter.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 #include "xs_fileinfo.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include "xs_interface.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 #include "xs_glade.h"
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
39 #include "xs_player.h"
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
40 #include "xs_slsup.h"
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
41
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
2109
2f11848e0eb5 Make xs_get_song_tuple_info() static.
Matti Hamalainen <ccr@tnsp.org>
parents: 2088
diff changeset
90 static void xs_get_song_tuple_info(Tuple *pResult, t_xs_tuneinfo *pInfo, gint subTune);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
91
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
92 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
93 * Error messages
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
94 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
95 void xs_error(const char *fmt, ...)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
96 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97 va_list ap;
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
98 fprintf(stderr, "AUD-SID: ");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
99 va_start(ap, fmt);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100 vfprintf(stderr, fmt, ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
101 va_end(ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102 }
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 #ifndef DEBUG_NP
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105 void XSDEBUG(const char *fmt, ...)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
107 #ifdef DEBUG
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108 va_list ap;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
109 fprintf(stderr, "XSDEBUG: ");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110 va_start(ap, fmt);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
111 vfprintf(stderr, fmt, ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
112 va_end(ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
113 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
114 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
117
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
118 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
119 * Initialization functions
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
121 void xs_reinit(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
122 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
123 gint iPlayer;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
124 gboolean isInitialized;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
126 XSDEBUG("xs_reinit() thread = %p\n", g_thread_self());
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
127
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
128 /* Stop playing, if we are */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
129 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
130 if (xs_status.isPlaying) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
131 XS_MUTEX_UNLOCK(xs_status);
563
ccf952b07c77 [svn] Fix sid for current API.
iabervon
parents: 561
diff changeset
132 xs_stop(NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
133 } else {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
134 XS_MUTEX_UNLOCK(xs_status);
0
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
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
137 XS_MUTEX_LOCK(xs_status);
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
138 XS_MUTEX_LOCK(xs_cfg);
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
139
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
140 /* Initialize status and sanitize configuration */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141 xs_memset(&xs_status, 0, sizeof(xs_status));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
142
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
143 if (xs_cfg.audioFrequency < 8000)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144 xs_cfg.audioFrequency = 8000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146 if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
147 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148 else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149 xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE;
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.audioChannels != XS_CHN_MONO)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
152 xs_cfg.oversampleEnable = FALSE;
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 xs_status.audioFrequency = xs_cfg.audioFrequency;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156 xs_status.audioChannels = xs_cfg.audioChannels;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
157 xs_status.audioFormat = -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
158 xs_status.oversampleEnable = xs_cfg.oversampleEnable;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
159 xs_status.oversampleFactor = xs_cfg.oversampleFactor;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
160
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
161 /* Try to initialize emulator engine */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
162 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
163
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
164 iPlayer = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
165 isInitialized = FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
166 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
167 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
168 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
169 isInitialized = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
170 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer];
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 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173 iPlayer++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
174 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
175
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
176 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
177
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
178 iPlayer = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
179 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
180 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
181 isInitialized = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
182 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
183 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
184 } else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
185 iPlayer++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
186 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
187
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
188 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
189
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
190
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
191 /* 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
192 xs_cfg.audioFrequency = xs_status.audioFrequency;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
193 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
194 xs_cfg.audioChannels = xs_status.audioChannels;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
195 xs_cfg.oversampleEnable = xs_status.oversampleEnable;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
196
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
197 XS_MUTEX_UNLOCK(xs_status);
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
198 XS_MUTEX_UNLOCK(xs_cfg);
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
199
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
200 /* Initialize song-length database */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
201 xs_songlen_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
202 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
203 xs_error(_("Error initializing song-length database!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
205
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
206 /* Initialize STIL database */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
207 xs_stil_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
208 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
209 xs_error(_("Error initializing STIL database!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
210 }
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
211
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
212 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
213
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 * Initialize XMMS-SID
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 void xs_init(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
219 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
220 XSDEBUG("xs_init()\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
221
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
222 /* Initialize and get configuration */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
223 xs_init_configuration();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
224 xs_read_configuration();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
225
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
226 /* Initialize subsystems */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
227 xs_reinit();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
228
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
229 XSDEBUG("OK\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
230 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
231
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 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
234 * Shut down XMMS-SID
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 void xs_close(void)
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 XSDEBUG("xs_close(): shutting down...\n");
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 /* Stop playing, free structures */
563
ccf952b07c77 [svn] Fix sid for current API.
iabervon
parents: 561
diff changeset
241 xs_stop(NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
242
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
243 xs_tuneinfo_free(xs_status.tuneInfo);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
244 xs_status.tuneInfo = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
245 xs_status.sidPlayer->plrDeleteSID(&xs_status);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
246 xs_status.sidPlayer->plrClose(&xs_status);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
247
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
248 xs_songlen_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
249 xs_stil_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
250
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
251 XSDEBUG("shutdown finished.\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
252 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
253
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 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
256 * 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
257 */
1608
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
258 static gchar * xs_has_tracknumber(gchar *pcFilename)
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
259 {
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
260 gchar *tmpSep = xs_strrchr(pcFilename, '?');
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
261 if (tmpSep && g_ascii_isdigit(*(tmpSep + 1)))
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
262 return tmpSep;
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
263 else
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
264 return NULL;
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
265 }
1581
8581eb9d574a Fix fileinfo dialog to work with new subtune system.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
266
8581eb9d574a Fix fileinfo dialog to work with new subtune system.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
267 gboolean xs_get_trackinfo(const gchar *pcFilename, gchar **pcResult, gint *pTrack)
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
268 {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
269 gchar *tmpSep;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
270
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
271 *pcResult = g_strdup(pcFilename);
1608
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
272 tmpSep = xs_has_tracknumber(*pcResult);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
273
1608
e423bdc4b4d5 Simplify xs_is_our_file_vfs().
Matti Hamalainen <ccr@tnsp.org>
parents: 1605
diff changeset
274 if (tmpSep) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
275 *tmpSep = '\0';
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
276 *pTrack = atoi(tmpSep + 1);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
277 return TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
278 } else {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
279 *pTrack = -1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
280 return FALSE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
281 }
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
282 }
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
283
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
284
463
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
285 /*
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
286 * Start playing the given file
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
287 */
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
288 void xs_play_file(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
289 {
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
290 t_xs_tuneinfo *tmpTune;
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
291 gboolean audioOpen = FALSE;
1956
05bfc86250f3 Kill some warnings.
Matti Hamalainen <ccr@tnsp.org>
parents: 1875
diff changeset
292 gint audioGot, tmpLength, subTune;
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
293 gchar *tmpFilename, *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle;
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
294 Tuple *tmpTuple;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
295
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
296 assert(pb);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
297 assert(xs_status.sidPlayer);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
298
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
299 XSDEBUG("play '%s'\n", pb->filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
300
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
301 XS_MUTEX_LOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
302
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
303 /* Get tune information */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
304 xs_get_trackinfo(pb->filename, &tmpFilename, &subTune);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
305 if ((xs_status.tuneInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename)) == NULL) {
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
306 XS_MUTEX_UNLOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
307 g_free(tmpFilename);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
308 return;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
309 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
310
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
311 /* Initialize the tune */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
312 if (!xs_status.sidPlayer->plrLoadSID(&xs_status, tmpFilename)) {
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
313 XS_MUTEX_UNLOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
314 g_free(tmpFilename);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
315 xs_tuneinfo_free(xs_status.tuneInfo);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
316 xs_status.tuneInfo = NULL;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
317 return;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
318 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
319
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
320 g_free(tmpFilename);
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
321 tmpFilename = NULL;
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
322
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
323 XSDEBUG("load ok\n");
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
324
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
325 /* Set general status information */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
326 xs_status.isPlaying = TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
327 xs_status.isError = FALSE;
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
328 tmpTune = xs_status.tuneInfo;
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
329
1582
89fb1700313a Oops, && should've been ||, fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
330 if (subTune < 1 || subTune > xs_status.tuneInfo->nsubTunes)
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
331 xs_status.currSong = xs_status.tuneInfo->startTune;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
332 else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
333 xs_status.currSong = subTune;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
334
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
335 XSDEBUG("subtune #%i selected (#%d wanted), initializing...\n", xs_status.currSong, subTune);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
336
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
337
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
338 /* We are ready */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
339 xs_decode_thread = g_thread_self();
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
340 XSDEBUG("playing thread = %p\n", xs_decode_thread);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
341 pb->set_pb_ready(pb);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
342
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
343
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
344 /* Allocate audio buffer */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
345 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
346 if (audioBuffer == NULL) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
347 xs_error(_("Couldn't allocate memory for audio data buffer!\n"));
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
348 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
349 goto xs_err_exit;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
350 }
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
351
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
352 if (xs_status.oversampleEnable) {
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
353 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * xs_status.oversampleFactor);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
354 if (oversampleBuffer == NULL) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
355 xs_error(_("Couldn't allocate memory for audio oversampling buffer!\n"));
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
356 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
357 goto xs_err_exit;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
358 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
359 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
360
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
361
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
362 /* Check minimum playtime */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
363 tmpLength = tmpTune->subTunes[xs_status.currSong - 1].tuneLength;
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
364 if (xs_cfg.playMinTimeEnable && (tmpLength >= 0)) {
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
365 if (tmpLength < xs_cfg.playMinTime)
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
366 tmpLength = xs_cfg.playMinTime;
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
367 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
368
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
369 /* Initialize song */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
370 if (!xs_status.sidPlayer->plrInitSong(&xs_status)) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
371 xs_error(_("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n"),
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
372 tmpTune->sidFilename, xs_status.currSong);
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
373 XS_MUTEX_UNLOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
374 goto xs_err_exit;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
375 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
376
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
377 /* Open the audio output */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
378 XSDEBUG("open audio output (%d, %d, %d)\n",
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
379 xs_status.audioFormat, xs_status.audioFrequency, xs_status.audioChannels);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
380
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
381 if (!pb->output->open_audio(xs_status.audioFormat, xs_status.audioFrequency, xs_status.audioChannels)) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
382 xs_error(_("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n"),
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
383 xs_status.audioFormat,
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
384 xs_status.audioFrequency,
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
385 xs_status.audioChannels);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
386
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
387 xs_status.isError = TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
388 XS_MUTEX_UNLOCK(xs_status);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
389 goto xs_err_exit;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
390 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
391
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
392 audioOpen = TRUE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
393
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
394 /* Set song information for current subtune */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
395 XSDEBUG("foobar #1\n");
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
396 xs_status.sidPlayer->plrUpdateSIDInfo(&xs_status);
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
397 XS_MUTEX_UNLOCK(xs_status);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
398 tmpTuple = aud_tuple_new_from_filename(tmpTune->sidFilename);
2050
2ffc6a69fcd1 string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents: 1998
diff changeset
399 xs_get_song_tuple_info(tmpTuple, tmpTune, xs_status.currSong);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
400
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
401 tmpTitle = aud_tuple_formatter_process_string(tmpTuple,
2055
2f2ffbc2d04d gentitle changes
William Pitcock <nenolod@atheme.org>
parents: 2050
diff changeset
402 xs_cfg.titleOverride ? xs_cfg.titleFormat : aud_get_gentitle_format());
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
403
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
404 XSDEBUG("foobar #4\n");
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
405 XS_MUTEX_LOCK(xs_status);
1986
4b78df9dcf93 more set_params()
William Pitcock <nenolod@atheme.org>
parents: 1976
diff changeset
406 pb->set_params(pb,
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
407 tmpTitle,
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
408 (tmpLength > 0) ? (tmpLength * 1000) : 0,
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
409 -1,
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
410 xs_status.audioFrequency,
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
411 xs_status.audioChannels);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
412
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
413 g_free(tmpTitle);
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
414
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
415 XS_MUTEX_UNLOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
416 XSDEBUG("playing\n");
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
417 while (xs_status.isPlaying) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
418 /* Render audio data */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
419 XS_MUTEX_LOCK(xs_status);
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
420 if (xs_status.oversampleEnable) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
421 /* Perform oversampled rendering */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
422 audioGot = xs_status.sidPlayer->plrFillBuffer(
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
423 &xs_status,
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
424 oversampleBuffer,
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
425 (XS_AUDIOBUF_SIZE * xs_status.oversampleFactor));
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
426
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
427 audioGot /= xs_status.oversampleFactor;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
428
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
429 /* Execute rate-conversion with filtering */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
430 if (xs_filter_rateconv(audioBuffer, oversampleBuffer,
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
431 xs_status.audioFormat, xs_status.oversampleFactor, audioGot) < 0) {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
432 xs_error(_("Oversampling rate-conversion pass failed.\n"));
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
433 xs_status.isError = TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
434 XS_MUTEX_UNLOCK(xs_status);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
435 goto xs_err_exit;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
436 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
437 } else {
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
438 audioGot = xs_status.sidPlayer->plrFillBuffer(
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
439 &xs_status, audioBuffer, XS_AUDIOBUF_SIZE);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
440 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
441
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
442 /* I <3 visualice/haujobb */
1998
8f3188746b64 chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents: 1986
diff changeset
443 pb->pass_audio(pb, xs_status.audioFormat, xs_status.audioChannels,
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
444 audioGot, audioBuffer, NULL);
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
445
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
446 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
447
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
448 /* Wait a little */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
449 while (xs_status.isPlaying && (pb->output->buffer_free() < audioGot))
1676
aee4ebea943a xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
450 g_usleep(500);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
451
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
452 /* Check if we have played enough */
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
453 XS_MUTEX_LOCK(xs_status);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
454 if (xs_cfg.playMaxTimeEnable) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
455 if (xs_cfg.playMaxTimeUnknown) {
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
456 if ((tmpLength < 0) &&
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
457 (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000)))
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
458 xs_status.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
459 } else {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
460 if (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000))
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
461 xs_status.isPlaying = FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
462 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
463 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
464
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
465 if (tmpLength >= 0) {
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
466 if (pb->output->output_time() >= (tmpLength * 1000))
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
467 xs_status.isPlaying = FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
468 }
1593
f2f0ea5b5876 Cleaned up the mutex locking of xs_play_file(). This seems to magically fix
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
469 XS_MUTEX_UNLOCK(xs_status);
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
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
472 xs_err_exit:
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
473 XSDEBUG("out of playing loop\n");
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
474
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
475 /* Close audio output plugin */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
476 if (audioOpen) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
477 XSDEBUG("close audio #2\n");
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
478 pb->output->close_audio();
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
479 XSDEBUG("closed\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
480 }
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 g_free(audioBuffer);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483 g_free(oversampleBuffer);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
484
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
485 /* Set playing status to false (stopped), thus when
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
486 * 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
487 * 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
488 * next entry in the playlist .. or whatever it wishes.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
489 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
490 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
491 xs_status.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
492 XS_MUTEX_UNLOCK(xs_status);
0
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 /* Exit the playing thread */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
495 XSDEBUG("exiting thread, bye.\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
496 }
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 * Stop playing
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
501 * 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
502 * 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
503 * 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
504 * 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
505 * playing thread), we don't do that here.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
506 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
507 * Finally tune and other memory allocations are free'd.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
508 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
509 void xs_stop(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
510 {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
511 (void) pb;
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
512
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
513 XSDEBUG("stop requested\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
514
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
515 /* 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
516 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
517 if (xs_status.isPlaying) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
518 XSDEBUG("stopping...\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
519 xs_status.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
520 XS_MUTEX_UNLOCK(xs_status);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
521 XS_THREAD_JOIN(xs_decode_thread);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
522 } else {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
523 XS_MUTEX_UNLOCK(xs_status);
0
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
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
526 XSDEBUG("done, updating status\n");
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
527
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
528 /* Free tune information */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
529 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
530 xs_status.sidPlayer->plrDeleteSID(&xs_status);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
531 xs_tuneinfo_free(xs_status.tuneInfo);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
532 xs_status.tuneInfo = NULL;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
533 XS_MUTEX_UNLOCK(xs_status);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
534 XSDEBUG("ok\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
535 }
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
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
538 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
539 * Pause/unpause the playing
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
540 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
541 void xs_pause(InputPlayback *pb, short pauseState)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
542 {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
543 pb->output->pause(pauseState);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
544 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
545
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
546
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
547 /*
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
548 * A stub seek function (Audacious will crash if seek is NULL)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
549 */
1956
05bfc86250f3 Kill some warnings.
Matti Hamalainen <ccr@tnsp.org>
parents: 1875
diff changeset
550 void xs_seek(InputPlayback *pb, gint time)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
551 {
1956
05bfc86250f3 Kill some warnings.
Matti Hamalainen <ccr@tnsp.org>
parents: 1875
diff changeset
552 (void) pb; (void) time;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
553 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
554
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 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
557 * Return the playing "position/time"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
558 * 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
559 * 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
560 * 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
561 * 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
562 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
563 gint xs_get_time(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
564 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
565 /* 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
566 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
567 if (xs_status.isError) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
568 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
569 return -2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
570 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
571
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
572 /* If there is no tune, return -1 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
573 if (!xs_status.tuneInfo) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
574 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
575 return -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
576 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
577
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
578 /* If tune has ended, return -1 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
579 if (!xs_status.isPlaying) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
580 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
581 return -1;
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
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
584 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
585
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
586 /* 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
587 return pb->output->output_time();
0
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
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
591 /*
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
592 * Return song information Tuple
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
593 */
2109
2f11848e0eb5 Make xs_get_song_tuple_info() static.
Matti Hamalainen <ccr@tnsp.org>
parents: 2088
diff changeset
594 static void xs_get_song_tuple_info(Tuple *pResult, t_xs_tuneinfo *pInfo, gint subTune)
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
595 {
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
596 gchar *tmpStr, tmpStr2[64];
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
597
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
598 aud_tuple_associate_string(pResult, FIELD_TITLE, NULL, pInfo->sidName);
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
599 aud_tuple_associate_string(pResult, FIELD_ARTIST, NULL, pInfo->sidComposer);
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
600 aud_tuple_associate_string(pResult, FIELD_GENRE, NULL, "SID-tune");
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
601 aud_tuple_associate_string(pResult, FIELD_COPYRIGHT, NULL, pInfo->sidCopyright);
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
602 aud_tuple_associate_string(pResult, -1, "sid-format", pInfo->sidFormat);
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
603
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
604 switch (pInfo->sidModel) {
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
605 case XS_SIDMODEL_6581: tmpStr = "6581"; break;
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
606 case XS_SIDMODEL_8580: tmpStr = "8580"; break;
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
607 case XS_SIDMODEL_ANY: tmpStr = "ANY"; break;
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
608 default: tmpStr = "?"; break;
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
609 }
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
610 aud_tuple_associate_string(pResult, -1, "sid-model", tmpStr);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
611
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
612 /* Get sub-tune information, if available */
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
613 if (subTune < 0 || pInfo->startTune > pInfo->nsubTunes)
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
614 subTune = pInfo->startTune;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
615
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
616 if ((subTune > 0) && (subTune <= pInfo->nsubTunes)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
617 gint tmpInt = pInfo->subTunes[subTune - 1].tuneLength;
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
618 aud_tuple_associate_int(pResult, FIELD_LENGTH, NULL, (tmpInt < 0) ? -1 : tmpInt * 1000);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
619
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
620 tmpInt = pInfo->subTunes[subTune - 1].tuneSpeed;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
621 if (tmpInt > 0) {
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
622 switch (tmpInt) {
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
623 case XS_CLOCK_PAL: tmpStr = "PAL"; break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
624 case XS_CLOCK_NTSC: tmpStr = "NTSC"; break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
625 case XS_CLOCK_ANY: tmpStr = "ANY"; break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
626 case XS_CLOCK_VBI: tmpStr = "VBI"; break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
627 case XS_CLOCK_CIA: tmpStr = "CIA"; break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
628 default:
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
629 g_snprintf(tmpStr2, sizeof(tmpStr2), "%dHz", tmpInt);
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
630 tmpStr = tmpStr2;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
631 break;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
632 }
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
633 } else
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
634 tmpStr = "?";
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
635
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
636 aud_tuple_associate_string(pResult, -1, "sid-speed", tmpStr);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
637 } else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
638 subTune = 1;
2083
ba242a370bf6 Selective subtunes support.
Matti Hamalainen <ccr@tnsp.org>
parents: 2055
diff changeset
639
ba242a370bf6 Selective subtunes support.
Matti Hamalainen <ccr@tnsp.org>
parents: 2055
diff changeset
640 aud_tuple_associate_int(pResult, FIELD_SUBSONG_NUM, NULL, pInfo->nsubTunes);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
641 aud_tuple_associate_int(pResult, FIELD_SUBSONG_ID, NULL, subTune);
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
642 aud_tuple_associate_int(pResult, FIELD_TRACK_NUMBER, NULL, subTune);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
643
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
644 if (xs_cfg.titleOverride)
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
645 aud_tuple_associate_string(pResult, FIELD_FORMATTER, NULL, xs_cfg.titleFormat);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
646 }
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
647
1745
68312d3b39a8 Remove xs_is_our_file()
Matti Hamalainen <ccr@tnsp.org>
parents: 1733
diff changeset
648
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
649 Tuple * xs_get_song_tuple(gchar *songFilename)
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
650 {
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
651 Tuple *tmpResult;
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
652 gchar *tmpFilename;
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
653 t_xs_tuneinfo *tmpInfo;
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
654 gint tmpTune;
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
655
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
656 /* Get information from URL */
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
657 xs_get_trackinfo(songFilename, &tmpFilename, &tmpTune);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
658
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
659 tmpResult = aud_tuple_new_from_filename(tmpFilename);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
660 if (!tmpResult) {
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
661 g_free(tmpFilename);
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
662 return NULL;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
663 }
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
664
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
665 /* Get tune information from emulation engine */
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
666 XS_MUTEX_LOCK(xs_status);
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
667 tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename);
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
668 XS_MUTEX_UNLOCK(xs_status);
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
669 g_free(tmpFilename);
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
670
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
671 if (!tmpInfo)
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
672 return tmpResult;
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
673
2050
2ffc6a69fcd1 string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents: 1998
diff changeset
674 xs_get_song_tuple_info(tmpResult, tmpInfo, tmpTune);
1605
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
675 xs_tuneinfo_free(tmpInfo);
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
676
75b8e7737bcd Added support for SID-plugin specific Tuplez format string (see config
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
677 return tmpResult;
1583
2b5768cdca7a Use set_info(), blah and actually add at least the default sub-tune to
Matti Hamalainen <ccr@tnsp.org>
parents: 1582
diff changeset
678 }
1732
4bdb8621853e - updated sid plugin to use subsong-num and subsong-id
Giacomo Lozito <james@develia.org>
parents: 1697
diff changeset
679
1745
68312d3b39a8 Remove xs_is_our_file()
Matti Hamalainen <ccr@tnsp.org>
parents: 1733
diff changeset
680
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
681 Tuple *xs_probe_for_tuple(gchar *songFilename, t_xs_file *fd)
1732
4bdb8621853e - updated sid plugin to use subsong-num and subsong-id
Giacomo Lozito <james@develia.org>
parents: 1697
diff changeset
682 {
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
683 Tuple *tmpResult;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
684 gchar *tmpFilename;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
685 t_xs_tuneinfo *tmpInfo;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
686 gint tmpTune;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
687
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
688 assert(xs_status.sidPlayer);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
689
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
690 if (songFilename == NULL)
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
691 return NULL;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
692
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
693 XS_MUTEX_LOCK(xs_status);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
694 if (!xs_status.sidPlayer->plrProbe(fd)) {
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
695 XS_MUTEX_UNLOCK(xs_status);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
696 return NULL;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
697 }
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
698 XS_MUTEX_UNLOCK(xs_status);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
699
1732
4bdb8621853e - updated sid plugin to use subsong-num and subsong-id
Giacomo Lozito <james@develia.org>
parents: 1697
diff changeset
700
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
701 /* Get information from URL */
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
702 xs_get_trackinfo(songFilename, &tmpFilename, &tmpTune);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1956
diff changeset
703 tmpResult = aud_tuple_new_from_filename(tmpFilename);
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
704 if (!tmpResult) {
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
705 g_free(tmpFilename);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
706 return NULL;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
707 }
1732
4bdb8621853e - updated sid plugin to use subsong-num and subsong-id
Giacomo Lozito <james@develia.org>
parents: 1697
diff changeset
708
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
709 /* Get tune information from emulation engine */
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
710 XS_MUTEX_LOCK(xs_status);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
711 tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
712 XS_MUTEX_UNLOCK(xs_status);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
713 g_free(tmpFilename);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
714
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
715 if (!tmpInfo)
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
716 return tmpResult;
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
717
2050
2ffc6a69fcd1 string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents: 1998
diff changeset
718 xs_get_song_tuple_info(tmpResult, tmpInfo, tmpTune);
2088
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
719
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
720 /* Set subtunes */
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
721 if (xs_cfg.subAutoEnable && tmpInfo->nsubTunes > 1 && tmpTune < 0) {
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
722 gint i, n;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
723 tmpResult->subtunes = g_new(gint, tmpInfo->nsubTunes);
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
724 for (n = 0, i = 1; i <= tmpInfo->nsubTunes; i++) {
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
725 gboolean doAdd = FALSE;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
726
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
727 if (xs_cfg.subAutoMinOnly) {
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
728 if (i == tmpInfo->startTune ||
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
729 tmpInfo->subTunes[i - 1].tuneLength >= xs_cfg.subAutoMinTime)
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
730 doAdd = TRUE;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
731 } else
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
732 doAdd = TRUE;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
733
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
734 if (doAdd) tmpResult->subtunes[n++] = i;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
735 }
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
736 tmpResult->nsubtunes = n;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
737 } else
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
738 tmpResult->nsubtunes = 0;
b6482881b620 Sanitize tuple probing and fix subtunes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2083
diff changeset
739
1746
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
740 xs_tuneinfo_free(tmpInfo);
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
741
b3decbd3051b Cleanup the probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
742 return tmpResult;
1732
4bdb8621853e - updated sid plugin to use subsong-num and subsong-id
Giacomo Lozito <james@develia.org>
parents: 1697
diff changeset
743 }