Mercurial > audlegacy-plugins
annotate src/vtx/vtx.c @ 3071:ca7d5de41217
Allow much larger buffer in the config GUI.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 24 Apr 2009 22:24:01 -0500 |
parents | 3134a0987162 |
children |
rev | line source |
---|---|
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
1 /* VTXplugin - VTX player for XMMS |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
2 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
3 * Copyright (C) 2002-2004 Sashnov Alexander |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
4 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
8 * (at your option) any later version. |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
9 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
14 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
2835 | 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
18 */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
19 |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
20 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
21 #include <audlegacy/output.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
22 #include <audlegacy/i18n.h> |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
23 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
24 #include "vtx.h" |
2496
42a5c9d5830b
Include cleanups, part #1.
Matti Hamalainen <ccr@tnsp.org>
parents:
2229
diff
changeset
|
25 #include "ayemu.h" |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
26 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
27 extern InputPlugin vtx_ip; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
28 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
29 #define SNDBUFSIZE 1024 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
30 char sndbuf[SNDBUFSIZE]; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
31 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
32 static GThread *play_thread = NULL; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
33 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
34 int seek_to; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
35 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
36 int freq = 44100; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
37 int chans = 2; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
38 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
39 /* NOTE: if you change 'bits' you also need change constant FMT_S16_NE |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
40 * to more appropriate in line |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
41 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
42 * (vtx_ip.output->open_audio (FMT_S16_NE, * freq, chans) == 0) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
43 * in function vtx_play_file() |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
44 * |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
45 * and in produce_audio() function call. |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
46 */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
47 const int bits = 16; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
48 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
49 ayemu_ay_t ay; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
50 ayemu_vtx_t vtx; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
51 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
52 static gchar *vtx_fmts[] = { "vtx", NULL }; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
53 |
1405
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
54 void |
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
55 vtx_init(void) |
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
56 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
57 mcs_handle_t *db; |
2124 | 58 db = aud_cfg_db_open(); |
1405
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
59 |
2124 | 60 aud_cfg_db_get_int(db, NULL, "src_rate", &freq); |
1405
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
61 if (freq < 4000 || freq > 192000) |
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
62 freq = 44100; |
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
63 |
2124 | 64 aud_cfg_db_close(db); |
1405
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
65 } |
48e73f07ec9b
Use configured core sample rate frequency if available.
Christian Birchinger <joker@netswarm.net>
parents:
1404
diff
changeset
|
66 |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
67 int |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
68 vtx_is_our_fd (char *filename, VFSFile *fp) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
69 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
70 char buf[2]; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
71 |
1978 | 72 aud_vfs_fread (buf, 2, 1, fp); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
73 return (!strncasecmp (buf, "ay", 2) || !strncasecmp (buf, "ym", 2)); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
74 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
75 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
76 int |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
77 vtx_is_our_file (char *filename) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
78 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
79 gboolean ret; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
80 VFSFile *fp; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
81 |
1978 | 82 fp = aud_vfs_fopen(filename, "rb"); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
83 ret = vtx_is_our_fd(filename, fp); |
1978 | 84 aud_vfs_fclose(fp); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
85 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
86 return ret; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
87 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
88 |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
89 Tuple * |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
90 vtx_get_song_tuple_from_vtx(const gchar *filename, ayemu_vtx_t *in) |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
91 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
92 Tuple *out = aud_tuple_new_from_filename(filename); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
93 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
94 aud_tuple_associate_string(out, FIELD_ARTIST, NULL, in->hdr.author); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
95 aud_tuple_associate_string(out, FIELD_TITLE, NULL, in->hdr.title); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
96 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
97 aud_tuple_associate_int(out, FIELD_LENGTH, NULL, in->hdr.regdata_size / 14 * 1000 / 50); |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
98 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
99 aud_tuple_associate_string(out, FIELD_GENRE, NULL, (in->hdr.chiptype == AYEMU_AY)? "AY chiptunes" : "YM chiptunes"); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
100 aud_tuple_associate_string(out, FIELD_ALBUM, NULL, in->hdr.from); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
101 aud_tuple_associate_string(out, -1, "game", in->hdr.from); |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
102 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
103 aud_tuple_associate_string(out, FIELD_QUALITY, NULL, "sequenced"); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
104 aud_tuple_associate_string(out, FIELD_CODEC, NULL, in->hdr.tracker); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
105 aud_tuple_associate_string(out, -1, "tracker", in->hdr.tracker); |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
106 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
107 aud_tuple_associate_int(out, FIELD_YEAR, NULL, in->hdr.year); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
108 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
109 return out; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
110 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
111 |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
112 Tuple * |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
113 vtx_get_song_tuple(gchar *filename) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
114 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
115 ayemu_vtx_t tmp; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
116 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
117 if (ayemu_vtx_open (&tmp, filename)) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
118 { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
119 Tuple *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
120 ayemu_vtx_free(&tmp); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
121 return ti; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
122 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
123 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
124 return NULL; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
125 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
126 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
127 /* sound playing thread, runing by vtx_play_file() */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
128 static gpointer |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
129 play_loop (gpointer args) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
130 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
131 InputPlayback *playback = (InputPlayback *) args; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
132 void *stream; /* pointer to current position in sound buffer */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
133 unsigned char regs[14]; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
134 int need; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
135 int left; /* how many sound frames can play with current AY register frame */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
136 int donow; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
137 int rate; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
138 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
139 left = 0; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
140 rate = chans * (bits / 8); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
141 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
142 while (playback->playing && !playback->eof) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
143 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
144 /* fill sound buffer */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
145 stream = sndbuf; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
146 for (need = SNDBUFSIZE / rate ; need > 0 ; need -= donow) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
147 if (left > 0) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
148 { /* use current AY register frame */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
149 donow = (need > left) ? left : need; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
150 left -= donow; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
151 stream = ayemu_gen_sound (&ay, (char *)stream, donow * rate); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
152 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
153 else |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
154 { /* get next AY register frame */ |
2229 | 155 if (ayemu_vtx_get_next_frame (&vtx, (char *)regs) == 0) |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
156 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
157 playback->eof = TRUE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
158 donow = need; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
159 memset (stream, 0, donow * rate); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
160 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
161 else |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
162 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
163 left = freq / vtx.hdr.playerFreq; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
164 ayemu_set_regs (&ay, regs); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
165 donow = 0; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
166 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
167 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
168 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
169 while (playback->output->buffer_free () < SNDBUFSIZE && playback->playing |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
170 && seek_to == -1) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
171 g_usleep(10000); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
172 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
173 if (playback->playing && seek_to == -1) |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1987
diff
changeset
|
174 playback->pass_audio(playback, FMT_S16_NE, |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
175 chans , SNDBUFSIZE, sndbuf, &playback->playing); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
176 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
177 if (playback->eof) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
178 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
179 playback->output->buffer_free (); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
180 playback->output->buffer_free (); |
1404
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
181 while (playback->output->buffer_playing()) |
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
182 g_usleep(10000); |
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
183 playback->playing = 0; |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
184 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
185 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
186 /* jump to time in seek_to (in seconds) */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
187 if (seek_to != -1) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
188 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
189 vtx.pos = seek_to * 50; /* (time in sec) * 50 = offset in AY register data frames */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
190 playback->output->flush (seek_to * 1000); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
191 seek_to = -1; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
192 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
193 } |
1404
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
194 ayemu_vtx_free (&vtx); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
195 return NULL; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
196 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
197 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
198 void vtx_play_file (InputPlayback *playback) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
199 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
200 gchar *filename = playback->filename; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
201 gchar *buf; |
1424
230661b01dc7
vtx: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1406
diff
changeset
|
202 Tuple *ti; |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
203 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
204 memset (&ay, 0, sizeof(ay)); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
205 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
206 if (!ayemu_vtx_open (&vtx, filename)) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
207 g_print ("libvtx: Error read vtx header from %s\n", filename); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
208 else if (!ayemu_vtx_load_data (&vtx)) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
209 g_print ("libvtx: Error read vtx data from %s\n", filename); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
210 else |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
211 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
212 ayemu_init(&ay); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
213 ayemu_set_chip_type(&ay, vtx.hdr.chiptype, NULL); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
214 ayemu_set_chip_freq(&ay, vtx.hdr.chipFreq); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
215 ayemu_set_stereo(&ay, vtx.hdr.stereo, NULL); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
216 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
217 playback->error = FALSE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
218 if (playback->output->open_audio (FMT_S16_NE, freq, chans) == 0) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
219 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
220 g_print ("libvtx: output audio error!\n"); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
221 playback->error = TRUE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
222 playback->playing = FALSE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
223 return; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
224 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
225 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
226 playback->eof = FALSE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
227 seek_to = -1; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
228 |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
229 ti = vtx_get_song_tuple_from_vtx(playback->filename, &vtx); |
2055 | 230 buf = aud_tuple_formatter_make_title_string(ti, aud_get_gentitle_format()); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
231 |
1987 | 232 playback->set_params (playback, buf, vtx.hdr.regdata_size / 14 * 1000 / 50, |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
233 14 * 50 * 8, freq, bits / 8); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
234 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
235 g_free (buf); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
236 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
237 aud_tuple_free(ti); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
238 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
239 playback->playing = TRUE; |
1404
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
240 play_thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1446
diff
changeset
|
241 playback->set_pb_ready(playback); |
1404
ab7d89bb8fcb
Switched to new threading model
Christian Birchinger <joker@netswarm.net>
parents:
1395
diff
changeset
|
242 play_loop(playback); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
243 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
244 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
245 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
246 void |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
247 vtx_stop (InputPlayback *playback) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
248 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
249 if (playback->playing && play_thread != NULL) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
250 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
251 playback->playing = FALSE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
252 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
253 g_thread_join (play_thread); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
254 play_thread = NULL; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
255 playback->output->close_audio (); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
256 ayemu_vtx_free (&vtx); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
257 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
258 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
259 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
260 /* seek to specified number of seconds */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
261 void |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
262 vtx_seek (InputPlayback *playback, int time) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
263 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
264 if (time * 50 < vtx.hdr.regdata_size / 14) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
265 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
266 playback->eof = FALSE; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
267 seek_to = time; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
268 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
269 /* wait for affect changes in parallel thread */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
270 while (seek_to != -1) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
271 g_usleep (10000); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
272 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
273 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
274 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
275 /* Pause or unpause */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
276 void |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
277 vtx_pause (InputPlayback *playback, short p) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
278 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
279 playback->output->pause (p); |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
280 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
281 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
282 /* Function to grab the title string */ |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
283 void |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
284 vtx_get_song_info (char *filename, char **title, int *length) |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
285 { |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
286 ayemu_vtx_t tmp; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
287 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
288 (*length) = -1; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
289 (*title) = NULL; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
290 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
291 if (ayemu_vtx_open (&tmp, filename)) { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
292 Tuple *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
293 |
2055 | 294 *title = aud_tuple_formatter_process_string(ti, aud_get_gentitle_format()); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
295 *length = aud_tuple_get_int(ti, FIELD_LENGTH, NULL); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
296 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
297 ayemu_vtx_free (&tmp); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1695
diff
changeset
|
298 aud_tuple_free(ti); |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
299 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
300 } |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
301 |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
302 InputPlugin vtx_ip = { |
1617
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
303 .description = "VTX Audio Plugin", /* Plugin description */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
304 .init = vtx_init, /* Initialization */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
305 .about = vtx_about, /* Show aboutbox */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
306 .configure = vtx_config, /* Show/edit configuration */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
307 .is_our_file = vtx_is_our_file, /* Check file, return 1 if the plugin can handle this file */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
308 .play_file = vtx_play_file, /* Play given file */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
309 .stop = vtx_stop, /* Stop playing */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
310 .pause = vtx_pause, /* Pause playing */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
311 .seek = vtx_seek, /* Seek time */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
312 .get_song_info = vtx_get_song_info, /* Get song title and length */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
313 .file_info_box = vtx_file_info, /* Show file-information dialog */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
314 .get_song_tuple = vtx_get_song_tuple, /* Tuple */ |
a941cce3577d
vtx: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
315 .is_our_file_from_vfs = vtx_is_our_fd, /* VFS */ |
1979
839804c3b3a4
aud_vfs_extensions -> vfs_extensions, some vtable fixes
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
316 .vfs_extensions = vtx_fmts /* ext assist */ |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
317 }; |
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
318 |
1086 | 319 InputPlugin *vtx_iplist[] = { &vtx_ip, NULL }; |
749
26ff35aa9b2b
[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
nenolod
parents:
diff
changeset
|
320 |
1671
49704b7f41db
Use SIMPLE_INPUT_PLUGIN
Christian Birchinger <joker@netswarm.net>
parents:
1617
diff
changeset
|
321 SIMPLE_INPUT_PLUGIN(vtx, vtx_iplist); |