Mercurial > audlegacy
annotate Plugins/Input/timidity/src/xmms-timidity.c @ 425:e36afef679e8 trunk
[svn] timidity fixes... remove duplicated code provided by produce_audio()
-_-.
author | nenolod |
---|---|
date | Fri, 13 Jan 2006 20:48:46 -0800 |
parents | c7119bdbcc76 |
children | 3181b4fe23ea |
rev | line source |
---|---|
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
1 /* |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
2 xmms-timidity - MIDI Plugin for XMMS |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
3 Copyright (C) 2004 Konstantin Korikov <lostclus@ua.fm> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
4 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
5 This program is free software; you can redistribute it and/or modify |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
7 the Free Software Foundation; either version 2 of the License, or |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
8 (at your option) any later version. |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
9 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
13 GNU General Public License for more details. |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
14 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
16 along with this program; if not, write to the Free Software |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
18 */ |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
19 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
20 #ifdef HAVE_CONFIG_H |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
21 #include <config.h> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
22 #endif |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
23 |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
24 #include "libaudacious/util.h" |
302 | 25 #include "libaudacious/configdb.h" |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
26 #include "libaudacious/titlestring.h" |
367 | 27 #include "libaudacious/vfs.h" |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
28 #include <gtk/gtk.h> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
29 #include <string.h> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
30 #include <timidity.h> |
292
f99bf98118fc
[svn] How about a default timidity.cfg location that actually works?
chainsaw
parents:
290
diff
changeset
|
31 #include <stdio.h> |
423
c7119bdbcc76
[svn] - remove fullscreen.c, fullscreen.h (I know of nothing for audacious
nenolod
parents:
373
diff
changeset
|
32 #include "audacious/output.h" |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
33 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
34 #include "xmms-timidity.h" |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
35 #include "interface.h" |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
36 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
37 InputPlugin xmmstimid_ip = { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
38 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
39 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
40 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
41 xmmstimid_init, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
42 xmmstimid_about, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
43 xmmstimid_configure, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
44 xmmstimid_is_our_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
45 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
46 xmmstimid_play_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
47 xmmstimid_stop, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
48 xmmstimid_pause, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
49 xmmstimid_seek, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
50 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
51 xmmstimid_get_time, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
52 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
53 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
54 xmmstimid_cleanup, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
55 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
56 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
57 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
58 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
59 xmmstimid_get_song_info, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
60 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
61 NULL |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
62 }; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
63 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
64 static struct { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
65 gchar *config_file; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
66 gint rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
67 gint bits; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
68 gint channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
69 gint buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
70 } xmmstimid_cfg; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
71 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
72 static gboolean xmmstimid_initialized = FALSE; |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
73 static GThread *xmmstimid_decode_thread; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
74 static gboolean xmmstimid_audio_error = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
75 static MidSongOptions xmmstimid_opts; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
76 static MidSong *xmmstimid_song; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
77 static gboolean xmmstimid_going; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
78 static gboolean xmmstimid_eof; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
79 static gint xmmstimid_seek_to; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
80 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
81 static GtkWidget *xmmstimid_conf_wnd = NULL, *xmmstimid_about_wnd = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
82 static GtkEntry |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
83 *xmmstimid_conf_config_file; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
84 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
85 *xmmstimid_conf_rate_11000, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
86 *xmmstimid_conf_rate_22000, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
87 *xmmstimid_conf_rate_44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
88 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
89 *xmmstimid_conf_bits_8, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
90 *xmmstimid_conf_bits_16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
91 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
92 *xmmstimid_conf_channels_1, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
93 *xmmstimid_conf_channels_2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
94 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
95 InputPlugin *get_iplugin_info(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
96 xmmstimid_ip.description = g_strdup_printf( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
97 "TiMidity Player %s", VERSION); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
98 return &xmmstimid_ip; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
99 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
100 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
101 void xmmstimid_init(void) { |
302 | 102 ConfigDb *db; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
103 |
302 | 104 xmmstimid_cfg.config_file = g_strdup("/etc/timidity.cfg"); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
105 xmmstimid_cfg.rate = 44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
106 xmmstimid_cfg.bits = 16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
107 xmmstimid_cfg.channels = 2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
108 xmmstimid_cfg.buffer_size = 512; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
109 |
302 | 110 db = bmp_cfg_db_open(); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
111 |
302 | 112 bmp_cfg_db_get_string(db, "timidity", "config_file", &xmmstimid_cfg.config_file); |
113 bmp_cfg_db_get_int(db, "timidity", "samplerate", &xmmstimid_cfg.rate); | |
114 bmp_cfg_db_get_int(db, "timidity", "bits", &xmmstimid_cfg.bits); | |
115 bmp_cfg_db_get_int(db, "timidity", "channels", &xmmstimid_cfg.channels); | |
116 bmp_cfg_db_close(db); | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
117 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
118 if (mid_init(xmmstimid_cfg.config_file) != 0) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
119 xmmstimid_initialized = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
120 return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
121 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
122 xmmstimid_initialized = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
123 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
124 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
125 void xmmstimid_about(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
126 if (xmmstimid_about_wnd == NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
127 gchar *name_version; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
128 xmmstimid_about_wnd = create_xmmstimid_about_wnd(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
129 name_version = g_strdup_printf( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
130 "TiMidity Plugin %s", VERSION); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
131 gtk_label_set_text( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
132 GTK_LABEL(gtk_object_get_data( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
133 GTK_OBJECT(xmmstimid_about_wnd), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
134 "name_version")), name_version); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
135 g_free(name_version); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
136 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
137 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
138 gtk_widget_show(xmmstimid_about_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
139 gdk_window_raise(xmmstimid_about_wnd->window); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
140 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
141 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
142 void xmmstimid_conf_ok(GtkButton *button, gpointer user_data); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
143 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
144 void xmmstimid_configure(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
145 GtkToggleButton *tb; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
146 if (xmmstimid_conf_wnd == NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
147 xmmstimid_conf_wnd = create_xmmstimid_conf_wnd(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
148 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
149 #define get_conf_wnd_item(type, name) \ |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
150 type (gtk_object_get_data(GTK_OBJECT(xmmstimid_conf_wnd), name)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
151 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
152 xmmstimid_conf_config_file = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
153 GTK_ENTRY, "config_file"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
154 xmmstimid_conf_rate_11000 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
155 GTK_TOGGLE_BUTTON, "rate_11000"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
156 xmmstimid_conf_rate_22000 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
157 GTK_TOGGLE_BUTTON, "rate_22000"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
158 xmmstimid_conf_rate_44100 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
159 GTK_TOGGLE_BUTTON, "rate_44100"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
160 xmmstimid_conf_bits_8 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
161 GTK_TOGGLE_BUTTON, "bits_8"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
162 xmmstimid_conf_bits_16 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
163 GTK_TOGGLE_BUTTON, "bits_16"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
164 xmmstimid_conf_channels_1 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
165 GTK_TOGGLE_BUTTON, "channels_1"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
166 xmmstimid_conf_channels_2 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
167 GTK_TOGGLE_BUTTON, "channels_2"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
168 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
169 gtk_signal_connect_object( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
170 get_conf_wnd_item(GTK_OBJECT, "conf_ok"), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
171 "clicked", GTK_SIGNAL_FUNC(xmmstimid_conf_ok), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
172 NULL); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
173 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
174 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
175 gtk_entry_set_text(xmmstimid_conf_config_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
176 xmmstimid_cfg.config_file); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
177 switch (xmmstimid_cfg.rate) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
178 case 11000: tb = xmmstimid_conf_rate_11000; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
179 case 22000: tb = xmmstimid_conf_rate_22000; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
180 case 44100: tb = xmmstimid_conf_rate_44100; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
181 default: tb = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
182 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
183 if (tb != NULL) gtk_toggle_button_set_active(tb, TRUE); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
184 switch (xmmstimid_cfg.bits) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
185 case 8: tb = xmmstimid_conf_bits_8; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
186 case 16: tb = xmmstimid_conf_bits_16; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
187 default: tb = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
188 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
189 if (tb != NULL) gtk_toggle_button_set_active(tb, TRUE); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
190 switch (xmmstimid_cfg.channels) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
191 case 1: tb = xmmstimid_conf_channels_1; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
192 case 2: tb = xmmstimid_conf_channels_2; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
193 default: tb = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
194 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
195 if (tb != NULL) gtk_toggle_button_set_active(tb, TRUE); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
196 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
197 gtk_widget_show(xmmstimid_conf_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
198 gdk_window_raise(xmmstimid_conf_wnd->window); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
199 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
200 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
201 void xmmstimid_conf_ok(GtkButton *button, gpointer user_data) { |
302 | 202 ConfigDb *db; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
203 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
204 g_free(xmmstimid_cfg.config_file); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
205 xmmstimid_cfg.config_file = g_strdup( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
206 gtk_entry_get_text(xmmstimid_conf_config_file)); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
207 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
208 if (gtk_toggle_button_get_active(xmmstimid_conf_rate_11000)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
209 xmmstimid_cfg.rate = 11000; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
210 else if (gtk_toggle_button_get_active(xmmstimid_conf_rate_22000)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
211 xmmstimid_cfg.rate = 22000; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
212 else if (gtk_toggle_button_get_active(xmmstimid_conf_rate_44100)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
213 xmmstimid_cfg.rate = 44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
214 if (gtk_toggle_button_get_active(xmmstimid_conf_bits_8)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
215 xmmstimid_cfg.bits = 8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
216 else if (gtk_toggle_button_get_active(xmmstimid_conf_bits_16)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
217 xmmstimid_cfg.bits = 16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
218 if (gtk_toggle_button_get_active(xmmstimid_conf_channels_1)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
219 xmmstimid_cfg.channels = 1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
220 else if (gtk_toggle_button_get_active(xmmstimid_conf_channels_2)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
221 xmmstimid_cfg.channels = 2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
222 |
302 | 223 db = bmp_cfg_db_open(); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
224 |
302 | 225 bmp_cfg_db_set_string(db, "timidity", "config_file", xmmstimid_cfg.config_file); |
226 bmp_cfg_db_set_int(db, "timidity", "samplerate", xmmstimid_cfg.rate); | |
227 bmp_cfg_db_set_int(db, "timidity", "bits", xmmstimid_cfg.bits); | |
228 bmp_cfg_db_set_int(db, "timidity", "channels", xmmstimid_cfg.channels); | |
229 bmp_cfg_db_close(db); | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
230 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
231 gtk_widget_hide(xmmstimid_conf_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
232 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
233 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
234 int xmmstimid_is_our_file(char *filename) { |
367 | 235 VFSFile *file; |
236 gchar magic[4]; | |
373
7e81e9ef40f2
[svn] Add parenthesis around assignment used as truth value.
chainsaw
parents:
367
diff
changeset
|
237 if ((file = vfs_fopen(filename, "rb"))) { |
367 | 238 vfs_fread(magic, 1, 4, file); |
239 if (!strncmp(magic, "MThd", 4)) { | |
240 vfs_fclose(file); | |
241 return 1; | |
242 } | |
243 vfs_fclose(file); | |
244 } | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
245 return 0; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
246 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
247 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
248 static void *xmmstimid_play_loop(void *arg) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
249 size_t buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
250 void *buffer; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
251 size_t bytes_read; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
252 AFormat fmt; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
253 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
254 buffer_size = ((xmmstimid_opts.format == MID_AUDIO_S16LSB) ? 16 : 8) * |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
255 xmmstimid_opts.channels / 8 * |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
256 xmmstimid_opts.buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
257 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
258 buffer = g_malloc(buffer_size); |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
259 if (buffer == NULL) g_thread_exit(NULL); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
260 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
261 fmt = (xmmstimid_opts.format == MID_AUDIO_S16LSB) ? FMT_S16_LE : FMT_S8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
262 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
263 while (xmmstimid_going) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
264 bytes_read = mid_song_read_wave(xmmstimid_song, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
265 buffer, buffer_size); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
266 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
267 if (bytes_read != 0) |
423
c7119bdbcc76
[svn] - remove fullscreen.c, fullscreen.h (I know of nothing for audacious
nenolod
parents:
373
diff
changeset
|
268 produce_audio(mid_song_get_time(xmmstimid_song), |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
269 fmt, xmmstimid_opts.channels, |
423
c7119bdbcc76
[svn] - remove fullscreen.c, fullscreen.h (I know of nothing for audacious
nenolod
parents:
373
diff
changeset
|
270 bytes_read, buffer, NULL); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
271 else xmmstimid_eof = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
272 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
273 if (xmmstimid_seek_to != -1) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
274 mid_song_seek(xmmstimid_song, xmmstimid_seek_to * 1000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
275 xmmstimid_ip.output->flush(xmmstimid_seek_to * 1000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
276 xmmstimid_seek_to = -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
277 bytes_read = 0; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
278 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
279 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
280 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
281 g_free(buffer); |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
282 g_thread_exit(NULL); |
298 | 283 return(NULL); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
284 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
285 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
286 static gchar *xmmstimid_get_title(gchar *filename) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
287 TitleInput *input; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
288 gchar *temp, *ext, *title, *path, *temp2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
289 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
290 input = bmp_title_input_new(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
291 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
292 path = g_strdup(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
293 temp = g_strdup(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
294 ext = strrchr(temp, '.'); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
295 if (ext) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
296 *ext = '\0'; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
297 temp2 = strrchr(path, '/'); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
298 if (temp2) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
299 *temp2 = '\0'; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
300 |
298 | 301 input->file_name = g_path_get_basename(filename); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
302 input->file_ext = ext ? ext+1 : NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
303 input->file_path = g_strdup_printf("%s/", path); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
304 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
305 title = xmms_get_titlestring(xmms_get_gentitle_format(), input); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
306 if (title == NULL) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
307 title = g_strdup(input->file_name); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
308 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
309 g_free(temp); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
310 g_free(path); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
311 g_free(input); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
312 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
313 return title; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
314 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
315 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
316 void xmmstimid_play_file(char *filename) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
317 MidIStream *stream; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
318 gchar *title; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
319 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
320 if (!xmmstimid_initialized) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
321 xmmstimid_init(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
322 if (!xmmstimid_initialized) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
323 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
324 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
325 if (xmmstimid_song != NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
326 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
327 xmmstimid_song = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
328 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
329 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
330 stream = mid_istream_open_file(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
331 if (stream == NULL) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
332 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
333 xmmstimid_audio_error = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
334 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
335 xmmstimid_opts.rate = xmmstimid_cfg.rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
336 xmmstimid_opts.format = (xmmstimid_cfg.bits == 16) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
337 MID_AUDIO_S16LSB : MID_AUDIO_S8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
338 xmmstimid_opts.channels = xmmstimid_cfg.channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
339 xmmstimid_opts.buffer_size = xmmstimid_cfg.buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
340 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
341 xmmstimid_song = mid_song_load(stream, &xmmstimid_opts); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
342 mid_istream_close(stream); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
343 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
344 if (xmmstimid_song == NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
345 xmmstimid_ip.set_info_text("Couldn't load MIDI file"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
346 return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
347 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
348 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
349 if (xmmstimid_ip.output->open_audio( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
350 (xmmstimid_opts.format == MID_AUDIO_S16LSB) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
351 FMT_S16_LE : FMT_S8, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
352 xmmstimid_opts.rate, xmmstimid_opts.channels) == 0) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
353 xmmstimid_audio_error = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
354 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
355 xmmstimid_song = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
356 return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
357 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
358 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
359 title = xmmstimid_get_title(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
360 xmmstimid_ip.set_info(title, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
361 mid_song_get_total_time(xmmstimid_song), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
362 0, xmmstimid_opts.rate, xmmstimid_opts.channels); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
363 g_free(title); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
364 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
365 mid_song_start(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
366 xmmstimid_going = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
367 xmmstimid_eof = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
368 xmmstimid_seek_to = -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
369 |
292
f99bf98118fc
[svn] How about a default timidity.cfg location that actually works?
chainsaw
parents:
290
diff
changeset
|
370 xmmstimid_decode_thread = g_thread_create((GThreadFunc)xmmstimid_play_loop, NULL, TRUE, NULL); |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
371 if (xmmstimid_decode_thread == NULL) { |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
372 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
373 xmmstimid_stop(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
374 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
375 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
376 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
377 void xmmstimid_stop(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
378 if (xmmstimid_song != NULL && xmmstimid_going) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
379 xmmstimid_going = FALSE; |
290
5ca6e39394b5
[svn] GThreadify and fix includes. And although it compiles, let us not ship this. No playback at all.
chainsaw
parents:
285
diff
changeset
|
380 g_thread_join(xmmstimid_decode_thread); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
381 xmmstimid_ip.output->close_audio(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
382 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
383 xmmstimid_song = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
384 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
385 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
386 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
387 void xmmstimid_pause(short p) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
388 xmmstimid_ip.output->pause(p); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
389 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
390 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
391 void xmmstimid_seek(int time) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
392 xmmstimid_seek_to = time; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
393 xmmstimid_eof = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
394 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
395 while (xmmstimid_seek_to != -1) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
396 xmms_usleep(10000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
397 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
398 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
399 int xmmstimid_get_time(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
400 if (xmmstimid_audio_error) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
401 return -2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
402 if (xmmstimid_song == NULL) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
403 return -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
404 if (!xmmstimid_going || (xmmstimid_eof && |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
405 xmmstimid_ip.output->buffer_playing())) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
406 return -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
407 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
408 return mid_song_get_time(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
409 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
410 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
411 void xmmstimid_cleanup(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
412 if (xmmstimid_initialized) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
413 mid_exit(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
414 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
415 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
416 void xmmstimid_get_song_info(char *filename, char **title, int *length) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
417 MidIStream *stream; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
418 MidSongOptions opts; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
419 MidSong *song; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
420 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
421 if (!xmmstimid_initialized) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
422 xmmstimid_init(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
423 if (!xmmstimid_initialized) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
424 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
425 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
426 stream = mid_istream_open_file(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
427 if (stream == NULL) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
428 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
429 opts.rate = xmmstimid_cfg.rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
430 opts.format = (xmmstimid_cfg.bits == 16) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
431 MID_AUDIO_S16LSB : MID_AUDIO_S8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
432 opts.channels = xmmstimid_cfg.channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
433 opts.buffer_size = 8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
434 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
435 song = mid_song_load(stream, &opts); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
436 mid_istream_close(stream); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
437 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
438 if (song == NULL) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
439 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
440 *length = mid_song_get_total_time(song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
441 *title = xmmstimid_get_title(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
442 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
443 mid_song_free(song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
444 } |