Skip to content

Commit a94a14a

Browse files
alexsvenrlubos
authored andcommitted
applications: nrf5340_audio: Change from channel to location
- Rename from channel to location those places it makes sense - OCT-3417 Signed-off-by: Alexander Svensen <[email protected]>
1 parent 78f8c43 commit a94a14a

File tree

25 files changed

+89
-88
lines changed

25 files changed

+89
-88
lines changed

applications/nrf5340_audio/broadcast_sink/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ This application uses specific mapping for the following user interface elements
3636

3737
* Long-pressed on the broadcast sink device during startup:
3838

39-
* **VOL-** - Changes the headset to the left channel one.
40-
* **VOL+** - Changes the headset to the right channel one.
39+
* **VOL-** - Changes the headset location to left.
40+
* **VOL+** - Changes the headset location to right.
4141

4242
* Pressed on the broadcast sink device during playback:
4343

applications/nrf5340_audio/doc/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ You can set the location for each headset in the following ways, depending on th
131131
132132
* When :ref:`nrf53_audio_app_building_standard`, set the location for each headset when running the :ref:`programming command <nrf53_audio_app_building_standard_programming>`.
133133
Use the combined bitfield values from the :file:`zephyr/include/zephyr/bluetooth/assigned_numbers.h` file to define the headset location.
134-
For example, if you want to use the stereo configuration, use the combined bitfield value of the left and right channels (``1`` and ``2``, respectively):
134+
For example, if you want to use the stereo configuration, use the ``0x3`` value, which is the combined bitfield value of the left (``0x01``) and right (``0x02``) location:
135135

136136
.. code-block:: console
137137

applications/nrf5340_audio/doc/user_interface.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ The application uses the following buttons on the supported development kit:
5555
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
5656
| Button | Function | Applications |
5757
+===============+===========================================================================================================+=============================================+
58-
| **VOL-** | Long-pressed during startup: Changes the headset to the left channel one. | * :ref:`nrf53_audio_broadcast_sink_app` |
58+
| **VOL-** | Long-pressed during startup: Changes the headset location to left. | * :ref:`nrf53_audio_broadcast_sink_app` |
5959
| | | * :ref:`nrf53_audio_unicast_server_app` |
6060
| +-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
6161
| | Pressed on the headset or the CIS gateway during playback: Turns the playback volume down. | * :ref:`nrf53_audio_broadcast_sink_app` |
6262
| | | * :ref:`nrf53_audio_unicast_server_app` |
6363
| | | * :ref:`nrf53_audio_unicast_client_app` |
6464
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
65-
| **VOL+** | Long-pressed during startup: Changes the headset to the right channel one. | * :ref:`nrf53_audio_broadcast_sink_app` |
65+
| **VOL+** | Long-pressed during startup: Changes the headset location to right. | * :ref:`nrf53_audio_broadcast_sink_app` |
6666
| | | * :ref:`nrf53_audio_unicast_server_app` |
6767
| +-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
6868
| | Pressed on the headset or the CIS gateway during playback: Turns the playback volume up. | * :ref:`nrf53_audio_broadcast_sink_app` |
@@ -89,22 +89,22 @@ The application uses the following buttons on the supported development kit:
8989
| | Pressed on a BIS headset during playback: Change the gateway, if more than one is available. | :ref:`nrf53_audio_broadcast_sink_app` |
9090
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
9191
| **RESET** | Resets the device to the originally programmed settings. | All |
92-
| | This reverts any changes made during testing, for example the channel switches with **VOL** buttons. | |
92+
| | This reverts any changes made during testing, for example the location switches with **VOL** buttons. | |
9393
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
9494

9595
.. group-tab:: nRF5340 DK
9696

