mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 04:20:47 +00:00
Merge pull request #1825 from HiFiPhile/mic_test
Minor audio_test example fix.
This commit is contained in:
commit
3342635237
@ -71,7 +71,7 @@ audio_control_range_2_n_t(1) volumeRng[CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX+1];
|
|||||||
audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state
|
audio_control_range_4_n_t(1) sampleFreqRng; // Sample frequency range state
|
||||||
|
|
||||||
// Audio test data
|
// Audio test data
|
||||||
uint16_t test_buffer_audio[CFG_TUD_AUDIO_EP_SZ_IN/2];
|
uint16_t test_buffer_audio[(CFG_TUD_AUDIO_EP_SZ_IN - 2) / 2];
|
||||||
uint16_t startVal = 0;
|
uint16_t startVal = 0;
|
||||||
|
|
||||||
void led_blinking_task(void);
|
void led_blinking_task(void);
|
||||||
@ -400,7 +400,7 @@ bool tud_audio_tx_done_pre_load_cb(uint8_t rhport, uint8_t itf, uint8_t ep_in, u
|
|||||||
(void) ep_in;
|
(void) ep_in;
|
||||||
(void) cur_alt_setting;
|
(void) cur_alt_setting;
|
||||||
|
|
||||||
tud_audio_write ((uint8_t *)test_buffer_audio, CFG_TUD_AUDIO_EP_SZ_IN);
|
tud_audio_write ((uint8_t *)test_buffer_audio, CFG_TUD_AUDIO_EP_SZ_IN - 2);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ bool tud_audio_tx_done_post_load_cb(uint8_t rhport, uint16_t n_bytes_copied, uin
|
|||||||
(void) ep_in;
|
(void) ep_in;
|
||||||
(void) cur_alt_setting;
|
(void) cur_alt_setting;
|
||||||
|
|
||||||
for (size_t cnt = 0; cnt < CFG_TUD_AUDIO_EP_SZ_IN/2; cnt++)
|
for (size_t cnt = 0; cnt < (CFG_TUD_AUDIO_EP_SZ_IN - 2) / 2; cnt++)
|
||||||
{
|
{
|
||||||
test_buffer_audio[cnt] = startVal++;
|
test_buffer_audio[cnt] = startVal++;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import sounddevice as sd
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import platform
|
import platform
|
||||||
|
import csv
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
@ -32,3 +33,6 @@ if __name__ == '__main__':
|
|||||||
plt.title('MicNode')
|
plt.title('MicNode')
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
samples = np.array(myrecording)
|
||||||
|
np.savetxt('Output.csv', samples, delimiter=",", fmt='%s')
|
||||||
|
|
@ -114,7 +114,7 @@ extern "C" {
|
|||||||
#define CFG_TUD_AUDIO_ENABLE_EP_IN 1
|
#define CFG_TUD_AUDIO_ENABLE_EP_IN 1
|
||||||
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX 2 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below
|
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX 2 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below
|
||||||
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below - be aware: for different number of channels you need another descriptor!
|
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below - be aware: for different number of channels you need another descriptor!
|
||||||
#define CFG_TUD_AUDIO_EP_SZ_IN 48 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 48 Samples (48 kHz) x 2 Bytes/Sample x 1 Channel
|
#define CFG_TUD_AUDIO_EP_SZ_IN (48 + 1) * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 48 Samples (48 kHz) x 2 Bytes/Sample x CFG_TUD_AUDIO_N_CHANNELS_TX Channels - One extra sample is needed for asynchronous transfer adjustment, see feedback EP
|
||||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN // Maximum EP IN size for all AS alternate settings used
|
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN // Maximum EP IN size for all AS alternate settings used
|
||||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN + 1
|
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN + 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user