AudioStream_F32: partly enable diff block size

pull/5/head
Chip Audette 8 years ago
parent aae97dc956
commit df7988129c
  1. 10
      AudioStream_F32.cpp
  2. 12
      AudioStream_F32.h

@ -1,5 +1,5 @@
#include <AudioStream_F32.h>
#include "AudioStream_F32.h"
audio_block_f32_t * AudioStream_F32::f32_memory_pool;
uint32_t AudioStream_F32::f32_memory_pool_available_mask[6];
@ -97,14 +97,20 @@ void AudioStream_F32::release(audio_block_f32_t *block)
// and then release it once after all transmit calls.
void AudioStream_F32::transmit(audio_block_f32_t *block, unsigned char index)
{
//Serial.print("AudioStream_F32: transmit(). start...index = ");Serial.println(index);
for (AudioConnection_F32 *c = destination_list_f32; c != NULL; c = c->next_dest) {
//Serial.print(" : loop1, c->src_index = ");Serial.println(c->src_index);
if (c->src_index == index) {
//Serial.println(" : if1");
if (c->dst.inputQueue_f32[c->dest_index] == NULL) {
//Serial.println(" : if2");
c->dst.inputQueue_f32[c->dest_index] = block;
block->ref_count++;
//Serial.print(" : block->ref_count = "); Serial.println(block->ref_count);
}
}
}
}
//Serial.println("AudioStream_F32: transmit(). finished.");
}
// Receive block from an input. The block's data

@ -26,8 +26,12 @@ typedef struct audio_block_f32_struct {
unsigned char ref_count;
unsigned char memory_pool_index;
unsigned char reserved1;
unsigned char reserved2;
float data[AUDIO_BLOCK_SAMPLES]; // AUDIO_BLOCK_SAMPLES is 128, from AudioStream.h
unsigned char reserved2;
#if AUDIO_BLOCK_SAMPLES < 128
float32_t data[128]; //limit array size to be no smaller than 128. unstable otherwise?
#else
float32_t data[AUDIO_BLOCK_SAMPLES]; // AUDIO_BLOCK_SAMPLES is 128, from AudioStream.h
#endif
const int length = AUDIO_BLOCK_SAMPLES; // AUDIO_BLOCK_SAMPLES is 128, from AudioStream.h
const float fs_Hz = AUDIO_SAMPLE_RATE; // AUDIO_SAMPLE_RATE is 44117.64706 from AudioStream.h
} audio_block_f32_t;
@ -56,8 +60,8 @@ class AudioConnection_F32
};
#define AudioMemory_F32(num) ({ \
static audio_block_f32_t data[num]; \
AudioStream_F32::initialize_f32_memory(data, num); \
static audio_block_f32_t data_f32[num]; \
AudioStream_F32::initialize_f32_memory(data_f32, num); \
})

Loading…
Cancel
Save