CiCueTea v0.0.1
Loading...
Searching...
No Matches
Slicer.hpp
Go to the documentation of this file.
1//
2// Slicer.hpp
3// CQTDSP
4//
5// Created by Juan Sierra on 3/23/25.
6//
7
8#pragma once
9
17
18#include <Eigen/Core>
19
20namespace jsa::cicuetea {
21
31class Slicer
32{
33 public:
45 Slicer(Eigen::Index newBlockSize, Eigen::Index newHopSize);
46
52 void pushSample(double sample);
53
59 bool hasBlock();
60
68 Eigen::Map<const Eigen::ArrayXd> getBlock();
69
75 Eigen::Index getBlockSize() const { return blockSize; }
76
82 Eigen::Index getOverlapSize() const { return overlapSize; }
83
89 Eigen::Index getHopSize() const { return hopSize; }
90
96 Eigen::Index getBufferSize() const { return bufferSize; }
97
98 private:
99 Eigen::ArrayXd buffer;
100 Eigen::Index bufferSize;
101 Eigen::Index blockSize;
102 Eigen::Index overlapSize;
103 Eigen::Index hopSize;
104 size_t wp = 0;
105 size_t rp = 0;
106};
107
108} // namespace jsa::cicuetea
Eigen::Index getBlockSize() const
Gets the current block size.
Definition Slicer.hpp:75
bool hasBlock()
Checks if a complete block is available for retrieval.
Definition Slicer.cpp:38
Eigen::Index getBufferSize() const
Gets the size of the internal buffer.
Definition Slicer.hpp:96
void pushSample(double sample)
Pushes a single sample into the internal buffer.
Definition Slicer.cpp:30
Eigen::Index getOverlapSize() const
Gets the current overlap size.
Definition Slicer.hpp:82
Slicer(Eigen::Index newBlockSize, Eigen::Index newHopSize)
Slicer constructor that sets the block size and hop size for slicing.
Definition Slicer.cpp:18
Eigen::Map< const Eigen::ArrayXd > getBlock()
Retrieves the next available block as a read-only Eigen::ArrayXd.
Definition Slicer.cpp:44
Eigen::Index getHopSize() const
Gets the current hop size.
Definition Slicer.hpp:89