This is an automated email from the ASF dual-hosted git repository.

kopyscinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 2c1b130cf0f27f91acd2c0d7f7693a8b8c914dca
Author: Krzysztof Kopyściński <[email protected]>
AuthorDate: Fri Mar 15 08:24:59 2024 +0100

    apps/auracast_usb: use float instead of double
    
    Cortex M-33 FPU doesn't support double precision arithmetic. Use float
    instead of double so the performance can be improved. This allows to use
    better interpolator in resampler.
---
 apps/auracast_usb/src/audio_usb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/apps/auracast_usb/src/audio_usb.c 
b/apps/auracast_usb/src/audio_usb.c
index c63f688ce..d0c5fee41 100644
--- a/apps/auracast_usb/src/audio_usb.c
+++ b/apps/auracast_usb/src/audio_usb.c
@@ -60,9 +60,9 @@ static int16_t samples_read[AUDIO_BUF_SIZE];
 /* 155 is maximum value Octets Per Codec Frame described in Table 3.5 of BAP 
specification */
 static float samples_read_float[AUDIO_BUF_SIZE];
 static float resampled_float[AUDIO_BUF_SIZE];
-double resampler_in_rate = AUDIO_PCM_SAMPLE_RATE;
-double resampler_out_rate = LC3_SAMPLING_FREQ;
-double resampler_ratio;
+float resampler_in_rate = AUDIO_PCM_SAMPLE_RATE;
+float resampler_out_rate = LC3_SAMPLING_FREQ;
+float resampler_ratio;
 SRC_STATE *resampler_state;
 static struct ble_gap_event_listener feedback_listener;
 #endif
@@ -74,7 +74,7 @@ static int
 ble_hs_gap_event_handler(struct ble_gap_event *event, void *arg)
 {
     struct ble_hci_vs_subev_iso_hci_feedback *feedback_pkt;
-    double adjust = 0;
+    float adjust = 0;
 
     if (event->type == BLE_GAP_EVENT_UNHANDLED_HCI_EVENT &&
         event->unhandled_hci.is_le_meta == false &&
@@ -266,7 +266,7 @@ audio_usb_init(void)
     int rc;
 
     assert(resampler_state == NULL);
-    resampler_state = src_new(SRC_ZERO_ORDER_HOLD, AUDIO_CHANNELS, NULL);
+    resampler_state = src_new(SRC_SINC_FASTEST, AUDIO_CHANNELS, NULL);
     assert(resampler_state != NULL);
 
     rc = ble_gap_event_listener_register(&feedback_listener,

Reply via email to