annotate src/sid/xmms-sid.c @ 1582:89fb1700313a

Oops, && should've been ||, fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Sep 2007 10:59:32 +0300
parents 8581eb9d574a
children 2b5768cdca7a
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 #include <gtk/gtk.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include "xs_config.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include "xs_length.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 #include "xs_stil.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 #include "xs_filter.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include "xs_fileinfo.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 #include "xs_interface.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include "xs_glade.h"
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
40 #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
41 #include "xs_slsup.h"
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
42 #include "audacious/playlist.h"
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
43
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
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 * Include player engines
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48 #ifdef HAVE_SIDPLAY1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 #include "xs_sidplay1.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51 #ifdef HAVE_SIDPLAY2
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 #include "xs_sidplay2.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53 #endif
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
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 * List of players and links to their functions
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
58 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
59 t_xs_player xs_playerlist[] = {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
60 #ifdef HAVE_SIDPLAY1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
61 {XS_ENG_SIDPLAY1,
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
62 xs_sidplay1_probe,
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63 xs_sidplay1_init, xs_sidplay1_close,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 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
65 xs_sidplay1_load, xs_sidplay1_delete,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
66 xs_sidplay1_getinfo, xs_sidplay1_updateinfo,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
67 NULL
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
68 },
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
69 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70 #ifdef HAVE_SIDPLAY2
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
71 {XS_ENG_SIDPLAY2,
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
72 xs_sidplay2_probe,
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
73 xs_sidplay2_init, xs_sidplay2_close,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
74 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
75 xs_sidplay2_load, xs_sidplay2_delete,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
76 xs_sidplay2_getinfo, xs_sidplay2_updateinfo,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
77 xs_sidplay2_flush
0
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 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
80 };
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 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
83
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84
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 * Global variables
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88 t_xs_status xs_status;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
89 XS_MUTEX(xs_status);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
90 static XS_THREAD_T xs_decode_thread;
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 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
94 * Error messages
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
95 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
96 void xs_error(const char *fmt, ...)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
98 va_list ap;
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
99 fprintf(stderr, "AUD-SID: ");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100 va_start(ap, fmt);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
101 vfprintf(stderr, fmt, ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102 va_end(ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
103 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105 #ifndef DEBUG_NP
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106 void XSDEBUG(const char *fmt, ...)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
107 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108 #ifdef DEBUG
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
109 va_list ap;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110 fprintf(stderr, "XSDEBUG: ");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
111 va_start(ap, fmt);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
112 vfprintf(stderr, fmt, ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
113 va_end(ap);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
114 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
117
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
118
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
119 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 * Initialization functions
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
121 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
122 void xs_reinit(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
123 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
124 gint iPlayer;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125 gboolean isInitialized;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
127 /* Stop playing, if we are */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
128 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
129 if (xs_status.isPlaying) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
130 XS_MUTEX_UNLOCK(xs_status);
563
ccf952b07c77 [svn] Fix sid for current API.
iabervon
parents: 561
diff changeset
131 xs_stop(NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
132 } else {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
133 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
134 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
135
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
136 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
137 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
138
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
139 /* Initialize status and sanitize configuration */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
140 xs_memset(&xs_status, 0, sizeof(xs_status));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
142 if (xs_cfg.audioFrequency < 8000)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
143 xs_cfg.audioFrequency = 8000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145 if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
147 else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148 xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
150 if (xs_cfg.audioChannels != XS_CHN_MONO)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
151 xs_cfg.oversampleEnable = FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
152
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
153 xs_status.audioFrequency = xs_cfg.audioFrequency;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
154 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155 xs_status.audioChannels = xs_cfg.audioChannels;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156 xs_status.audioFormat = -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
157 xs_status.oversampleEnable = xs_cfg.oversampleEnable;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
158 xs_status.oversampleFactor = xs_cfg.oversampleFactor;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
159
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
160 /* Try to initialize emulator engine */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
161 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
162
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
163 iPlayer = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
164 isInitialized = FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
165 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
166 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
167 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
168 isInitialized = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
169 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
170 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
171 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
172 iPlayer++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173 }
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 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
176
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
177 iPlayer = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
178 while ((iPlayer < xs_nplayerlist) && !isInitialized) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
179 if (xs_playerlist[iPlayer].plrInit(&xs_status)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
180 isInitialized = TRUE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
181 xs_status.sidPlayer = (t_xs_player *) & xs_playerlist[iPlayer];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
182 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
183 } else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
184 iPlayer++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
185 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
186
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
187 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
188
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
189
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
190 /* 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
191 xs_cfg.audioFrequency = xs_status.audioFrequency;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
192 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
193 xs_cfg.audioChannels = xs_status.audioChannels;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
194 xs_cfg.oversampleEnable = xs_status.oversampleEnable;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
195
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
196 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
197 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
198
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
199 /* Initialize song-length database */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
200 xs_songlen_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
201 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
202 xs_error(_("Error initializing song-length database!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
203 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
205 /* Initialize STIL database */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
206 xs_stil_close();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
207 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
208 xs_error(_("Error initializing STIL database!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
209 }
1554
f7c630358bda Merge thread locking/mutex fix from XMMS-SID. Fixes a race between
Matti Hamalainen <ccr@tnsp.org>
parents: 1516
diff changeset
210
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
211 }
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 * Initialize XMMS-SID
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
216 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217 void xs_init(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
218 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
219 XSDEBUG("xs_init()\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
220
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
221 /* Initialize and get configuration */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
222 xs_memset(&xs_cfg, 0, sizeof(xs_cfg));
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 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
258 gint xs_is_our_file(gchar *pcFilename)
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
259 {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
260 gint result = 0;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
261 t_xs_file *f;
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
262 assert(xs_status.sidPlayer);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
263
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
264 /* Check the filename */
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
265 if (pcFilename == NULL)
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
266 return 0;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
267
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
268 // XS_MUTEX_LOCK(xs_status);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
269 if ((f = xs_fopen(pcFilename, "rb")) != NULL) {
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
270 if (xs_status.sidPlayer->plrProbe(f))
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
271 result = 1;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
272 xs_fclose(f);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
273 }
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
274
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
275 // 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
276 return result;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
277 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
278
1581
8581eb9d574a Fix fileinfo dialog to work with new subtune system.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
279
8581eb9d574a Fix fileinfo dialog to work with new subtune system.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
280 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
281 {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
282 gchar *tmpSep;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
283
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
284 *pcResult = g_strdup(pcFilename);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
285 tmpSep = xs_strrchr(*pcResult, '?');
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
286
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
287 if (tmpSep && g_ascii_isdigit(*(tmpSep + 1))) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
288 *tmpSep = '\0';
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
289 *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
290 return TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
291 } else {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
292 *pTrack = -1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
293 return FALSE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
294 }
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
295 }
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
296
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
297
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
298 gint xs_is_our_file_vfs(gchar *pcFilename, t_xs_file *f)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299 {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
300 gint tmpResult = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
301 assert(xs_status.sidPlayer);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
302
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
303 /* Check the filename */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
304 if (pcFilename == NULL)
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
305 return 0;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
306
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
307 if (xs_status.sidPlayer->plrProbe(f)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
308 gchar *tmpFilename = NULL;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
309 gint tmpDummy = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
310
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
311 if (xs_get_trackinfo(pcFilename, &tmpFilename, &tmpDummy)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
312 tmpResult = 1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
313 } else {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
314 t_xs_tuneinfo *pInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
315
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
316 if (pInfo->nsubTunes > 1) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
317 gint i;
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 for (i = 1; i <= pInfo->nsubTunes; i++) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
320 gchar *tmpStr = g_strdup_printf("%s?%d", pcFilename, i);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
321 gboolean doAdd = FALSE;
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 if (xs_cfg.subAutoMinOnly) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
324 if (pInfo->subTunes[i - 1].tuneLength >= xs_cfg.subAutoMinTime)
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
325 doAdd = TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
326 } else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
327 doAdd = TRUE;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
328
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
329 if (doAdd)
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
330 playlist_add_url(playlist_get_active(), tmpStr);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
331
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
332 g_free(tmpStr);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
333 }
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 tmpResult = -1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
336 } else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
337 tmpResult = 1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
338
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
339 xs_tuneinfo_free(pInfo);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
340 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
341
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
342 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
343 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
344
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
345 return tmpResult;
463
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
346 }
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
347
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
348
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
349 /*
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
350 * Start playing the given file
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
351 */
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
352 void xs_play_file(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
353 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
354 t_xs_status myStatus;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
355 t_xs_tuneinfo *myTune;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
356 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE;
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
357 gint audioGot, songLength, i, subTune;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
358 gchar *tmpFilename, *audioBuffer = NULL, *oversampleBuffer = NULL;
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
359 Tuple *tmpTitle;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
360
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
361 assert(pb);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
362 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
363
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
364 XSDEBUG("play '%s'\n", pb->filename);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
365
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
366 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
367
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
368 /* 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
369 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
370
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
371 if ((xs_status.tuneInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename)) == NULL) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
372 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
373 return;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
374 }
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 /* 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
377 if (!xs_status.sidPlayer->plrLoadSID(&xs_status, tmpFilename)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
378 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
379 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
380 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
381 return;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
382 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
383
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
384 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
385
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
386 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
387
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
388 /* 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
389 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
390 xs_status.isError = FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
391 myTune = 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
392
1582
89fb1700313a Oops, && should've been ||, fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
393 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
394 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
395 else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
396 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
397
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
398 XSDEBUG("subtune #%i selected (#%d wanted), initializing...\n", 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
399 memcpy(&myStatus, &xs_status, sizeof(t_xs_status));
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
400 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
401
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
402
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
403 /* 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
404 xs_decode_thread = g_thread_self();
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
405 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
406
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
407
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
408 /* Allocate audio buffer */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
409 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
410 if (audioBuffer == NULL) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
411 xs_error(_("Couldn't allocate memory for audio data buffer!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
412 goto xs_err_exit;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
413 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
414
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
415 if (xs_status.oversampleEnable) {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
416 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
417 if (oversampleBuffer == NULL) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
418 xs_error(_("Couldn't allocate memory for audio oversampling buffer!\n"));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
419 goto xs_err_exit;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
420 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
421 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
422
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
423
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
424 /* Check minimum playtime */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
425 songLength = myTune->subTunes[myStatus.currSong - 1].tuneLength;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
426 if (xs_cfg.playMinTimeEnable && (songLength >= 0)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
427 if (songLength < xs_cfg.playMinTime)
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
428 songLength = xs_cfg.playMinTime;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
429 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
430
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
431 /* Initialize song */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
432 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
433 xs_error(_("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n"),
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
434 myTune->sidFilename, myStatus.currSong);
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
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
438 /* 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
439 XSDEBUG("open audio output (%d, %d, %d)\n",
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
440 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
441
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
442 if (!pb->output->open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
443 xs_error(_("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n"),
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
444 myStatus.audioFormat,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
445 myStatus.audioFrequency,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
446 myStatus.audioChannels);
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 XS_MUTEX_LOCK(xs_status);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
449 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
450 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
451 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
452 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
453
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
454 audioOpen = TRUE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
455
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
456 /* Set song information for current subtune */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
457 XSDEBUG("foobar\n");
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
458 myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus);
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
459 /*
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
460 tmpTitle = xs_make_titlestring(myTune, subTune);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
461
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
462 xs_plugin_ip.set_info(
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
463 tmpTitle,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
464 (songLength > 0) ? (songLength * 1000) : 0,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
465 -1,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
466 myStatus.audioFrequency,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
467 myStatus.audioChannels);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
468
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
469 g_free(tmpTitle);
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
470 */
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
471
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
472 XSDEBUG("playing\n");
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
473 while (xs_status.isPlaying && myStatus.isPlaying) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
474 /* Render audio data */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
475 if (myStatus.oversampleEnable) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
476 /* Perform oversampled rendering */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
477 audioGot = myStatus.sidPlayer->plrFillBuffer(
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
478 &myStatus,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
479 oversampleBuffer,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
480 (XS_AUDIOBUF_SIZE * myStatus.oversampleFactor));
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
481
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
482 audioGot /= myStatus.oversampleFactor;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
484 /* 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
485 if (xs_filter_rateconv(audioBuffer, oversampleBuffer,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
486 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
487 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
488 XS_MUTEX_LOCK(xs_status);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
489 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
490 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
491 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
492 }
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
493 } else {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
494 audioGot = myStatus.sidPlayer->plrFillBuffer(
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
495 &myStatus, audioBuffer, XS_AUDIOBUF_SIZE);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
496 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
497
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
498 /* I <3 visualice/haujobb */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
499 produce_audio(pb->output->written_time(),
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
500 myStatus.audioFormat, myStatus.audioChannels,
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
501 audioGot, audioBuffer, NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
502
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
503 /* 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
504 while (xs_status.isPlaying && (pb->output->buffer_free() < audioGot))
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
505 xmms_usleep(500);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
506
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
507 /* Check if we have played enough */
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
508 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
509 if (xs_cfg.playMaxTimeUnknown) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
510 if ((songLength < 0) &&
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
511 (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000)))
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
512 myStatus.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
513 } else {
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
514 if (pb->output->output_time() >= (xs_cfg.playMaxTime * 1000))
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
515 myStatus.isPlaying = FALSE;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
516 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
517 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
518
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
519 if (songLength >= 0) {
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
520 if (pb->output->output_time() >= (songLength * 1000))
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
521 myStatus.isPlaying = FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
522 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
523 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
524
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
525 xs_err_exit:
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
526 XSDEBUG("out of playing loop\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 /* Close audio output plugin */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
529 if (audioOpen) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
530 XSDEBUG("close audio #2\n");
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
531 pb->output->close_audio();
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
532 XSDEBUG("closed\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
533 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
534
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
535 g_free(audioBuffer);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
536 g_free(oversampleBuffer);
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 /* Set playing status to false (stopped), thus when
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
539 * 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
540 * 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
541 * next entry in the playlist .. or whatever it wishes.
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 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
544 xs_status.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
545 XS_MUTEX_UNLOCK(xs_status);
0
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 /* Exit the playing thread */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
548 XSDEBUG("exiting thread, bye.\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
549 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
550
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
551
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
552 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
553 * Stop playing
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
554 * 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
555 * 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
556 * 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
557 * 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
558 * playing thread), we don't do that here.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
559 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
560 * Finally tune and other memory allocations are free'd.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
561 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
562 void xs_stop(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
563 {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
564 (void) pb;
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
565
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
566 XSDEBUG("stop requested\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
567
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
568 /* 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
569 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
570 if (xs_status.isPlaying) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
571 XSDEBUG("stopping...\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
572 xs_status.isPlaying = FALSE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
573 XS_MUTEX_UNLOCK(xs_status);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
574 XS_THREAD_JOIN(xs_decode_thread);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
575 } else {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
576 XS_MUTEX_UNLOCK(xs_status);
0
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
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
579 XSDEBUG("done, updating status\n");
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
580
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
581 /* Free tune information */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
582 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
583 xs_status.sidPlayer->plrDeleteSID(&xs_status);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
584 xs_tuneinfo_free(xs_status.tuneInfo);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
585 xs_status.tuneInfo = NULL;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
586 XS_MUTEX_UNLOCK(xs_status);
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
587 XSDEBUG("ok\n");
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
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
591 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
592 * Pause/unpause the playing
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
593 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
594 void xs_pause(InputPlayback *pb, short pauseState)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
595 {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
596 pb->output->pause(pauseState);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
597 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
598
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
599
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
600 /*
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
601 * 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
602 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
603 void xs_seek(InputPlayback *pb, gint iTime)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
604 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
605 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
606
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
607
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
608 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
609 * Return the playing "position/time"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
610 * 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
611 * 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
612 * 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
613 * 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
614 */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
615 gint xs_get_time(InputPlayback *pb)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
616 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
617 /* 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
618 XS_MUTEX_LOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
619 if (xs_status.isError) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
620 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
621 return -2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
622 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
623
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
624 /* If there is no tune, return -1 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
625 if (!xs_status.tuneInfo) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
626 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
627 return -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
628 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
629
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
630 /* If tune has ended, return -1 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
631 if (!xs_status.isPlaying) {
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
632 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
633 return -1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
634 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
635
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
636 XS_MUTEX_UNLOCK(xs_status);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
637
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
638 /* 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
639 return pb->output->output_time();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
640 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
641
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
642
1574
e566e18e9e3d Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents: 1564
diff changeset
643 /* Return song information Tuple
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
644 */
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
645 Tuple * xs_get_song_tuple(gchar *songFilename)
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
646 {
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
647 t_xs_tuneinfo *pInfo;
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
648 Tuple *pResult;
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
649 gchar *tmpStr, *tmpFilename;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
650 gint subTune;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
651
1555
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
652 XS_MUTEX_LOCK(xs_status);
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
653
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
654 xs_get_trackinfo(songFilename, &tmpFilename, &subTune);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
655
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
656 pResult = tuple_new_from_filename(songFilename);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
657
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
658 /* Get tune information from emulation engine */
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
659 pInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename);
1555
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
660 if (!pInfo) {
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
661 XS_MUTEX_UNLOCK(xs_status);
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
662 return pResult;
1555
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
663 }
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
664
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
665 g_free(tmpFilename);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
666
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
667 tuple_associate_string(pResult, "title", pInfo->sidName);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
668 tuple_associate_string(pResult, "artist", pInfo->sidComposer);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
669 tuple_associate_string(pResult, "genre", "SID-tune");
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
670 tuple_associate_string(pResult, "copyright", pInfo->sidCopyright);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
671 tuple_associate_string(pResult, "format", pInfo->sidFormat);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
672 tuple_associate_int(pResult, "subtunes", pInfo->nsubTunes);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
673
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
674 switch (pInfo->sidModel) {
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
675 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
676 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
677 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
678 default: tmpStr = "?"; break;
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
679 }
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
680 tuple_associate_string(pResult, "sid-model", tmpStr);
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
681
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
682 /* 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
683 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
684 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
685
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
686 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
687 gint tmpInt = pInfo->subTunes[subTune - 1].tuneLength;
1564
5e4393a4c099 Start of major Aud-SID Tuples vs XMMS-SID cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1555
diff changeset
688 tuple_associate_int(pResult, "length", (tmpInt < 0) ? -1 : tmpInt * 1000);
1579
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
689 } else
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
690 subTune = 1;
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
691
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
692 tuple_associate_int(pResult, "subtune", subTune);
a5725f7f1a5e Chainsaw, this is for you: Separate playlist entries added for sub-tunes;
Matti Hamalainen <ccr@tnsp.org>
parents: 1574
diff changeset
693 tuple_associate_int(pResult, "track-number", subTune);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
694
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
695 /* Free tune information */
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
696 xs_tuneinfo_free(pInfo);
1555
c3b8dedeedc5 Some Audacious specific (for Tuple generation) mutex locks added.
Matti Hamalainen <ccr@tnsp.org>
parents: 1554
diff changeset
697 XS_MUTEX_UNLOCK(xs_status);
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
698 return pResult;
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 563
diff changeset
699 }