commit
2f3cb540ce
@ -0,0 +1,20 @@ |
||||
#include "AudioMultiply_F32.h" |
||||
|
||||
void AudioMultiply_F32::update(void) { |
||||
audio_block_f32_t *block, *in; |
||||
|
||||
block = AudioStream_F32::receiveWritable_f32(0); |
||||
if (!block) return; |
||||
|
||||
in = AudioStream_F32::receiveReadOnly_f32(1); |
||||
if (!in) { |
||||
release(block); |
||||
return; |
||||
} |
||||
|
||||
arm_mult_f32(block->data, in->data, block->data, AUDIO_BLOCK_SAMPLES); |
||||
release(in); |
||||
|
||||
transmit(block); |
||||
release(block); |
||||
} |
@ -0,0 +1,28 @@ |
||||
/*
|
||||
* AudioMultiply |
||||
*
|
||||
* Created: Patrick Radius, December 2016 |
||||
* Purpose: Multiply two channels of audio data. Can be used for example as 'vca' or amplitude modulation. |
||||
* Assumes floating-point data. |
||||
*
|
||||
* This processes a single stream fo audio data (ie, it is mono)
|
||||
*
|
||||
* MIT License. use at your own risk. |
||||
*/ |
||||
#ifndef AUDIOMULTIPLYF32_H |
||||
#define AUDIOMULTIPLYF32_H |
||||
|
||||
#include <arm_math.h> |
||||
#include <AudioStream_F32.h> |
||||
|
||||
class AudioMultiply_F32 : public AudioStream_F32 |
||||
{ |
||||
public: |
||||
AudioMultiply_F32(void) : AudioStream_F32(2, inputQueueArray_f32) {}; |
||||
void update(void); |
||||
|
||||
private: |
||||
audio_block_f32_t *inputQueueArray_f32[2]; |
||||
}; |
||||
|
||||
#endif |
Loading…
Reference in new issue