Mercurial > audlegacy-plugins
annotate src/sid/xs_slsup.c @ 2576:bd3a24b39058
Removed #includes that should not be included anymore.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 19 May 2008 04:20:50 +0300 |
parents | 1223e8510d8a |
children |
rev | line source |
---|---|
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 File information window |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 (at your option) any later version. |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 GNU General Public License for more details. |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 */ |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 #include "xs_slsup.h" |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 #include "xs_config.h" |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
27 static xs_sldb_t *xs_sldb_db = NULL; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 XS_MUTEX(xs_sldb_db); |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
30 static xs_stildb_t *xs_stildb_db = NULL; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 XS_MUTEX(xs_stildb_db); |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 /* STIL-database handling |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 */ |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 gint xs_stil_init(void) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
38 XS_MUTEX_LOCK(xs_cfg); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
40 if (!xs_cfg.stilDBPath) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
41 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
42 return -1; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
43 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
45 XS_MUTEX_LOCK(xs_stildb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
47 /* Check if already initialized */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
48 if (xs_stildb_db) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
49 xs_stildb_free(xs_stildb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
51 /* Allocate database */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
52 xs_stildb_db = (xs_stildb_t *) g_malloc0(sizeof(xs_stildb_t)); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
53 if (!xs_stildb_db) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
54 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
55 XS_MUTEX_UNLOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
56 return -2; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
57 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
59 /* Read the database */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
60 if (xs_stildb_read(xs_stildb_db, xs_cfg.stilDBPath) != 0) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
61 xs_stildb_free(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
62 xs_stildb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
63 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
64 XS_MUTEX_UNLOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
65 return -3; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
66 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
68 /* Create index */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
69 if (xs_stildb_index(xs_stildb_db) != 0) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
70 xs_stildb_free(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
71 xs_stildb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
72 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
73 XS_MUTEX_UNLOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
74 return -4; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
75 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
77 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
78 XS_MUTEX_UNLOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
79 return 0; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
83 void xs_stil_close(void) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
84 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
85 XS_MUTEX_LOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
86 xs_stildb_free(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
87 xs_stildb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
88 XS_MUTEX_UNLOCK(xs_stildb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
92 stil_node_t *xs_stil_get(gchar *filename) |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
94 stil_node_t *result; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
95 gchar *tmpFilename; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
97 XS_MUTEX_LOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
98 XS_MUTEX_LOCK(xs_cfg); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
100 if (xs_cfg.stilDBEnable && xs_stildb_db) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
101 if (xs_cfg.hvscPath) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
102 /* Remove postfixed directory separator from HVSC-path */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
103 tmpFilename = xs_strrchr(xs_cfg.hvscPath, '/'); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
104 if (tmpFilename && (tmpFilename[1] == 0)) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
105 tmpFilename[0] = 0; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
107 /* Remove HVSC location-prefix from filename */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
108 tmpFilename = strstr(filename, xs_cfg.hvscPath); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
109 if (tmpFilename) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
110 tmpFilename += strlen(xs_cfg.hvscPath); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
111 else |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
112 tmpFilename = filename; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
113 } else |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
114 tmpFilename = filename; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
115 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
116 result = xs_stildb_get_node(xs_stildb_db, tmpFilename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
117 } else |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
118 result = NULL; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
120 XS_MUTEX_UNLOCK(xs_stildb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
121 XS_MUTEX_UNLOCK(xs_cfg); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
123 return result; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 /* Song length database handling glue |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 */ |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 gint xs_songlen_init(void) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
131 XS_MUTEX_LOCK(xs_cfg); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
133 if (!xs_cfg.songlenDBPath) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
134 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
135 return -1; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
136 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
138 XS_MUTEX_LOCK(xs_sldb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
139 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
140 /* Check if already initialized */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
141 if (xs_sldb_db) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
142 xs_sldb_free(xs_sldb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
143 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
144 /* Allocate database */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
145 xs_sldb_db = (xs_sldb_t *) g_malloc0(sizeof(xs_sldb_t)); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
146 if (!xs_sldb_db) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
147 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
148 XS_MUTEX_UNLOCK(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
149 return -2; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
150 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
151 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
152 /* Read the database */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
153 if (xs_sldb_read(xs_sldb_db, xs_cfg.songlenDBPath) != 0) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
154 xs_sldb_free(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
155 xs_sldb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
156 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
157 XS_MUTEX_UNLOCK(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
158 return -3; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
159 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
160 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
161 /* Create index */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
162 if (xs_sldb_index(xs_sldb_db) != 0) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
163 xs_sldb_free(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
164 xs_sldb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
165 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
166 XS_MUTEX_UNLOCK(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
167 return -4; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
168 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
169 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
170 XS_MUTEX_UNLOCK(xs_cfg); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
171 XS_MUTEX_UNLOCK(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
172 return 0; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
173 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
174 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
175 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
176 void xs_songlen_close(void) |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
177 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
178 XS_MUTEX_LOCK(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
179 xs_sldb_free(xs_sldb_db); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
180 xs_sldb_db = NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
181 XS_MUTEX_UNLOCK(xs_sldb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
183 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
184 |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
185 sldb_node_t *xs_songlen_get(const gchar * filename) |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
187 sldb_node_t *result; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
188 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
189 XS_MUTEX_LOCK(xs_sldb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
190 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
191 if (xs_cfg.songlenDBEnable && xs_sldb_db) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
192 result = xs_sldb_get(xs_sldb_db, filename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
193 else |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
194 result = NULL; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
195 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
196 XS_MUTEX_UNLOCK(xs_sldb_db); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
197 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
198 return result; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
199 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
200 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
201 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
202 /* Allocate a new tune information structure |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
203 */ |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
204 xs_tuneinfo_t *xs_tuneinfo_new(const gchar * filename, |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
205 gint nsubTunes, gint startTune, const gchar * sidName, |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
206 const gchar * sidComposer, const gchar * sidCopyright, |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
207 gint loadAddr, gint initAddr, gint playAddr, |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
208 gint dataFileLen, const gchar *sidFormat, gint sidModel) |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
209 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
210 xs_tuneinfo_t *result; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
211 sldb_node_t *tmpLength; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
212 gint i; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
213 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
214 /* Allocate structure */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
215 result = (xs_tuneinfo_t *) g_malloc0(sizeof(xs_tuneinfo_t)); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
216 if (!result) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
217 xs_error("Could not allocate memory for tuneinfo ('%s')\n", |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
218 filename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
219 return NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
220 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
221 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
222 result->sidFilename = XS_CS_FILENAME(filename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
223 if (!result->sidFilename) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
224 xs_error("Could not allocate sidFilename ('%s')\n", |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
225 filename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
226 g_free(result); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
227 return NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
228 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
229 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
230 /* Allocate space for subtune information */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
231 result->subTunes = g_malloc0(sizeof(xs_subtuneinfo_t) * (nsubTunes + 1)); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
232 if (!result->subTunes) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
233 xs_error("Could not allocate memory for subtuneinfo ('%s', %i)\n", |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
234 filename, nsubTunes); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
235 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
236 g_free(result->sidFilename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
237 g_free(result); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
238 return NULL; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
239 } |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
240 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
241 /* The following allocations don't matter if they fail */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
242 result->sidName = XS_CS_SID(sidName); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
243 result->sidComposer = XS_CS_SID(sidComposer); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
244 result->sidCopyright = XS_CS_SID(sidCopyright); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
245 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
246 result->nsubTunes = nsubTunes; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
247 result->startTune = startTune; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
248 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
249 result->loadAddr = loadAddr; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
250 result->initAddr = initAddr; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
251 result->playAddr = playAddr; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
252 result->dataFileLen = dataFileLen; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
253 result->sidFormat = XS_CS_SID(sidFormat); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
254 |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
255 result->sidModel = sidModel; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
256 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
257 /* Get length information (NOTE: Do not free this!) */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
258 tmpLength = xs_songlen_get(filename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
259 |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
260 /* Fill in sub-tune information */ |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
261 for (i = 0; i < result->nsubTunes; i++) { |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
262 if (tmpLength && (i < tmpLength->nlengths)) |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
263 result->subTunes[i].tuneLength = tmpLength->lengths[i]; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
264 else |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
265 result->subTunes[i].tuneLength = -1; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
266 |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
267 result->subTunes[i].tuneSpeed = -1; |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
268 } |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
269 |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
270 return result; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
271 } |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
272 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
273 |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
274 /* Free given tune information structure |
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
275 */ |
2507
251336bee085
Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2478
diff
changeset
|
276 void xs_tuneinfo_free(xs_tuneinfo_t * tune) |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
277 { |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
278 if (!tune) return; |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 |
2509
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
280 g_free(tune->subTunes); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
281 g_free(tune->sidFilename); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
282 g_free(tune->sidName); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
283 g_free(tune->sidComposer); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
284 g_free(tune->sidCopyright); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
285 g_free(tune->sidFormat); |
1223e8510d8a
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
2507
diff
changeset
|
286 g_free(tune); |
1574
e566e18e9e3d
Huge cleanup and some bugfixes. Temporarily breaks / removes sub-tune
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
287 } |