Mercurial > audlegacy-plugins
annotate src/crystalizer/crystalizer.c @ 2897:8eaff6228606
added "directory parameters" for stream, made string constants localizable
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Wed, 13 Aug 2008 12:39:21 +0300 |
parents | bd3a24b39058 |
children | 3134a0987162 |
rev | line source |
---|---|
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
1 /* |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
2 * Copyright (c) 2008 William Pitcock <nenolod@nenolod.net> |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
3 * |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
4 * Permission to use, copy, modify, and/or distribute this software for any |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
5 * purpose with or without fee is hereby granted, provided that the above |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
6 * copyright notice and this permission notice is present in all copies. |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
7 * |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
8 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
9 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
11 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
12 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
13 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
14 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
15 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
16 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
17 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
18 */ |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
19 |
2498
194c2f8c2a92
Include cleanups, part #3.
Matti Hamalainen <ccr@tnsp.org>
parents:
2124
diff
changeset
|
20 #include "config.h" |
2519
2da1343a024d
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
William Pitcock <nenolod@atheme.org>
diff
changeset
|
21 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 #include <gtk/gtk.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
26
diff
changeset
|
23 #include <audacious/i18n.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include <audacious/plugin.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 static void init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 static void configure(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch); |
2575
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
29 static void query_format(AFormat * fmt, gint * rate, gint * nch); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
31 EffectPlugin crystalizer_ep = |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 { |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
33 .description = "Crystalizer", /* Description */ |
1639
a83a065e6518
stereo_plugin: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
34 .init = init, |
a83a065e6518
stereo_plugin: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
35 .configure = configure, |
2575
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
36 .mod_samples = mod_samples, |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
37 .query_format = query_format |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 static GtkWidget *conf_dialog = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 static gdouble value; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
43 EffectPlugin *crystalizer_eplist[] = { &crystalizer_ep, NULL }; |
1108 | 44 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
45 DECLARE_PLUGIN(crystalizer, NULL, NULL, NULL, NULL, crystalizer_eplist, NULL, NULL, NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 static void init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2520
diff
changeset
|
49 mcs_handle_t *db; |
2124 | 50 db = aud_cfg_db_open(); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
51 if (!aud_cfg_db_get_double(db, "crystalizer", "intensity", &value)) |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
52 value = 1.0; |
2124 | 53 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
56 /* conf dialog stuff stolen from stereo plugin --nenolod */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 static void conf_ok_cb(GtkButton * button, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2520
diff
changeset
|
59 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 value = *(gdouble *) data; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
2124 | 63 db = aud_cfg_db_open(); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
64 aud_cfg_db_set_double(db, "crystalizer", "intensity", value); |
2124 | 65 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 gtk_widget_destroy(conf_dialog); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 static void conf_cancel_cb(GtkButton * button, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 gtk_widget_destroy(conf_dialog); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 static void conf_apply_cb(GtkButton *button, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 value = *(gdouble *) data; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 static void configure(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 GtkWidget *hbox, *label, *scale, *button, *bbox; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 GtkObject *adjustment; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 if (conf_dialog != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 conf_dialog = gtk_dialog_new(); |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
88 g_signal_connect(GTK_OBJECT(conf_dialog), "destroy", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &conf_dialog); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
90 gtk_window_set_title(GTK_WINDOW(conf_dialog), _("Configure Crystalizer")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 label = gtk_label_new(_("Effect intensity:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(conf_dialog)->vbox), label, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 gtk_widget_show(label); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 hbox = gtk_hbox_new(FALSE, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(conf_dialog)->vbox), hbox, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 TRUE, TRUE, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 gtk_widget_show(hbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 adjustment = gtk_adjustment_new(value, 0.0, 15.0 + 1.0, 0.1, 1.0, 1.0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 scale = gtk_hscale_new(GTK_ADJUSTMENT(adjustment)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 gtk_box_pack_start(GTK_BOX(hbox), scale, TRUE, TRUE, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 gtk_widget_show(scale); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 bbox = gtk_hbutton_box_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 gtk_box_pack_start(GTK_BOX((GTK_DIALOG(conf_dialog)->action_area)), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 bbox, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 button = gtk_button_new_with_label(_("Ok")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
116 g_signal_connect(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 GTK_SIGNAL_FUNC(conf_ok_cb), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 >K_ADJUSTMENT(adjustment)->value); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 gtk_widget_grab_default(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 button = gtk_button_new_with_label(_("Cancel")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
125 g_signal_connect(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 GTK_SIGNAL_FUNC(conf_cancel_cb), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 button = gtk_button_new_with_label(_("Apply")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
132 g_signal_connect(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 GTK_SIGNAL_FUNC(conf_apply_cb), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 >K_ADJUSTMENT(adjustment)->value); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 gtk_widget_show(bbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 gtk_widget_show(conf_dialog); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 |
2575
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
142 static void query_format(AFormat * fmt, gint * rate, gint * nch) |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
143 { |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
144 if (!(*fmt == FMT_S16_NE || |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
145 (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
146 (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
147 *fmt = FMT_S16_NE; |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
148 } |
1e67df1a1edc
Implemented query_format() callback in all effect plugins
Stefano D'Angelo <zanga.mail@gmail.com>
parents:
2523
diff
changeset
|
149 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 gint i; |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
153 gdouble tmp; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
154 static gdouble prev[2], diff[2]; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
155 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 gint16 *data = (gint16 *)*d; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 if (!(afmt == FMT_S16_NE || |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 (afmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
160 (afmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 return length; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 for (i = 0; i < length / 2; i += 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 { |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
165 diff[0] = data[i] - prev[0]; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
166 diff[1] = data[i + 1] - prev[1]; |
2520
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
167 prev[0] = data[i]; |
7aca8941495b
Further tweaks, should work fine now.
William Pitcock <nenolod@atheme.org>
parents:
2519
diff
changeset
|
168 prev[1] = data[i + 1]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
170 tmp = data[i] + (diff[0] * value); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 if (tmp < -32768) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 tmp = -32768; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 if (tmp > 32767) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 tmp = 32767; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 data[i] = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
177 tmp = data[i + 1] + (diff[1] * value); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 if (tmp < -32768) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 tmp = -32768; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 if (tmp > 32767) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 tmp = 32767; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 data[i + 1] = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 } |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
184 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 return length; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 } |