Skip to content

Commit 92352ac

Browse files
authored
Fix wb_speaker_play_sound Request Message (#6843)
* fix speaker_play_sound message * update changelog * changelog clarification
1 parent 238dfd4 commit 92352ac

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

docs/reference/changelog-r2025.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Webots R2025b
44
- Bug Fixes
55
- Fixed a bug preventing the `webots-controller` executable from running on arm-based mac devices ([#6806](https://github.com/cyberbotics/webots/pull/6806)).
6+
- Fixed a bug causing Webots to crash when multiple sounds were used with a [Speaker](speaker.md) node ([#6843](https://github.com/cyberbotics/webots/pull/6843)).
67

78
## Webots R2025a
89
Released on January 31st, 2025.

src/controller/c/speaker.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,17 @@ static void speaker_write_request(WbDevice *d, WbRequest *r) {
258258
request_write_char(r, 1);
259259
else
260260
request_write_char(r, 0);
261-
}
262261

263-
request_write_int32(r, sound->upload_size);
264-
if (sound->upload_size) {
265-
/* Sound data available to stream, send it one time and discard it.
266-
* Webots will cache the data inside the device.
267-
*/
268-
request_write_data(r, sound->upload_data, sound->upload_size);
269-
free(sound->upload_data);
270-
sound->upload_data = NULL;
271-
sound->upload_size = 0;
262+
request_write_int32(r, sound->upload_size);
263+
if (sound->upload_size) {
264+
/* Sound data available to stream, send it one time and discard it.
265+
* Webots will cache the data inside the device.
266+
*/
267+
request_write_data(r, sound->upload_data, sound->upload_size);
268+
free(sound->upload_data);
269+
sound->upload_data = NULL;
270+
sound->upload_size = 0;
271+
}
272272
}
273273

274274
sound->need_update = false;

0 commit comments

Comments
 (0)