|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.CDQ
public class CDQ
the default continuous double queue. Add pairs of size and value.
Remove any size (range 0 (exclusive) to total size (inclusive))
and get a weighted sum of the values at that range.
This is useful for asynchronous floating-point streams that must communicate, like microphone and speaker buffers.
WARNING: this class is implemented as a linked list of pairs of double, so its inefficient.
It would be much faster to use 1 double[] array with 2 indexs per sample.
But the linked list should be fast enough for audio.
Nested Class Summary | |
---|---|
static class |
CDQ.Doubles
its inefficient (but easy to code) to use a class for each data point instead of 2 array indexs |
Constructor Summary | |
---|---|
CDQ()
|
Method Summary | |
---|---|
void |
cdqAdd(double value,
double size)
increases cdqSize() |
double |
cdqRemove(double size)
size <= cdqSize(). |
double |
cdqSize()
how many doubles in this micQueue |
static void |
main(java.lang.String[] s)
tests this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CDQ()
Method Detail |
---|
public void cdqAdd(double value, double size)
ContinuousDQueue
cdqAdd
in interface ContinuousDQueue
public double cdqRemove(double size)
ContinuousDQueue
cdqRemove
in interface ContinuousDQueue
public double cdqSize()
ContinuousDQueue
cdqSize
in interface ContinuousDQueue
public static void main(java.lang.String[] s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |