mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
Minor audio_test example fix.
Fix CFG_TUD_AUDIO_EP_SZ_IN size.
This commit is contained in:
parent
549bee94ad
commit
8a1184e7b3
@ -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 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;
|
||||
|
||||
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) 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;
|
||||
}
|
||||
@ -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) 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++;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import sounddevice as sd
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import platform
|
||||
import csv
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -31,4 +32,7 @@ if __name__ == '__main__':
|
||||
plt.ylabel('Amplitude')
|
||||
plt.title('MicNode')
|
||||
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_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_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_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN + 1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user