pure-data/src/d_arithmetic.c

/* Copyright (c) 1997-1999 Miller Puckette.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */

/*  arithmetic binops (+, -, *, /).
If no creation argument is given, there are two signal inlets for vector/vector
operation; otherwise it's vector/scalar and the second inlet takes a float
to reset the value.
*/

#include "m_pd.h"
#include <math.h> /* needed for log~ */

/* -------------- convenience routines for multichannel binops ----- */

    /* add a binary operation (such as "+") to the DSP chain, in
    which inputs may be of different sizes (but the output should have
    the same size as the larger input).  Whichever is shorter gets re-used
    as many times as necessary to match the longer one; so one can add signals
    with different numbers of channels. Two functions are passed, a general
    one and another that is called if the block size is a multiple of 8. */

static void dsp_add_multi(t_sample *vec1, int n1, t_sample *vec2,
    int n2, t_sample *outvec, t_perfroutine func, t_perfroutine func8)
{}

    /* more generally, add a binary operation to the DSP chain, that
    may be vector or scalar in either of its two inputs.  The caller
    supplies three versions: vector-vector, vector-scalar, and scalar-vector.
    In the scalar-vector case the "perf" routine gets the vector argument
    first (on the DSP chain) - this way, if the operation is commutative
    the same function can be supplied for perf_vs and perf_vs_reverse.
    If perf_vv8, etc, are nonzero, they are called if the vector size is a
    multiple of 8.  */
static void any_binop_dsp(t_signal **sp,
    t_perfroutine perf_vv, t_perfroutine perf_vv8,
    t_perfroutine perf_vs, t_perfroutine perf_vs8,
    t_perfroutine perf_vs_reverse, t_perfroutine perf_vs8_reverse)
{}

    /* vector-scalar version (as in "+~ 1") - here we don't deal with
    scalar left inputs - the class may not be declared CLASS_NOPROMOTELEFT. */
static void any_binop_scalar_dsp(t_signal **sp, t_sample *g,
    t_perfroutine perf, t_perfroutine perf8)
{}


/* ----------------------------- plus ----------------------------- */
static t_class *plus_class, *scalarplus_class;

t_plus;

t_scalarplus;

static void *plus_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *scalarplus_perform(t_int *w)
{}

t_int *scalarplus_perf8(t_int *w)
{}

static void plus_dsp(t_plus *x, t_signal **sp)
{}

static void scalarplus_dsp(t_scalarplus *x, t_signal **sp)
{}

static void plus_setup(void)
{}

/* ----------------------------- minus ----------------------------- */
static t_class *minus_class, *scalarminus_class;

t_minus;

t_scalarminus;

static void *minus_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *minus_perform(t_int *w)
{}

t_int *minus_perf8(t_int *w)
{}

t_int *scalarminus_perform(t_int *w)
{}

t_int *scalarminus_perf8(t_int *w)
{}

t_int *reversescalarminus_perform(t_int *w)
{}

t_int *reversescalarminus_perf8(t_int *w)
{}

static void minus_dsp(t_minus *x, t_signal **sp)
{}

static void scalarminus_dsp(t_scalarminus *x, t_signal **sp)
{}

static void minus_setup(void)
{}

/* ----------------------------- times ----------------------------- */

static t_class *times_class, *scalartimes_class;

t_times;

t_scalartimes;

static void *times_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *times_perform(t_int *w)
{}

t_int *times_perf8(t_int *w)
{}

t_int *scalartimes_perform(t_int *w)
{}

t_int *scalartimes_perf8(t_int *w)
{}

static void times_dsp(t_times *x, t_signal **sp)
{}

static void scalartimes_dsp(t_scalartimes *x, t_signal **sp)
{}

static void times_setup(void)
{}

/* ----------------------------- over ----------------------------- */
static t_class *over_class, *scalarover_class;

t_over;

t_scalarover;

static void *over_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *over_perform(t_int *w)
{}

t_int *over_perf8(t_int *w)
{}

t_int *scalarover_perform(t_int *w)
{}

t_int *scalarover_perf8(t_int *w)
{}

t_int *reversescalarover_perform(t_int *w)
{}

t_int *reversescalarover_perf8(t_int *w)
{}


static void over_dsp(t_over *x, t_signal **sp)
{}

static void scalarover_dsp(t_scalarover *x, t_signal **sp)
{}

static void over_setup(void)
{}

/* ----------------------------- max ----------------------------- */
static t_class *max_class, *scalarmax_class;

t_max;

t_scalarmax;

static void *max_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *max_perform(t_int *w)
{}

t_int *max_perf8(t_int *w)
{}

t_int *scalarmax_perform(t_int *w)
{}

t_int *scalarmax_perf8(t_int *w)
{}

static void max_dsp(t_max *x, t_signal **sp)
{}

static void scalarmax_dsp(t_scalarmax *x, t_signal **sp)
{}

static void max_setup(void)
{}

/* ----------------------------- min ----------------------------- */
static t_class *min_class, *scalarmin_class;

t_min;

t_scalarmin;

static void *min_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *min_perform(t_int *w)
{}

t_int *min_perf8(t_int *w)
{}

t_int *scalarmin_perform(t_int *w)
{}

t_int *scalarmin_perf8(t_int *w)
{}

static void min_dsp(t_min *x, t_signal **sp)
{}

static void scalarmin_dsp(t_scalarmin *x, t_signal **sp)
{}

static void min_setup(void)
{}

/* ----------------------------- log ----------------------------- */
static t_class *log_tilde_class, *scalarlog_tilde_class;

t_log_tilde;

t_scalarlog_tilde;

static void *log_tilde_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *log_tilde_perform(t_int *w)
{}

t_int *log_tilde_perform_scalar(t_int *w)
{}

    /* nobody sane will ever ask for log(scalar) to a signal base but ok... */
t_int *log_tilde_perform_reversescalar(t_int *w)
{}

static void log_tilde_dsp(t_log_tilde *x, t_signal **sp)
{}

static void scalarlog_tilde_dsp(t_scalarlog_tilde *x, t_signal **sp)
{}

static void log_tilde_setup(void)
{}

/* ----------------------------- pow ----------------------------- */
static t_class *pow_tilde_class, *scalarpow_tilde_class;

t_pow_tilde;

t_scalarpow_tilde;

static void *pow_tilde_new(t_symbol *s, int argc, t_atom *argv)
{}

t_int *pow_tilde_perform(t_int *w)
{}

t_int *pow_tilde_perform_scalar(t_int *w)
{}

t_int *pow_tilde_perform_reversescalar(t_int *w)
{}

static void pow_tilde_dsp(t_pow_tilde *x, t_signal **sp)
{}

static void scalarpow_tilde_dsp(t_scalarpow_tilde *x, t_signal **sp)
{}

static void pow_tilde_setup(void)
{}

/* ----------------------- global setup routine ---------------- */
void d_arithmetic_setup(void)
{}