From a764e59e1d3a8e330f0d484fdb26b35ca3f0b2e4 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 22 Mar 2008 02:15:12 +0000 Subject: bringing pdj-0.8.3 into the main branch svn path=/trunk/externals/loaders/pdj/; revision=9621 --- src/java/com/cycling74/msp/MSPSignal.java | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/java/com/cycling74/msp/MSPSignal.java (limited to 'src/java/com/cycling74/msp/MSPSignal.java') diff --git a/src/java/com/cycling74/msp/MSPSignal.java b/src/java/com/cycling74/msp/MSPSignal.java new file mode 100644 index 0000000..0fb9635 --- /dev/null +++ b/src/java/com/cycling74/msp/MSPSignal.java @@ -0,0 +1,70 @@ +package com.cycling74.msp; + +/** + * Signals representation; signals inlets will copy signal data to this + * object. + */ +public class MSPSignal { + + /** + * Tells the number of time this signal is connected. This is always + * 1 in pure-data. + */ + public short cc = 1; + + /** + * Tells if this signal is connected. This is always true in pure-data. + */ + public boolean connected = true; + + /** + * Number of sample in vector. + */ + public int n; + + /** + * The sampling rate. + */ + public double sr; + + /** + * The current sample data. + */ + public float[] vec; + + MSPSignal() { + } + + public MSPSignal(float vec[], double sr, int n, short cc) { + this.vec = vec; + this.sr = sr; + this.n = n; + this.cc = cc; + } + + /** + * Returns a copy of this signal but with the same sample buffer. + * @return the new signal with the same buffer + */ + public MSPSignal alias() { + return new MSPSignal(vec, sr, n, cc); + } + + /** + * Returns the a duplicated signal object. Also copies the array. + * @return the new signal with the same value + */ + public MSPSignal dup() { + return new MSPSignal((float [])vec.clone(), sr, n, cc); + } + + /** + * Returns the a duplicated signal object, but the sample vector is + * re-initialized. + * @return the new signal with empty value (silence) + */ + public MSPSignal dupclean() { + return new MSPSignal(new float [vec.length], sr, n, cc); + } + +} -- cgit v1.2.1