|
|
|
@ -12,10 +12,20 @@ class AudioSourceMicroDexed : public AudioStream, public Dexed { |
|
|
|
|
AudioSourceMicroDexed(int sample_rate) : AudioStream(0, NULL), Dexed(sample_rate) {
|
|
|
|
|
};
|
|
|
|
|
void update(void) { |
|
|
|
|
if (in_update) { |
|
|
|
|
xrun++; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else in_update = true; |
|
|
|
|
|
|
|
|
|
elapsedMicros render_time; |
|
|
|
|
audio_block_t *lblock; |
|
|
|
|
lblock = allocate(); |
|
|
|
|
if (!lblock) return; |
|
|
|
|
if (!lblock) { |
|
|
|
|
in_update = false; |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
getSamples(AUDIO_BLOCK_SAMPLES, lblock->data); |
|
|
|
|
if (render_time > audio_block_time_us) // everything greater 2.9ms is a buffer underrun!
|
|
|
|
|
xrun++; |
|
|
|
@ -24,6 +34,8 @@ class AudioSourceMicroDexed : public AudioStream, public Dexed { |
|
|
|
|
|
|
|
|
|
transmit(lblock, 0); |
|
|
|
|
release(lblock); |
|
|
|
|
in_update = false; |
|
|
|
|
};
|
|
|
|
|
private: |
|
|
|
|
volatile bool in_update = false; |
|
|
|
|
}; |
|
|
|
|