9797
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
9898
| Button | Function | Applications |
9999
+===============+===========================================================================================================+=============================================+
100-
| **Button 1** | Long-pressed during startup: Changes the headset to the left channel one. | * :ref:`nrf53_audio_broadcast_sink_app` |
100+
| **Button 1** | Long-pressed during startup: Changes the headset location to left. | * :ref:`nrf53_audio_broadcast_sink_app` |
101101
| | | * :ref:`nrf53_audio_unicast_server_app` |
102102
| +-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
103103
| | Pressed on the headset or the CIS gateway during playback: Turns the playback volume down. | * :ref:`nrf53_audio_broadcast_sink_app` |
104104
| | | * :ref:`nrf53_audio_unicast_server_app` |
105105
| | | * :ref:`nrf53_audio_unicast_client_app` |
106106
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
107-
| **Button 2** | Long-pressed during startup: Changes the headset to the right channel one. | * :ref:`nrf53_audio_broadcast_sink_app` |
107+
| **Button 2** | Long-pressed during startup: Changes the headset location to right. | * :ref:`nrf53_audio_broadcast_sink_app` |
108108
| | | * :ref:`nrf53_audio_unicast_server_app` |
109109
| +-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
110110
| | Pressed on the headset or the CIS gateway during playback: Turns the playback volume up. | * :ref:`nrf53_audio_broadcast_sink_app` |
@@ -122,7 +122,7 @@ The application uses the following buttons on the supported development kit:
122122
| | Pressed on a BIS headset during playback: Change the gateway, if more than one is available. | :ref:`nrf53_audio_broadcast_sink_app` |
123123
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
124124
| **RESET** | Resets the device to the originally programmed settings. | All |
125-
| | This reverts any changes made during testing, for example the channel switches with **VOL** buttons. | |
125+
| | This reverts any changes made during testing, for example the location switches with **VOL** buttons. | |
126126
+---------------+-----------------------------------------------------------------------------------------------------------+---------------------------------------------+
127127

128128
.. _nrf53_audio_app_ui_leds:

applications/nrf5340_audio/src/audio/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ config DEVICE_LOCATION_SET_RUNTIME
180180
config DEVICE_LOCATION_SET_COMPILE_TIME
181181
bool "Set at compile-time"
182182
help
183-
Set channel selection at compile-time.
183+
Set location at compile-time.
184184
endchoice
185185

186186
config DEVICE_LOCATION_AT_COMPILE_TIME

applications/nrf5340_audio/src/audio/le_audio_rx.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static int audio_frame_add(struct net_buf *audio_frame, struct net_buf const *co
9999

100100
/* Callback for handling ISO RX */
101101
void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metadata *meta,
102-
uint8_t channel_index)
102+
uint8_t location_index)
103103
{
104104
int ret;
105105
static struct net_buf *audio_frame;
@@ -111,16 +111,16 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad
111111
ERR_CHK_MSG(-EPERM, "Data received but le_audio_rx is not initialized");
112112
}
113113

114-
rx_stats[channel_index].recv_cnt++;
114+
rx_stats[location_index].recv_cnt++;
115115

116116
if (meta->bad_data) {
117-
rx_stats[channel_index].bad_frame_cnt++;
117+
rx_stats[location_index].bad_frame_cnt++;
118118
}
119119

