aboutsummaryrefslogtreecommitdiff
path: root/src/quantize~.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/quantize~.c')
-rw-r--r--src/quantize~.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/quantize~.c b/src/quantize~.c
index b561243..64bc317 100644
--- a/src/quantize~.c
+++ b/src/quantize~.c
@@ -1,4 +1,4 @@
-/*
+/*
* quantize~: quantize a signal to various bit-depths
*
* (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem)
@@ -7,12 +7,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -30,8 +30,7 @@
static t_class *quantize_class;
-typedef struct _quantize
-{
+typedef struct _quantize {
t_object x_obj;
t_sample quantiz, dequantiz;
} t_quantize;
@@ -64,8 +63,12 @@ static t_int *quantize_perform(t_int *w)
t_sample quantiz = x->quantiz, dequantiz = x->dequantiz;
if (quantiz)
- while (n--) *out++ = dequantiz*(int)(quantiz**in++);
- else while (n--) *out++ = *in++;
+ while (n--) {
+ *out++ = dequantiz*(int)(quantiz**in++);
+ }
+ else while (n--) {
+ *out++ = *in++;
+ }
return (w+5);
}
@@ -92,23 +95,30 @@ static void *quantize_new(t_floatarg f)
{
t_quantize *x = (t_quantize *)pd_new(quantize_class);
outlet_new(&x->x_obj, gensym("signal"));
- if (f) quantize_float(x, f);
- else quantize_16bit(x);
-
+ if (f) {
+ quantize_float(x, f);
+ } else {
+ quantize_16bit(x);
+ }
+
return (x);
}
void quantize_tilde_setup(void)
{
- quantize_class = class_new(gensym("quantize~"), (t_newmethod)quantize_new, 0,
- sizeof(t_quantize), 0, A_DEFFLOAT, 0);
+ quantize_class = class_new(gensym("quantize~"), (t_newmethod)quantize_new,
+ 0,
+ sizeof(t_quantize), 0, A_DEFFLOAT, 0);
class_addmethod(quantize_class, nullfn, gensym("signal"), 0);
class_addmethod(quantize_class, (t_method)quantize_dsp, gensym("dsp"), 0);
class_addfloat(quantize_class, quantize_float);
- class_addmethod(quantize_class, (t_method)quantize_8bit, gensym("8bit"), 0);
- class_addmethod(quantize_class, (t_method)quantize_16bit, gensym("16bit"), 0);
-
- class_addmethod(quantize_class, (t_method)quantize_tilde_helper, gensym("help"), 0);
+ class_addmethod(quantize_class, (t_method)quantize_8bit, gensym("8bit"),
+ 0);
+ class_addmethod(quantize_class, (t_method)quantize_16bit, gensym("16bit"),
+ 0);
+
+ class_addmethod(quantize_class, (t_method)quantize_tilde_helper,
+ gensym("help"), 0);
zexy_register("quantize~");
}