Mercurial > audlegacy
annotate Plugins/Input/timidity/src/xmms-timidity.c @ 552:dd3d8211d3ef trunk
[svn] make timidity strings translatable
author | nenolod |
---|---|
date | Wed, 01 Feb 2006 13:08:39 -0800 |
parents | 61046bc4d0d6 |
children | 6636d328fa38 |
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" |
552 | 28 #include <glib.h> |
29 #include <glib/gi18n.h> | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
30 #include <gtk/gtk.h> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
31 #include <string.h> |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
32 #include <timidity.h> |
292
f99bf98118fc
[svn] How about a default timidity.cfg location that actually works?
chainsaw
parents:
290
diff
changeset
|
33 #include <stdio.h> |
423
c7119bdbcc76
[svn] - remove fullscreen.c, fullscreen.h (I know of nothing for audacious
nenolod
parents:
373
diff
changeset
|
34 #include "audacious/output.h" |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
35 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
36 #include "xmms-timidity.h" |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
37 #include "interface.h" |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
38 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
39 InputPlugin xmmstimid_ip = { |
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 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
42 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
43 xmmstimid_init, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
44 xmmstimid_about, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
45 xmmstimid_configure, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
46 xmmstimid_is_our_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
47 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
48 xmmstimid_play_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
49 xmmstimid_stop, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
50 xmmstimid_pause, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
51 xmmstimid_seek, |
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 xmmstimid_get_time, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
54 NULL, |
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 xmmstimid_cleanup, |
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 NULL, |
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 xmmstimid_get_song_info, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
62 NULL, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
63 NULL |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
64 }; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
65 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
66 static struct { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
67 gchar *config_file; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
68 gint rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
69 gint bits; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
70 gint channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
71 gint buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
72 } xmmstimid_cfg; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
73 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
74 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
|
75 static GThread *xmmstimid_decode_thread; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
76 static gboolean xmmstimid_audio_error = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
77 static MidSongOptions xmmstimid_opts; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
78 static MidSong *xmmstimid_song; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
79 static gboolean xmmstimid_going; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
80 static gboolean xmmstimid_eof; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
81 static gint xmmstimid_seek_to; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
82 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
83 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
|
84 static GtkEntry |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
85 *xmmstimid_conf_config_file; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
86 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
87 *xmmstimid_conf_rate_11000, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
88 *xmmstimid_conf_rate_22000, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
89 *xmmstimid_conf_rate_44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
90 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
91 *xmmstimid_conf_bits_8, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
92 *xmmstimid_conf_bits_16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
93 static GtkToggleButton |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
94 *xmmstimid_conf_channels_1, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
95 *xmmstimid_conf_channels_2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
96 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
97 InputPlugin *get_iplugin_info(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
98 xmmstimid_ip.description = g_strdup_printf( |
552 | 99 _("TiMidity Player %s"), VERSION); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
100 return &xmmstimid_ip; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
101 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
102 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
103 void xmmstimid_init(void) { |
302 | 104 ConfigDb *db; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
105 |
302 | 106 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
|
107 xmmstimid_cfg.rate = 44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
108 xmmstimid_cfg.bits = 16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
109 xmmstimid_cfg.channels = 2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
110 xmmstimid_cfg.buffer_size = 512; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
111 |
302 | 112 db = bmp_cfg_db_open(); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
113 |
302 | 114 bmp_cfg_db_get_string(db, "timidity", "config_file", &xmmstimid_cfg.config_file); |
115 bmp_cfg_db_get_int(db, "timidity", "samplerate", &xmmstimid_cfg.rate); | |
116 bmp_cfg_db_get_int(db, "timidity", "bits", &xmmstimid_cfg.bits); | |
117 bmp_cfg_db_get_int(db, "timidity", "channels", &xmmstimid_cfg.channels); | |
118 bmp_cfg_db_close(db); | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
119 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
120 if (mid_init(xmmstimid_cfg.config_file) != 0) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
121 xmmstimid_initialized = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
122 return; |
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 xmmstimid_initialized = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
125 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
126 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
127 void xmmstimid_about(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
128 if (xmmstimid_about_wnd == NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
129 gchar *name_version; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
130 xmmstimid_about_wnd = create_xmmstimid_about_wnd(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
131 name_version = g_strdup_printf( |
552 | 132 _("TiMidity Plugin %s"), VERSION); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
133 gtk_label_set_text( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
134 GTK_LABEL(gtk_object_get_data( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
135 GTK_OBJECT(xmmstimid_about_wnd), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
136 "name_version")), name_version); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
137 g_free(name_version); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
138 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
139 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
140 gtk_widget_show(xmmstimid_about_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
141 gdk_window_raise(xmmstimid_about_wnd->window); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
142 } |
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_conf_ok(GtkButton *button, gpointer user_data); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
145 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
146 void xmmstimid_configure(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
147 GtkToggleButton *tb; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
148 if (xmmstimid_conf_wnd == NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
149 xmmstimid_conf_wnd = create_xmmstimid_conf_wnd(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
150 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
151 #define get_conf_wnd_item(type, name) \ |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
152 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
|
153 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
154 xmmstimid_conf_config_file = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
155 GTK_ENTRY, "config_file"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
156 xmmstimid_conf_rate_11000 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
157 GTK_TOGGLE_BUTTON, "rate_11000"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
158 xmmstimid_conf_rate_22000 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
159 GTK_TOGGLE_BUTTON, "rate_22000"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
160 xmmstimid_conf_rate_44100 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
161 GTK_TOGGLE_BUTTON, "rate_44100"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
162 xmmstimid_conf_bits_8 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
163 GTK_TOGGLE_BUTTON, "bits_8"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
164 xmmstimid_conf_bits_16 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
165 GTK_TOGGLE_BUTTON, "bits_16"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
166 xmmstimid_conf_channels_1 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
167 GTK_TOGGLE_BUTTON, "channels_1"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
168 xmmstimid_conf_channels_2 = get_conf_wnd_item( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
169 GTK_TOGGLE_BUTTON, "channels_2"); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
170 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
171 gtk_signal_connect_object( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
172 get_conf_wnd_item(GTK_OBJECT, "conf_ok"), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
173 "clicked", GTK_SIGNAL_FUNC(xmmstimid_conf_ok), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
174 NULL); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
175 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
176 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
177 gtk_entry_set_text(xmmstimid_conf_config_file, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
178 xmmstimid_cfg.config_file); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
179 switch (xmmstimid_cfg.rate) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
180 case 11000: tb = xmmstimid_conf_rate_11000; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
181 case 22000: tb = xmmstimid_conf_rate_22000; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
182 case 44100: tb = xmmstimid_conf_rate_44100; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
183 default: tb = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
184 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
185 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
|
186 switch (xmmstimid_cfg.bits) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
187 case 8: tb = xmmstimid_conf_bits_8; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
188 case 16: tb = xmmstimid_conf_bits_16; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
189 default: tb = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
190 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
191 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
|
192 switch (xmmstimid_cfg.channels) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
193 case 1: tb = xmmstimid_conf_channels_1; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
194 case 2: tb = xmmstimid_conf_channels_2; break; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
195 default: tb = NULL; |
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 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
|
198 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
199 gtk_widget_show(xmmstimid_conf_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
200 gdk_window_raise(xmmstimid_conf_wnd->window); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
201 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
202 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
203 void xmmstimid_conf_ok(GtkButton *button, gpointer user_data) { |
302 | 204 ConfigDb *db; |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
205 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
206 g_free(xmmstimid_cfg.config_file); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
207 xmmstimid_cfg.config_file = g_strdup( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
208 gtk_entry_get_text(xmmstimid_conf_config_file)); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
209 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
210 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
|
211 xmmstimid_cfg.rate = 11000; |
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_22000)) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
213 xmmstimid_cfg.rate = 22000; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
214 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
|
215 xmmstimid_cfg.rate = 44100; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
216 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
|
217 xmmstimid_cfg.bits = 8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
218 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
|
219 xmmstimid_cfg.bits = 16; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
220 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
|
221 xmmstimid_cfg.channels = 1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
222 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
|
223 xmmstimid_cfg.channels = 2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
224 |
302 | 225 db = bmp_cfg_db_open(); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
226 |
302 | 227 bmp_cfg_db_set_string(db, "timidity", "config_file", xmmstimid_cfg.config_file); |
228 bmp_cfg_db_set_int(db, "timidity", "samplerate", xmmstimid_cfg.rate); | |
229 bmp_cfg_db_set_int(db, "timidity", "bits", xmmstimid_cfg.bits); | |
230 bmp_cfg_db_set_int(db, "timidity", "channels", xmmstimid_cfg.channels); | |
231 bmp_cfg_db_close(db); | |
285
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 gtk_widget_hide(xmmstimid_conf_wnd); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
234 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
235 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
236 int xmmstimid_is_our_file(char *filename) { |
367 | 237 VFSFile *file; |
238 gchar magic[4]; | |
373
7e81e9ef40f2
[svn] Add parenthesis around assignment used as truth value.
chainsaw
parents:
367
diff
changeset
|
239 if ((file = vfs_fopen(filename, "rb"))) { |
367 | 240 vfs_fread(magic, 1, 4, file); |
241 if (!strncmp(magic, "MThd", 4)) { | |
242 vfs_fclose(file); | |
243 return 1; | |
244 } | |
245 vfs_fclose(file); | |
246 } | |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
247 return 0; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
248 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
249 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
250 static void *xmmstimid_play_loop(void *arg) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
251 size_t buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
252 void *buffer; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
253 size_t bytes_read; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
254 AFormat fmt; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
255 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
256 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
|
257 xmmstimid_opts.channels / 8 * |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
258 xmmstimid_opts.buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
259 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
260 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
|
261 if (buffer == NULL) g_thread_exit(NULL); |
285
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 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
|
264 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
265 while (xmmstimid_going) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
266 bytes_read = mid_song_read_wave(xmmstimid_song, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
267 buffer, buffer_size); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
268 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
269 if (bytes_read != 0) |
446 | 270 produce_audio(mid_song_get_time(xmmstimid_song), |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
271 fmt, xmmstimid_opts.channels, |
426 | 272 bytes_read, buffer, &xmmstimid_going); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
273 else xmmstimid_eof = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
274 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
275 if (xmmstimid_seek_to != -1) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
276 mid_song_seek(xmmstimid_song, xmmstimid_seek_to * 1000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
277 xmmstimid_ip.output->flush(xmmstimid_seek_to * 1000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
278 xmmstimid_seek_to = -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
279 bytes_read = 0; |
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 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
282 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
283 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
|
284 g_thread_exit(NULL); |
298 | 285 return(NULL); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
286 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
287 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
288 static gchar *xmmstimid_get_title(gchar *filename) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
289 TitleInput *input; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
290 gchar *temp, *ext, *title, *path, *temp2; |
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 input = bmp_title_input_new(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
293 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
294 path = g_strdup(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
295 temp = g_strdup(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
296 ext = strrchr(temp, '.'); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
297 if (ext) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
298 *ext = '\0'; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
299 temp2 = strrchr(path, '/'); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
300 if (temp2) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
301 *temp2 = '\0'; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
302 |
298 | 303 input->file_name = g_path_get_basename(filename); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
304 input->file_ext = ext ? ext+1 : NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
305 input->file_path = g_strdup_printf("%s/", path); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
306 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
307 title = xmms_get_titlestring(xmms_get_gentitle_format(), input); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
308 if (title == NULL) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
309 title = g_strdup(input->file_name); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
310 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
311 g_free(temp); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
312 g_free(path); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
313 g_free(input); |
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 return title; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
316 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
317 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
318 void xmmstimid_play_file(char *filename) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
319 MidIStream *stream; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
320 gchar *title; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
321 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
322 if (!xmmstimid_initialized) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
323 xmmstimid_init(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
324 if (!xmmstimid_initialized) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
325 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
326 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
327 if (xmmstimid_song != NULL) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
328 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
329 xmmstimid_song = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
330 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
331 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
332 stream = mid_istream_open_file(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
333 if (stream == NULL) return; |
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_audio_error = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
336 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
337 xmmstimid_opts.rate = xmmstimid_cfg.rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
338 xmmstimid_opts.format = (xmmstimid_cfg.bits == 16) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
339 MID_AUDIO_S16LSB : MID_AUDIO_S8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
340 xmmstimid_opts.channels = xmmstimid_cfg.channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
341 xmmstimid_opts.buffer_size = xmmstimid_cfg.buffer_size; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
342 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
343 xmmstimid_song = mid_song_load(stream, &xmmstimid_opts); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
344 mid_istream_close(stream); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
345 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
346 if (xmmstimid_song == NULL) { |
552 | 347 xmmstimid_ip.set_info_text(_("Couldn't load MIDI file")); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
348 return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
349 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
350 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
351 if (xmmstimid_ip.output->open_audio( |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
352 (xmmstimid_opts.format == MID_AUDIO_S16LSB) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
353 FMT_S16_LE : FMT_S8, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
354 xmmstimid_opts.rate, xmmstimid_opts.channels) == 0) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
355 xmmstimid_audio_error = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
356 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
357 xmmstimid_song = NULL; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
358 return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
359 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
360 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
361 title = xmmstimid_get_title(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
362 xmmstimid_ip.set_info(title, |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
363 mid_song_get_total_time(xmmstimid_song), |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
364 0, xmmstimid_opts.rate, xmmstimid_opts.channels); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
365 g_free(title); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
366 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
367 mid_song_start(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
368 xmmstimid_going = TRUE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
369 xmmstimid_eof = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
370 xmmstimid_seek_to = -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
371 |
292
f99bf98118fc
[svn] How about a default timidity.cfg location that actually works?
chainsaw
parents:
290
diff
changeset
|
372 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
|
373 if (xmmstimid_decode_thread == NULL) { |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
374 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
375 xmmstimid_stop(); |
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 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
378 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
379 void xmmstimid_stop(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
380 if (xmmstimid_song != NULL && xmmstimid_going) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
381 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
|
382 g_thread_join(xmmstimid_decode_thread); |
285
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
383 xmmstimid_ip.output->close_audio(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
384 mid_song_free(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
385 xmmstimid_song = NULL; |
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 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
388 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
389 void xmmstimid_pause(short p) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
390 xmmstimid_ip.output->pause(p); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
391 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
392 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
393 void xmmstimid_seek(int time) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
394 xmmstimid_seek_to = time; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
395 xmmstimid_eof = FALSE; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
396 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
397 while (xmmstimid_seek_to != -1) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
398 xmms_usleep(10000); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
399 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
400 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
401 int xmmstimid_get_time(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
402 if (xmmstimid_audio_error) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
403 return -2; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
404 if (xmmstimid_song == NULL) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
405 return -1; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
406 if (!xmmstimid_going || (xmmstimid_eof && |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
407 xmmstimid_ip.output->buffer_playing())) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
408 return -1; |
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 return mid_song_get_time(xmmstimid_song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
411 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
412 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
413 void xmmstimid_cleanup(void) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
414 if (xmmstimid_initialized) |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
415 mid_exit(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
416 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
417 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
418 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
|
419 MidIStream *stream; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
420 MidSongOptions opts; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
421 MidSong *song; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
422 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
423 if (!xmmstimid_initialized) { |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
424 xmmstimid_init(); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
425 if (!xmmstimid_initialized) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
426 } |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
427 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
428 stream = mid_istream_open_file(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
429 if (stream == NULL) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
430 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
431 opts.rate = xmmstimid_cfg.rate; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
432 opts.format = (xmmstimid_cfg.bits == 16) ? |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
433 MID_AUDIO_S16LSB : MID_AUDIO_S8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
434 opts.channels = xmmstimid_cfg.channels; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
435 opts.buffer_size = 8; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
436 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
437 song = mid_song_load(stream, &opts); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
438 mid_istream_close(stream); |
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 if (song == NULL) return; |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
441 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
442 *length = mid_song_get_total_time(song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
443 *title = xmmstimid_get_title(filename); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
444 |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
445 mid_song_free(song); |
d1762728ea4b
[svn] Timidity support, via external contractor dai+audacious@cdr.jp.
nenolod
parents:
diff
changeset
|
446 } |