check buffer status before writing to decoder . #761
-
I am writing to decoder and it is working perfectly but i want to find first the buffer status then write because i don't want to write fast or overflow the buffer . how to do like that ? EncodedAudioStream decStream(i2s, dec); |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
In your code snipplet there is no buffer that can overflow. |
Beta Was this translation helpful? Give feedback.
-
In general you can call the standard Arduino method availableForWrite(). But in the case of I2S this will always provide DEFAULT_BUFFER_SIZE because there is no functionality to to check the internal buffers! |
Beta Was this translation helpful? Give feedback.
-
Reading from i2s then encodersbc then espnow then decoder SBC and i2s .
this work . I thing it was sink automatically because of i2s at both end
starting and ending .
While reading from SD then espnow and decoder mp3 and then i2s out . this
do not work may be because reading from SD is fast then writing to i2s at
esp32 .
Am I correct ?
I notice a file of approx 700kbytes can send in 2mint via espnow and it
take 6 minutes to play . . . either I need to send slow the data in order
to sync it .. For 700kbyes of mp3 file should send in 6mint and parallel
play in same 6 minutes right ?
…On Sun, Apr 9, 2023, 16:17 Phil Schatzmann ***@***.***> wrote:
Yes, that's because you ignored my advice to write your own container
class!
—
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APTMWZSYYCKHJEN5TU6C45DXAKLDZANCNFSM6AAAAAAWX4622U>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/761/comments/5563697@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Just wanted to let know know that I finally manage to test my custom container class: for details see here. You can write you own additional data in the encoder with writeMeta (const uint8_t *data, size_t len) and retrieve it in the decoder with a callback method. |
Beta Was this translation helpful? Give feedback.
In your code snipplet there is no buffer that can overflow.
I2SStream is using a blocking write!
However it is good practice to check the result of any write() call