Skip to content

Commit 2ba6ce0

Browse files
author
Main Push Robot
committed
Committing dev changes
1 parent 0f395a6 commit 2ba6ce0

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

src/Soldered-Microphone-Esp.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,6 @@ void Microphone::begin(uint8_t dataPin, uint8_t clockPin, int sampleRate, uint8_
6565

6666
// --------------------- Data Access -------------------------
6767

68-
/**
69-
* @brief Check if audio data is available
70-
*
71-
* @return true if data is available, false otherwise
72-
*/
73-
bool Microphone::available()
74-
{
75-
size_t bytes_read = 0;
76-
uint8_t dummy[4]; // small probe buffer
77-
esp_err_t err = i2s_channel_read(rx_handle, dummy, sizeof(dummy), &bytes_read, 0); // 0 ms timeout
78-
if (err == ESP_OK && bytes_read > 0)
79-
{
80-
// Optionally push back bytes into your own buffer if you want
81-
return true;
82-
}
83-
return false;
84-
}
8568

8669
/**
8770
* @brief Read audio samples in blocking mode

src/Soldered-Microphone-SPK0641HT.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,17 @@ class Microphone
152152
i2s_chan_config_t chan_cfg; ///< I2S channel configuration for ESP32
153153
i2s_chan_handle_t rx_handle = nullptr; ///< I2S channel handle for ESP32
154154
i2s_data_bit_width_t currentBitDepth = I2S_DATA_BIT_WIDTH_16BIT; ///< Current bit depth for ESP32
155+
#else
156+
uint8_t currentBitDepth; ///< Current bit depth (8, 16, 24, or 32 bits)
155157
#endif
156158

157159
int currentSampleRate = 16000; ///< Current sample rate in Hz
158160
float softwareGain = 1.0f; ///< Current software gain (linear scale)
159-
uint8_t currentBitDepth; ///< Current bit depth (8, 16, 24, or 32 bits)
160161

161162
bool hpfEnabled = false; ///< High-pass filter enabled state
162163
float hpfState = 0.0f; ///< High-pass filter internal state
163164
float prevSample = 0.0f; ///< Previous sample for filter processing
164165
};
165166

166167
#endif
167-
#endif
168+

0 commit comments

Comments
 (0)