parent
164986fc4a
commit
4983644314
@ -0,0 +1,20 @@ |
|||||||
|
#include "AudioMathAdd_F32.h" |
||||||
|
|
||||||
|
void AudioMathAdd_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) { |
||||||
|
AudioStream_F32::release(block); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
arm_add_f32(block->data, in->data, block->data, block->length); |
||||||
|
AudioStream_F32::release(in); |
||||||
|
|
||||||
|
AudioStream_F32::transmit(block); |
||||||
|
AudioStream_F32::release(block); |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/*
|
||||||
|
* AudioMathAdd_F32 |
||||||
|
*
|
||||||
|
* Created: Chip Audette, Open Audio, July 2018 |
||||||
|
* Purpose: Add together two channels (vectors) of audio data on a point-by-point basis |
||||||
|
* (like AudioMathMutiply, but addition). Assumes floating-point data. |
||||||
|
*
|
||||||
|
* This processes a single stream fo audio data (ie, it is mono)
|
||||||
|
*
|
||||||
|
* MIT License. use at your own risk. |
||||||
|
*/ |
||||||
|
#ifndef _AudioMathAdd_F32_H |
||||||
|
#define _AudioMathAdd_F32_H |
||||||
|
|
||||||
|
#include <arm_math.h> |
||||||
|
#include "AudioStream_F32.h" |
||||||
|
|
||||||
|
class AudioMathAdd_F32 : public AudioStream_F32 |
||||||
|
{ |
||||||
|
//GUI: inputs:2, outputs:1 //this line used for automatic generation of GUI node
|
||||||
|
public: |
||||||
|
AudioMathAdd_F32(void) : AudioStream_F32(2, inputQueueArray_f32) {}; |
||||||
|
AudioMathAdd_F32(const AudioSettings_F32 &settings) : AudioStream_F32(2, inputQueueArray_f32) {}; |
||||||
|
|
||||||
|
void update(void); |
||||||
|
|
||||||
|
private: |
||||||
|
audio_block_f32_t *inputQueueArray_f32[2]; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,20 @@ |
|||||||
|
#include "AudioMathMultiply_F32.h" |
||||||
|
|
||||||
|
void AudioMathMultiply_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) { |
||||||
|
AudioStream_F32::release(block); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
arm_mult_f32(block->data, in->data, block->data, block->length); |
||||||
|
AudioStream_F32::release(in); |
||||||
|
|
||||||
|
AudioStream_F32::transmit(block); |
||||||
|
AudioStream_F32::release(block); |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/*
|
||||||
|
* AudioMathMultiply |
||||||
|
*
|
||||||
|
* 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 AUDIOMATHMULTIPLYF32_H |
||||||
|
#define AUDIOMATHMULTIPLYF32_H |
||||||
|
|
||||||
|
#include <arm_math.h> |
||||||
|
#include "AudioStream_F32.h" |
||||||
|
|
||||||
|
class AudioMathMultiply_F32 : public AudioStream_F32 |
||||||
|
{ |
||||||
|
//GUI: inputs:2, outputs:1 //this line used for automatic generation of GUI node
|
||||||
|
public: |
||||||
|
AudioMathMultiply_F32(void) : AudioStream_F32(2, inputQueueArray_f32) {}; |
||||||
|
AudioMathMultiply_F32(const AudioSettings_F32 &settings) : AudioStream_F32(2, inputQueueArray_f32) {}; |
||||||
|
|
||||||
|
void update(void); |
||||||
|
|
||||||
|
private: |
||||||
|
audio_block_f32_t *inputQueueArray_f32[2]; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,14 @@ |
|||||||
|
#include "AudioMathOffset_F32.h" |
||||||
|
|
||||||
|
void AudioMathOffset_F32::update(void) { |
||||||
|
audio_block_f32_t *block; |
||||||
|
|
||||||
|
block = AudioStream_F32::receiveWritable_f32(0); |
||||||
|
if (!block) return; |
||||||
|
|
||||||
|
//use the ARM-optimized routine to add the offset
|
||||||
|
arm_offset_f32(block->data, offset, block->data, block->length); |
||||||
|
|
||||||
|
AudioStream_F32::transmit(block); |
||||||
|
AudioStream_F32::release(block); |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
/*
|
||||||
|
* AudioMathOffset_F32 |
||||||
|
*
|
||||||
|
* Created: Chip Audette, Open Audio, June 2018 |
||||||
|
* Purpose: Add a constant DC value to all audio samples |
||||||
|
* Assumes floating-point data. |
||||||
|
*
|
||||||
|
* This processes a single stream fo audio data (ie, it is mono)
|
||||||
|
*
|
||||||
|
* MIT License. use at your own risk. |
||||||
|
*/ |
||||||
|
#ifndef AudioMathOffset_F32_H |
||||||
|
#define AudioMathOffset_F32_H |
||||||
|
|
||||||
|
#include <arm_math.h> |
||||||
|
#include "AudioStream_F32.h" |
||||||
|
|
||||||
|
class AudioMathOffset_F32 : public AudioStream_F32 |
||||||
|
{ |
||||||
|
//GUI: inputs:1, outputs:1 //this line used for automatic generation of GUI node
|
||||||
|
public: |
||||||
|
AudioMathOffset_F32(void) : AudioStream_F32(1, inputQueueArray_f32) {}; |
||||||
|
AudioMathOffset_F32(const AudioSettings_F32 &settings) : AudioStream_F32(1, inputQueueArray_f32) {}; |
||||||
|
|
||||||
|
void update(void); |
||||||
|
float setOffset(float _offset) { return offset = _offset;} |
||||||
|
float getOffset(void) { return offset; } |
||||||
|
private: |
||||||
|
audio_block_f32_t *inputQueueArray_f32[1]; |
||||||
|
float32_t offset = 0.0f; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,14 @@ |
|||||||
|
#include "AudioMathScale_F32.h" |
||||||
|
|
||||||
|
void AudioMathScale_F32::update(void) { |
||||||
|
audio_block_f32_t *block; |
||||||
|
|
||||||
|
block = AudioStream_F32::receiveWritable_f32(0); |
||||||
|
if (!block) return; |
||||||
|
|
||||||
|
//use the ARM-optimized routine to add the offset
|
||||||
|
arm_scale_f32(block->data, scale, block->data, block->length); |
||||||
|
|
||||||
|
AudioStream_F32::transmit(block); |
||||||
|
AudioStream_F32::release(block); |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
/*
|
||||||
|
* AudioMathScale_F32 |
||||||
|
*
|
||||||
|
* Created: Chip Audette, Open Audio, June 2018 |
||||||
|
* Purpose: Multiply all audio samples by a single value (not vector) |
||||||
|
* Assumes floating-point data. |
||||||
|
*
|
||||||
|
* This processes a single stream fo audio data (ie, it is mono)
|
||||||
|
*
|
||||||
|
* MIT License. use at your own risk. |
||||||
|
*/ |
||||||
|
#ifndef AudioMathScale_F32_H |
||||||
|
#define AudioMathScale_F32_H |
||||||
|
|
||||||
|
#include <arm_math.h> |
||||||
|
#include "AudioStream_F32.h" |
||||||
|
|
||||||
|
class AudioMathScale_F32 : public AudioStream_F32 |
||||||
|
{ |
||||||
|
//GUI: inputs:1, outputs:1 //this line used for automatic generation of GUI node
|
||||||
|
public: |
||||||
|
AudioMathScale_F32(void) : AudioStream_F32(1, inputQueueArray_f32) {}; |
||||||
|
AudioMathScale_F32(const AudioSettings_F32 &settings) : AudioStream_F32(1, inputQueueArray_f32) {}; |
||||||
|
|
||||||
|
void update(void); |
||||||
|
float setScale(float _scale) { return scale = _scale;} |
||||||
|
float getScale(void) { return scale; } |
||||||
|
private: |
||||||
|
audio_block_f32_t *inputQueueArray_f32[1]; |
||||||
|
float32_t scale = 0.0f; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
Loading…
Reference in new issue