Skip to content

Commit c5bfda7

Browse files
committed
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.
1 parent 0a2383f commit c5bfda7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apps/auracast_usb/src/audio_usb.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ static int16_t samples_read[AUDIO_BUF_SIZE];
6060
/* 155 is maximum value Octets Per Codec Frame described in Table 3.5 of BAP specification */
6161
static float samples_read_float[AUDIO_BUF_SIZE];
6262
static float resampled_float[AUDIO_BUF_SIZE];
63-
double resampler_in_rate = AUDIO_PCM_SAMPLE_RATE;
64-
double resampler_out_rate = LC3_SAMPLING_FREQ;
65-
double resampler_ratio;
63+
float resampler_in_rate = AUDIO_PCM_SAMPLE_RATE;
64+
float resampler_out_rate = LC3_SAMPLING_FREQ;
65+
float resampler_ratio;
6666
SRC_STATE *resampler_state;
6767
static struct ble_gap_event_listener feedback_listener;
6868
#endif
@@ -74,7 +74,7 @@ static int
7474
ble_hs_gap_event_handler(struct ble_gap_event *event, void *arg)
7575
{
7676
struct ble_hci_vs_subev_iso_hci_feedback *feedback_pkt;
77-
double adjust = 0;
77+
float adjust = 0;
7878

7979
if (event->type == BLE_GAP_EVENT_UNHANDLED_HCI_EVENT &&
8080
event->unhandled_hci.is_le_meta == false &&
@@ -266,7 +266,7 @@ audio_usb_init(void)
266266
int rc;
267267

268268
assert(resampler_state == NULL);
269-
resampler_state = src_new(SRC_ZERO_ORDER_HOLD, AUDIO_CHANNELS, NULL);
269+
resampler_state = src_new(SRC_SINC_FASTEST, AUDIO_CHANNELS, NULL);
270270
assert(resampler_state != NULL);
271271

272272
rc = ble_gap_event_listener_register(&feedback_listener,

0 commit comments

Comments
 (0)