A Hopf, Skip and a Jump
|
Specialisation of the slidingbuffer::SegmentProducer class to create blocks of DetectorBank analysis channels and store them in a detectorcache::Segment. More...
#include <detectorcache.h>
Public Member Functions | |
Producer (DetectorBank &db, std::istream *is=nullptr) | |
Construct a Producer given a DetectorBank. More... | |
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 its construction. More... | |
virtual bool | more (void) |
Establish wheter there is further data to be read from the DetectorBank associated with this cache. More... | |
void | set_num_samps (std::size_t n) |
Set the block length (in samples) of each audio block which the Producer must generate. More... | |
void | set_start_chan (std::size_t c) |
Set the startChan for getZ. More... | |
parameter_t | getSR (void) const |
Get the sample rate associated with this DetectorBank. More... | |
std::size_t | getChans (void) |
Enquire the number of channles for which data is produced. More... | |
std::size_t | getBuflen (void) |
Enquire the length of the data stored in the Producer's associated DetectorBank. More... | |
parameter_t | getW (std::size_t ch) |
Find the frequency of a given channel's detector. More... | |
parameter_t | getFreqIn (std::size_t ch) |
Get the input frequency of a given channel's detector. More... | |
Public Member Functions inherited from slidingbuffer::SegmentProducer< result_t *> | |
virtual | ~SegmentProducer () |
Destructor: to be provided by derived class. | |
Protected Attributes | |
DetectorBank & | db |
The DetectorBank which produces the results. | |
std::size_t | seg_len |
Block-length (number of audio samples) to request on each call to generate() | |
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. | |
Specialisation of the slidingbuffer::SegmentProducer class to create blocks of DetectorBank analysis channels and store them in a detectorcache::Segment.
The 2D nature of the storage means that the specialisation of SlidingBuffer is somewhat non-trivial. Refer to the detailed description of detectorcache::DetectorCache for a full explaination of the data structures involved.
Definition at line 19 of file detectorcache.h.
|
inline |
Construct a Producer given a DetectorBank.
Since the Producer's final operating parameters (specifically, the number of time-samples per segment) is unknown until the associated DetectorCache is constructed, and because this must happen after the Producer's construction, no memory allocation can be usefully performed here.
The Producer can be operated in pre-buffered or stream mode. In the former, the DetectorBank will have been initialised with an array of audio samples, and each call to Producer::generate will progress through the DetectorBuffer's input buffer as normal. If an istream is supplied when the producer is constructed, every time Producer::generate is called, Producer::seg_len samples are read from the associated audio istream, used to set the DetectorBank's input buffer from which the analysis is generated
db | The previously created detetorbank which will perform the analysis |
is | If stream mode is required, a pointer to the input stream from which samples (of inputSample_t) shall be read |
Definition at line 47 of file detectorcache.h.
|
virtual |
Generate a DetectorBank result block of the length specified by our associated DetectorCache after its construction.
seg | Pointers to results for each channel to be populated by the Producer |
idx | Sequence key for the first channel in this block. Refer to the extended documentation for detectorcache::DetectorCache for more details |
size | Number of channels for which data is held (not used: this is read from the DetectorBank for security reasons). |
Implements slidingbuffer::SegmentProducer< result_t *>.
|
inline |
Enquire the length of the data stored in the Producer's associated DetectorBank.
Definition at line 106 of file detectorcache.h.
|
inline |
Enquire the number of channles for which data is produced.
Definition at line 99 of file detectorcache.h.
|
inline |
Get the input frequency of a given channel's detector.
Returns 0 if the channel number is invalid.
ch | Channel number |
Definition at line 121 of file detectorcache.h.
|
inline |
Get the sample rate associated with this DetectorBank.
Definition at line 93 of file detectorcache.h.
|
inline |
Find the frequency of a given channel's detector.
If the signal has been modulated and/or normalised, the adjusted frequency will be returned. Returns 0 if the channel number is invalid.
ch | Channel number |
Definition at line 114 of file detectorcache.h.
|
inlinevirtual |
Establish wheter there is further data to be read from the DetectorBank associated with this cache.
true
if more data is available, otherwise false
. Implements slidingbuffer::SegmentProducer< result_t *>.
Definition at line 73 of file detectorcache.h.
|
inline |
Set the block length (in samples) of each audio block which the Producer must generate.
This is unknown until the Producer is constructed (which has to be before the DetectorCache object which determines this parameter).
n | Number of audio samples to be generated for each channel |
Definition at line 82 of file detectorcache.h.
|
inline |
Set the startChan for getZ.
c | Channel from which to calculate abs(z) values |
Definition at line 86 of file detectorcache.h.