From df7988129cebd1dc094796a723e55ffce0f56cef Mon Sep 17 00:00:00 2001 From: Chip Audette Date: Mon, 6 Feb 2017 12:55:17 -0500 Subject: [PATCH] AudioStream_F32: partly enable diff block size --- AudioStream_F32.cpp | 10 ++++++++-- AudioStream_F32.h | 12 ++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/AudioStream_F32.cpp b/AudioStream_F32.cpp index edf412d..a04d043 100644 --- a/AudioStream_F32.cpp +++ b/AudioStream_F32.cpp @@ -1,5 +1,5 @@ -#include +#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 diff --git a/AudioStream_F32.h b/AudioStream_F32.h index 58d9c2a..46ace05 100644 --- a/AudioStream_F32.h +++ b/AudioStream_F32.h @@ -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); \ })