compression

This commit is contained in:
AlexandreRouma
2022-01-26 13:23:55 +01:00
parent 75da59833a
commit 4c0220a228
9 changed files with 79 additions and 13 deletions

View File

@ -12,11 +12,16 @@ namespace dsp {
public:
DynamicRangeCompressor() {}
DynamicRangeCompressor(stream<complex_t>* in, PCMType pcmType) { init(in, pcmType); }
DynamicRangeCompressor(stream<complex_t>* in, PCMType pcmType) {
init(in, pcmType);
}
void init(stream<complex_t>* in, PCMType pcmType) {
_in = in;
_pcmType = pcmType;
out.setBufferSize((sizeof(dsp::complex_t) * STREAM_BUFFER_SIZE) + 8);
generic_block<DynamicRangeCompressor>::registerInput(_in);
generic_block<DynamicRangeCompressor>::registerOutput(&out);
generic_block<DynamicRangeCompressor>::_block_init = true;

View File

@ -31,6 +31,13 @@ namespace dsp {
volk_free(readBuf);
}
void setBufferSize(int samples) {
volk_free(writeBuf);
volk_free(readBuf);
writeBuf = (T*)volk_malloc(samples * sizeof(T), volk_get_alignment());
readBuf = (T*)volk_malloc(samples * sizeof(T), volk_get_alignment());
}
bool swap(int size) {
{
// Wait to either swap or stop