Open LIFsCode opened 4 months ago
@OOHehir I would add a standardized interface class for exchanging data with the I2S Sampler and WavWriter & EdgeImpulse to get rid of the dependencies between them.
My idea was to use something similar to inferenct_t with additional notify method, e.g.
class I2S_DataBuffer {
signed short *buffers[2];
unsigned char buf_select;
unsigned char buf_ready;
unsigned int buf_count;
unsigned int n_samples;
unsigned int subsampling_rate;
/**
* @brief Ideally this bool would be encapsulated in the EdgeImpulse class
* but issues with conflicting paths
*/
bool status_running;
void notifyConsumerTask() {
if (status_running && mTaskHandle != NULL) {
buf_ready = 1;
xTaskNotify(mTaskHandle, (0), eNoAction);
}
}
I2S_DataBuffer(TaskHandle_t& taskHandle) : mTaskHandle(taskHandle)
{}
private:
TaskHandle_t& mTaskHandle;
};
With that the I2S Sampler only gets a I2S_DataBuffer registered and there would be no separate handling for edgeImpulse buffer and wav buffer.
@OOHehir any thoughts/comments about that?
@LIFsCode Sounds like a good idea. Certainly there's unnecessary differences of the interfaces to the EdgeImpulse & WAVWriter.
Some points that come to mind that may be of importance:
@OOHehir thanks for the hint, I totally forgot about #71 but that should not be too difficult to add this.
The other topic with the different sample rates is more complicated. I added a new issue #91 to keep this discussion isolated