Mercurial > audlegacy-plugins
annotate src/crystalizer/crystalizer.c @ 2519:2da1343a024d
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Tue, 08 Apr 2008 15:11:35 -0500 |
parents | src/stereo_plugin/stereo.c@194c2f8c2a92 src/stereo_plugin/stereo.c@eef3a506a2b8 |
children | 7aca8941495b |
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> |
1950
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1677
diff
changeset
|
24 #include <audacious/util.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include <audacious/plugin.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 static void init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 static void configure(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 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
|
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, |
a83a065e6518
stereo_plugin: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
36 .mod_samples = mod_samples |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 }; |
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 static GtkWidget *conf_dialog = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 static gdouble value; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
42 EffectPlugin *crystalizer_eplist[] = { &crystalizer_ep, NULL }; |
1108 | 43 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
44 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
|
45 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 static void init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 ConfigDb *db; |
2124 | 49 db = aud_cfg_db_open(); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
50 if (!aud_cfg_db_get_double(db, "crystalizer", "intensity", &value)) |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
51 value = 1.0; |
2124 | 52 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 } |
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 static void conf_ok_cb(GtkButton * button, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 value = *(gdouble *) data; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
2124 | 61 db = aud_cfg_db_open(); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
62 aud_cfg_db_set_double(db, "crystalizer", "intensity", value); |
2124 | 63 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 gtk_widget_destroy(conf_dialog); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 static void conf_cancel_cb(GtkButton * button, gpointer data) |
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 gtk_widget_destroy(conf_dialog); |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 static void conf_apply_cb(GtkButton *button, gpointer data) |
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 value = *(gdouble *) 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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 static void configure(void) |
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 GtkWidget *hbox, *label, *scale, *button, *bbox; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 GtkObject *adjustment; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 if (conf_dialog != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 conf_dialog = gtk_dialog_new(); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
86 g_signal_connect_swapped(GTK_OBJECT(conf_dialog), "destroy", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &conf_dialog); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
88 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
|
89 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 label = gtk_label_new(_("Effect intensity:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 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
|
92 TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 gtk_widget_show(label); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 hbox = gtk_hbox_new(FALSE, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 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
|
97 TRUE, TRUE, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 gtk_widget_show(hbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 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
|
101 scale = gtk_hscale_new(GTK_ADJUSTMENT(adjustment)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 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
|
103 gtk_widget_show(scale); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 bbox = gtk_hbutton_box_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 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
|
107 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
|
108 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
|
109 bbox, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 button = gtk_button_new_with_label(_("Ok")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
114 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 GTK_SIGNAL_FUNC(conf_ok_cb), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 >K_ADJUSTMENT(adjustment)->value); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 gtk_widget_grab_default(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 button = gtk_button_new_with_label(_("Cancel")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
123 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 GTK_SIGNAL_FUNC(conf_cancel_cb), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 button = gtk_button_new_with_label(_("Apply")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
130 g_signal_connect_swapped(GTK_OBJECT(button), "clicked", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 GTK_SIGNAL_FUNC(conf_apply_cb), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 >K_ADJUSTMENT(adjustment)->value); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 gtk_widget_show(button); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 gtk_widget_show(bbox); |
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(conf_dialog); |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 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
|
141 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 gint i; |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
143 gdouble tmp; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
144 static gdouble prev[2], diff[2]; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
145 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 gint16 *data = (gint16 *)*d; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
147 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 if (!(afmt == FMT_S16_NE || |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 (afmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
150 (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
|
151 return length; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 for (i = 0; i < length / 2; i += 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 { |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
155 diff[0] = data[i] - prev[0]; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
156 diff[1] = data[i + 1] - prev[1]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
158 tmp = data[i] + (diff[0] * value); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 if (tmp < -32768) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 tmp = -32768; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 if (tmp > 32767) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 tmp = 32767; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 data[i] = tmp; |
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 tmp = data[i + 1] + (diff[1] * value); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 if (tmp < -32768) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 tmp = -32768; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 if (tmp > 32767) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 tmp = 32767; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 data[i + 1] = tmp; |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
171 |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
172 prev[0] = data[i]; |
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
173 prev[1] = data[i + 1]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 } |
2518
eef3a506a2b8
Add crystalizer plugin.
William Pitcock <nenolod@atheme.org>
parents:
2124
diff
changeset
|
175 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 return length; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 } |