1 #ifndef _DETECTORCACHE_H_ 2 #define _DETECTORCACHE_H_ 4 #include "slidingbuffer.h" 5 #include "detectorbank.h" 48 std::istream* is =
nullptr)
64 virtual std::size_t
generate(result_t* seg[],
65 const std::size_t idx,
66 const std::size_t size);
156 Segment(
const std::size_t size,
const std::size_t origin,
170 detectorcache::Segment,
171 detectorcache::Producer>
183 const std::size_t num_segs,
186 const std::size_t num_chans);
195 const std::size_t num_segs,
196 const std::size_t seg_len,
197 const std::size_t start_chan = 0)
224 result_t getResultItem(
long int ch,
long int n);
249 std::size_t getPreviousResults(
const std::size_t chan,
250 const std::size_t currentSample,
251 result_t* samples, std::size_t numSamples);
265 const std::size_t chans;
std::size_t end(void)
Get the total number of samples the cache can return.
Producer & p
This Producer for this DetectorCache.
Producer(DetectorBank &db, std::istream *is=nullptr)
Construct a Producer given a DetectorBank.
const std::size_t seg_len
Number of audio samples per segment.
A Segment is an aggregation of base data with a SlidingBuffer.
void set_start_chan(std::size_t c)
Set the startChan for getZ.
std::size_t getChans(void) const
Return the number of detectors currently maintained by this DetectorBank.
parameter_t getFreqIn(std::size_t ch) const
Find the input frequency of a given channel's detector.
Use multiple detectors to find note onsets at given frequencies (with multithreading).
std::size_t seg_len
Block-length (number of audio samples) to request on each call to generate()
Cache results from a detectorbank.
virtual bool more(void)
Establish wheter there is further data to be read from the DetectorBank associated with this cache...
Specialisation of the slidingbuffer::SegmentProducer class to create blocks of DetectorBank analysis ...
parameter_t getSR(void) const
Get the sample rate associated with this DetectorBank.
std::size_t getChans(void)
Get the number of channels in the cache.
std::istream * audiostream
In stream mode (datastream non-null), the istream from which inputSample_t samples are to be read...
std::size_t start_chan
Channel in DetectorBank at which to start.
parameter_t getW(std::size_t ch)
Find the frequency of a given channel's detector.
std::size_t getBuflen(void) const
Find out the total number of samples currently available.
DetectorCache(detectorcache::Producer &p, const std::size_t num_segs, const std::size_t seg_len, const std::size_t start_chan=0)
Construct a DetectorCache with default start and size.
const std::size_t start_chan
Channel in DetectorBank at which to start.
std::size_t getChans(void)
Enquire the number of channles for which data is produced.
parameter_t getSR(void) const
Get the sample rate of the associtaed DetectorBank.
virtual std::size_t generate(result_t *seg[], const std::size_t idx, const std::size_t size)
Generate a DetectorBank result block of the length specified by our associated DetectorCache after it...
The producer class enabling a slidingbuffer::SlidingBuffer to be deployed as a cache for the two-dime...
parameter_t getW(std::size_t ch) const
Find the frequency of a given channel's detector.
Template of a pure virtual class which populates a Segment with entities.
DetectorBank & db
The DetectorBank which produces the results.
SlidingBuffer is class template which can be used when reading a data stream to provide access to the...
std::size_t getBuflen(void)
Enquire the length of the data stored in the Producer's associated DetectorBank.
parameter_t getSR(void) const
Get the sample rate associated with this DetectorBank.
void set_num_samps(std::size_t n)
Set the block length (in samples) of each audio block which the Producer must generate.
std::size_t tell(void) const
Get the index of current input sample.
parameter_t getFreqIn(std::size_t ch)
Get the input frequency of a given channel's detector.