Mercurial > audlegacy-plugins
annotate src/metronom/metronom.c @ 2512:1f6b5f5768e2
Remove some completely useless null-pointer checks, g_free() checks the pointer anyway.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 02 Apr 2008 22:58:35 +0300 |
parents | 8f3188746b64 |
children | bd3a24b39058 |
rev | line source |
---|---|
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
1 /* |
698 | 2 * Copyright 2000 Martin Strau? <mys@faveve.uni-stuttgart.de> |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
3 * |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
4 * |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
8 * (at your option) any later version. |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
9 * |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
14 * |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
18 */ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
19 |
1961
e8ea3a76a84e
Various #include cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1677
diff
changeset
|
20 #include "config.h" |
434
7385182ae4b8
[svn] - add missing config.h inclusion for wavpack, null and metronom plugin
giacomo
parents:
315
diff
changeset
|
21 #include <audacious/plugin.h> |
1973
f86cb7fc1d4f
Add -pipe -Wall if gcc and fix a few warnings.
Jonathan Schleifer <js@h3c.de>
parents:
1961
diff
changeset
|
22 #include <audacious/output.h> |
434
7385182ae4b8
[svn] - add missing config.h inclusion for wavpack, null and metronom plugin
giacomo
parents:
315
diff
changeset
|
23 #include <audacious/util.h> |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
24 #include <audacious/i18n.h> |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
25 #include <glib.h> |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
26 #include <string.h> |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
27 |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
28 #define MIN_BPM 1 |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
29 #define MAX_BPM 512 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
30 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
31 static InputPlugin metronom_ip; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
32 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
33 static gboolean going; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
34 static gboolean audio_error; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
35 static GThread *play_thread; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
36 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
37 struct metronom_struct { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
38 gint bpm; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
39 gint num; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
40 gint den; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
41 gint id; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
42 }; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
43 typedef struct metronom_struct metronom_t; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
44 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
45 #define tact_id_max 12 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
46 gint tact_id[tact_id_max][2]= |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
47 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
48 {1,1}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
49 {2,2}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
50 {3,2}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
51 {4,2}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
52 {2,4}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
53 {3,4}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
54 {4,4}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
55 {6,4}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
56 {2,8}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
57 {3,8}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
58 {4,8}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
59 {6,8} |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
60 }; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
61 #define tact_form_max 8 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
62 gdouble tact_form[tact_id_max][tact_form_max]= |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
63 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
64 {1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
65 {1.0,0.5,0.0,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
66 {1.0,0.5,0.5,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
67 {1.0,0.5,0.6,0.5,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
68 {1.0,0.5,0.0,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
69 {1.0,0.5,0.5,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
70 {1.0,0.5,0.6,0.5,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
71 {1.0,0.5,0.5,0.6,0.5,0.5,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
72 {1.0,0.5,0.0,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
73 {1.0,0.5,0.5,0.0,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
74 {1.0,0.5,0.6,0.5,0.0,0.0,0.0,0.0}, |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
75 {1.0,0.5,0.5,0.6,0.5,0.5,0.0,0.0} |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
76 }; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
77 |
1481
469419424896
Register tact:// with uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
1447
diff
changeset
|
78 static void metronom_init(void) |
469419424896
Register tact:// with uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
1447
diff
changeset
|
79 { |
1997 | 80 aud_uri_set_plugin("tact://", &metronom_ip); |
1481
469419424896
Register tact:// with uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
1447
diff
changeset
|
81 } |
469419424896
Register tact:// with uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
1447
diff
changeset
|
82 |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
83 static void metronom_about(void) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
84 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
85 static GtkWidget *box; |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
86 box = audacious_info_dialog( |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
87 _("About Metronom"), |
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
88 _("A Tact Generator by Martin Strauss <mys@faveve.uni-stuttgart.de>\n\nTo use it, add a URL: tact://beats*num/den\ne.g. tact://77 to play 77 beats per minute\nor tact://60*3/4 to play 60 bpm in 3/4 tacts"), _("Ok"), |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
89 FALSE, NULL, NULL); |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
90 gtk_signal_connect(GTK_OBJECT(box), "destroy", |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
91 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &box); |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
92 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
93 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
94 static int metronom_is_our_file(char *filename) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
95 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
96 if (!strncmp(filename, "tact://", 7)) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
97 return TRUE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
98 return FALSE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
99 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
100 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
101 #define BUF_SAMPLES 512 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
102 #define BUF_BYTES BUF_SAMPLES * 2 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
103 #define MAX_AMPL (GINT16_TO_LE((1<<15) - 1)) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
104 |
1973
f86cb7fc1d4f
Add -pipe -Wall if gcc and fix a few warnings.
Jonathan Schleifer <js@h3c.de>
parents:
1961
diff
changeset
|
105 static void play_loop(void *arg) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
106 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
107 gint16 data[BUF_SAMPLES]; |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
108 InputPlayback *playback = arg; |
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
109 metronom_t *pmetronom=(metronom_t *)playback->data; |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
110 gint i; |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
111 |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
112 gint16 t = 0,tact; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
113 gint16 datagoal = 0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
114 gint16 datamiddle = 0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
115 gint16 datacurrent = datamiddle; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
116 gint16 datalast = datamiddle; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
117 gint16 data_form[tact_form_max]; |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
118 gint num; |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
119 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
120 tact = 60*44100/pmetronom->bpm; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
121 /* prepare weighted amplitudes */ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
122 for(num=0;num<pmetronom->num;num++){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
123 data_form[num]=MAX_AMPL*tact_form[pmetronom->id][num]; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
124 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
125 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
126 num=0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
127 while (going) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
128 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
129 for (i = 0; i < BUF_SAMPLES; i++){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
130 if(t==tact){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
131 t=0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
132 datagoal = data_form[num]; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
133 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
134 else if(t==10) { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
135 datagoal = -data_form[num]; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
136 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
137 else if(t==25) { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
138 datagoal = data_form[num]; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
139 /* circle through weighted amplitudes */ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
140 num++; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
141 if(num==pmetronom->num)num=0; |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
142 } |
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
143 /* makes curve a little bit smoother */ |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
144 data[i]=(datalast+datacurrent+datagoal)/3; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
145 datalast=datacurrent; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
146 datacurrent=data[i]; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
147 if(t > 35) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
148 datagoal=(datamiddle+7*datagoal)/8; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
149 t++; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
150 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
151 if (going) |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1997
diff
changeset
|
152 playback->pass_audio(playback, FMT_S16_LE, 1, BUF_BYTES, data, &going); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
153 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
154 /* Make sure the output plugin stops prebuffering */ |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
155 playback->output->buffer_free(); |
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
156 playback->output->buffer_free(); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
157 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
158 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
159 static void metronom_play(InputPlayback *playback) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
160 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
161 char *filename = playback->filename; |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
162 gchar *name; |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
163 size_t count; |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
164 metronom_t *pmetronom; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
165 gint flag,id; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
166 |
526 | 167 pmetronom=(metronom_t *)g_malloc(sizeof(metronom_t)); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
168 if(!pmetronom)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
169 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
170 count=sscanf(filename, "tact://%d*%d/%d", &pmetronom->bpm,&pmetronom->num,&pmetronom->den); |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
171 if (count != 1 && count !=3)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
172 if(!(pmetronom->bpm >= MIN_BPM && pmetronom->bpm <= MAX_BPM))return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
173 pmetronom->id=0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
174 if(count==1){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
175 pmetronom->num=1; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
176 pmetronom->den=1; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
177 } else { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
178 if(pmetronom->num==0 || pmetronom->den==0)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
179 flag=FALSE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
180 for(id=0;(id<tact_id_max && (!flag));id++){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
181 if(pmetronom->num==tact_id[id][0] && pmetronom->den==tact_id[id][1]){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
182 flag=TRUE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
183 pmetronom->id=id; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
184 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
185 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
186 if(!flag)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
187 } |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
188 |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
189 going = TRUE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
190 audio_error = FALSE; |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
191 if (playback->output->open_audio(FMT_S16_LE, 44100, 1) == 0) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
192 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
193 audio_error = TRUE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
194 going = FALSE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
195 return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
196 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
197 if(pmetronom->num==1 && pmetronom->den==1){ |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
198 name = g_strdup_printf(_("Tact generator: %d bpm"), pmetronom->bpm); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
199 } else { |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
200 name = g_strdup_printf(_("Tact generator: %d bpm %d/%d"), pmetronom->bpm,pmetronom->num,pmetronom->den); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
201 } |
1986 | 202 playback->set_params(playback, name, -1, 16 * 44100, 44100, 1); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
203 g_free(name); |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
204 playback->data = pmetronom; |
1356
996430ebc1c8
metronom: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1288
diff
changeset
|
205 play_thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1395
diff
changeset
|
206 playback->set_pb_ready(playback); |
1356
996430ebc1c8
metronom: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1288
diff
changeset
|
207 play_loop(playback); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
208 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
209 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
210 static void metronom_stop(InputPlayback *playback) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
211 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
212 if (going) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
213 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
214 going = FALSE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
215 g_thread_join(play_thread); |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
216 playback->output->close_audio(); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
217 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
218 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
219 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
220 static void metronom_pause(InputPlayback *playback, short paused) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
221 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
222 playback->output->pause(paused); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
223 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
224 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
225 static int metronom_get_time(InputPlayback *playback) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
226 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
227 if (audio_error) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
228 return -2; |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
229 if (!going && !playback->output->buffer_playing()) |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
230 return -1; |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
231 return playback->output->output_time(); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
232 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
233 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
234 static void metronom_song_info(char *filename, char **title, int *length) |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
235 { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
236 metronom_t metronom; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
237 metronom_t *pmetronom=&metronom; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
238 size_t count; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
239 gint flag,id; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
240 *length = -1; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
241 *title = NULL; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
242 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
243 count=sscanf(filename, "tact://%d*%d/%d", &pmetronom->bpm,&pmetronom->num,&pmetronom->den); |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
244 if (count != 1 && count !=3)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
245 if(!(pmetronom->bpm >= MIN_BPM && pmetronom->bpm <= MAX_BPM))return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
246 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
247 if (count == 1) { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
248 pmetronom->num=1; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
249 pmetronom->den=1; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
250 pmetronom->id=0; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
251 } else { |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
252 if(pmetronom->num==0 || pmetronom->den==0)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
253 flag=FALSE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
254 for(id=0;(id<tact_id_max && (!flag));id++){ |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
255 if(pmetronom->num==tact_id[id][0] && pmetronom->den==tact_id[id][1])flag=TRUE; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
256 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
257 if(!flag)return; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
258 else pmetronom->id=id; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
259 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
260 |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
261 if(pmetronom->num==1 && pmetronom->den==1){ |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
262 *title = g_strdup_printf(_("Tact generator: %d bpm"), pmetronom->bpm); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
263 } else { |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
264 *title = g_strdup_printf(_("Tact generator: %d bpm %d/%d"), pmetronom->bpm,pmetronom->num,pmetronom->den); |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
265 } |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
266 } |
1288
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
267 |
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
268 |
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
269 |
a3a59254d286
All strings are now translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
1089
diff
changeset
|
270 static InputPlugin metronom_ip = |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
271 { |
1616
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
272 .description = "Tact Generator", |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
273 .init = metronom_init, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
274 .about = metronom_about, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
275 .is_our_file = metronom_is_our_file, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
276 .play_file = metronom_play, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
277 .stop = metronom_stop, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
278 .pause = metronom_pause, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
279 .get_time = metronom_get_time, |
13ac6cc08bfa
metronom: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1481
diff
changeset
|
280 .get_song_info = metronom_song_info, |
315
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
281 }; |
2294f3a6f136
[svn] Metronom (a.k.a. tact generator) input plugin, ported from XMMS.
chainsaw
parents:
diff
changeset
|
282 |
1089 | 283 InputPlugin *metronom_iplist[] = { &metronom_ip, NULL }; |
284 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1356
diff
changeset
|
285 DECLARE_PLUGIN(metronom, NULL, NULL, metronom_iplist, NULL, NULL, NULL, NULL, NULL); |