120-
if ((rx_stats[channel_index].recv_cnt % 100) == 0 && rx_stats[channel_index].recv_cnt) {
120+
if ((rx_stats[location_index].recv_cnt % 100) == 0 && rx_stats[location_index].recv_cnt) {
121121
/* NOTE: The string below is used by the Nordic CI system */
122-
LOG_DBG("ISO RX SDUs: Ch: %d Total: %d Bad: %d", channel_index,
123-
rx_stats[channel_index].recv_cnt, rx_stats[channel_index].bad_frame_cnt);
122+
LOG_DBG("ISO RX SDUs: Loc: %d Total: %d Bad: %d", location_index,
123+
rx_stats[location_index].recv_cnt, rx_stats[location_index].bad_frame_cnt);
124124
}
125125

126126
if (stream_state_get() != STATE_STREAMING) {
@@ -133,7 +133,7 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad
133133
return;
134134
}
135135

136-
if (channel_index != 0 && (CONFIG_AUDIO_DEV == GATEWAY)) {
136+
if (location_index != 0 && (CONFIG_AUDIO_DEV == GATEWAY)) {
137137
/* Only the first device will be used as mic input on gateway */
138138
return;
139139
}
@@ -235,7 +235,7 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad
235235

236236
/* Check if we have received all frames, send if we have */
237237
check_send:
238-
if (num_active_streams == audio_metadata_num_ch_get(net_buf_user_data(audio_frame))) {
238+
if (num_active_streams == audio_metadata_num_loc_get(net_buf_user_data(audio_frame))) {
239239
/* We have received all frames we are waiting for, pass data on to
240240
* the next module
241241
*/

applications/nrf5340_audio/src/audio/le_audio_rx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
*
2828
* @param[in] audio_frame_rx Pointer to the audio buffer.
2929
* @param[in] meta Pointer to the audio metadata.
30-
* @param[in] channel_index Which channel is received.
30+
* @param[in] location_index Which location is received.
3131
*/
3232
void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metadata *meta,
33-
uint8_t channel_index);
33+
uint8_t location_index);
3434

3535
/**
3636
* @brief Initialize the receive audio path.

applications/nrf5340_audio/src/audio/sw_codec_select.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ int sw_codec_encode(struct net_buf *audio_frame_in, struct net_buf *audio_frame_
129129
return -EINVAL;
130130
}
131131

132-
chan_in_num = audio_metadata_num_ch_get(meta_in);
132+
chan_in_num = audio_metadata_num_loc_get(meta_in);
133133
if (audio_frame_in->len < (meta_in->bytes_per_location * chan_in_num)) {
134134
LOG_ERR("Encoder input buffer too small: %d (>=%d)", audio_frame_in->len,
135135
meta_in->bytes_per_location * chan_in_num);
136136
return -EINVAL;
137137
}
138138

139-
chan_out_num = audio_metadata_num_ch_get(meta_out);
139+
chan_out_num = audio_metadata_num_loc_get(meta_out);
140140
if (audio_frame_out->size < (meta_out->bytes_per_location * chan_out_num)) {
141141
LOG_ERR("Encoder output buffer too small: %d (>=%d)", audio_frame_out->size,
142142
meta_out->bytes_per_location * chan_out_num);
@@ -219,7 +219,7 @@ int sw_codec_encode(struct net_buf *audio_frame_in, struct net_buf *audio_frame_
219219
meta_out->bytes_per_location = bytes_written;
220220
meta_out->locations &= meta_in->locations;
221221
net_buf_add(audio_frame_out,
222-
meta_out->bytes_per_location * audio_metadata_num_ch_get(meta_out));
222+
meta_out->bytes_per_location * audio_metadata_num_loc_get(meta_out));
223223

224224
return 0;
225225
#endif /* (CONFIG_SW_CODEC_LC3) */
@@ -273,13 +273,14 @@ int sw_codec_decode(struct net_buf const *const audio_frame_in,
273273
}
274274

275275
if (audio_frame_in->len <
276-
meta_in->bytes_per_location * audio_metadata_num_ch_get(meta_in)) {
276+
meta_in->bytes_per_location * audio_metadata_num_loc_get(meta_in)) {
277277
LOG_ERR("Decoder input frame too small: %d (< %d)", audio_frame_in->len,
278-
(meta_in->bytes_per_location * audio_metadata_num_ch_get(meta_in)));
278+
(meta_in->bytes_per_location *
279+
audio_metadata_num_loc_get(meta_in)));
279280
return -EINVAL;
280281
}
281282

282-
chans_out_num = audio_metadata_num_ch_get(meta_out);
283+
chans_out_num = audio_metadata_num_loc_get(meta_out);
283284
if (audio_frame_out->size < meta_out->bytes_per_location * chans_out_num) {
284285
LOG_ERR("Decoder output buffer too small: %d (<%d for %d channel(s))",
285286
audio_frame_out->size,
@@ -364,7 +365,7 @@ int sw_codec_decode(struct net_buf const *const audio_frame_in,
364365

365366
meta_out->bytes_per_location = inter_in_size;
366367
net_buf_add(audio_frame_out,
367-
meta_out->bytes_per_location * audio_metadata_num_ch_get(meta_out));
368+
meta_out->bytes_per_location * audio_metadata_num_loc_get(meta_out));
368369

369370
#endif /* (CONFIG_SW_CODEC_LC3) */
370371
break;

applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,8 @@ int broadcast_source_send(struct net_buf const *const audio_frame, uint8_t big_i
653653
/* TODO: Use the function below once
654654
* https://github.com/zephyrproject-rtos/zephyr/pull/72908 is merged
655655
*/
656-
/* tx[num_active_streams].audio_channel = audio_map_location_get(stream);*/
657-
tx[num_active_streams].audio_channel = i;
656+
/* tx[num_active_streams].audio_location = audio_map_location_get(stream);*/
657+
tx[num_active_streams].audio_location = i;
658658

659659
num_active_streams++;
660660
}

applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,17 @@ int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio
202202
return -EINVAL;
203203
}
204204

205-
/* Get number of channels in the audio frame */
205+
/* Get number of locations in the audio frame */
206206
struct audio_metadata *meta = net_buf_user_data(audio_frame);
207-
uint8_t num_ch = audio_metadata_num_ch_get(meta);
207+
uint8_t num_loc = audio_metadata_num_loc_get(meta);
208208

209-
if (num_ch == 0 || (audio_frame->len % num_ch != 0)) {
210-
LOG_ERR("Invalid number (%d) of channels in audio frame (%d)", num_ch,
209+
if (num_loc == 0 || (audio_frame->len % num_loc != 0)) {
210+
LOG_ERR("Invalid number (%d) of locations in audio frame (%d)", num_loc,
211211
audio_frame->len);
212212
return -EINVAL;
213213
}
214214

215-
data_size_pr_stream = audio_frame->len / num_ch;
215+
data_size_pr_stream = audio_frame->len / num_loc;
216216

217217
/* When sending ISO data, we always send ts = 0 to the first active transmitting channel.
218218
* The controller will populate with a ts which is fetched using bt_iso_chan_get_tx_sync.
@@ -243,8 +243,8 @@ int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio
243243
continue;
244244
}
245245

246-
if (tx[i].audio_channel > num_ch) {
247-
LOG_WRN("Unsupported audio_channel: %d", tx[i].audio_channel);
246+
if (tx[i].audio_location > num_loc) {
247+
LOG_WRN("Unsupported audio_location: %d", tx[i].audio_location);
248248
continue;
249249
}
250250

@@ -269,13 +269,13 @@ int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio
269269
}
270270
common_interval = tx[i].cap_stream->bap_stream.qos->interval;
271271

272-
/* Check if same audio is sent to all channels */
273-
if (num_ch == 1) {
272+
/* Check if same audio is sent to all locations */
273+
if (num_loc == 1) {
274274
ret = iso_stream_send(audio_frame->data, data_size_pr_stream,
275275
tx[i].cap_stream, tx_info, common_tx_sync_ts_us);
276276
} else {
277277
ret = iso_stream_send(audio_frame->data +
278-
(tx[i].audio_channel * data_size_pr_stream),
278+
(tx[i].audio_location * data_size_pr_stream),
279279
data_size_pr_stream, tx[i].cap_stream, tx_info,
280280
common_tx_sync_ts_us);
281281
}
@@ -293,7 +293,7 @@ int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio
293293
}
294294

295295
/* Strictly, it is only required to call get_tx_sync_sdc on the first streaming
296-
* channel to get the timestamp which is sent to all other channels.
296+
* location to get the timestamp which is sent to all other locations.
297297
* However, to be able to detect errors, this is called on each TX.
298298
*/
299299
ret = get_tx_sync_sdc(tx_info->iso_conn_handle, &tx_info->iso_tx_readback);

applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
struct le_audio_tx_info {
2525
struct stream_index idx;
2626
struct bt_cap_stream *cap_stream;
27-
uint8_t audio_channel;
27+
uint8_t audio_location;
2828
};
2929

3030
/**

0 commit comments

Comments
 (0)