| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Synthesizer.LLVM.CausalParameterized.RingBuffer
Documentation
track :: (Storable a, MakeValueTuple a, ValueTuple a ~ al, C al) => T p a -> T p Int -> T p al (T al) Source
track initial time tracks the last time sample values
including the current one.
The values before the actual input data are filled with initial.
The values can be accessed using index with indices
ranging from 0 to time.
The time parameter must be non-negative.
The initial value is also needed for determining the ring buffer element type.
trackConst :: C al => al -> T p Int -> T p al (T al) Source
Initialize with zero without the need of a Haskell zero value.
We cannot get rid of the type a so easily,
because we need its Storable instance
for allocating the buffer on the Haskell side.
index :: C a => Value Word32 -> T a -> CodeGenFunction r a Source
This function does not check for range violations.
If the ring buffer was generated by track initial time,
then the minimum index is zero and the maximum index is time.
Index zero refers to the current sample
and index time refers to the oldest one.
oldest :: C a => T a -> CodeGenFunction r a Source
Fetch the oldest value in the ring buffer.
For the result of track initial time
this is equivalent to index time but more efficient.