-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speaker relative path not working with external controller #6591
Comments
|
Otherwise, we can also modify the protocol to send the sound file to the server together with the speaker sound play command. |
I do not know how easy/difficult it is to implement such a feature to handle files that are a couple hundred of kBytes. Caching would be required, as if it was a web resource. |
Yes, if implementing such a feature, we should also implement some caching functionality. |
Proposal for external controller sound support:Add a new speaker API to upload sound data to speaker devices from external controller. Speakers will then cache the data and a later call to play the file will work, regardless of what the path was (as long it is the same string used during the upload). On controller side it will look like this:
The upload sound API will stream the data to the Webots instance together with the filename for caching. Will this work or is there a message length limit to consider ? |
Yes, that would work. However, I believe we can probably implement this without modifying the API: When passing a sound file to |
@omichel Ok, I'll embed the sound data upload logic into existing wb_speaker_play_sound() as suggested above.. |
Stream sound data from controller to Webots if the sound file path is accesible by the controller process. This allows external controller to use sounds even if the file pathis not accessible from Webots. * Controller: Try to load sound data on controller side and stream it to webots as part of the C_SPEAKER_PLAY_SOUND message. (speaker.c) * Webots: Read controller uploaded sound data in C_SPEAKER_PLAY_SOUND message (WbSpeaker). Use former file based load method if no data was streamed from controller. * Updated speaker.md to explain when wb_speaker_play_sound() streams loads the sound data itself already.
Cache sound data in speaker decice not WbSoundSource. WbSoundSource gets deleted on play stop.
Stream sound data from controller to Webots if the sound file path is accesible by the controller process. This allows external controller to use sounds even if the file path is not accessible from Webots. * Controller: Try to load sound data on controller side and stream it to webots as part of the C_SPEAKER_PLAY_SOUND message. (speaker.c) * Webots: Read controller uploaded sound data in C_SPEAKER_PLAY_SOUND message (WbSpeaker). Use former file based load method if no data was streamed from controller. * Streamed sound data is cached inside WbSpeaker instance as controller provides the data only on first use of a sound file. * Updated speaker.md to explain when wb_speaker_play_sound() streams loads the sound data itself already. * Prevent copy/assignment of WbSoundClip as it now hold a heap allocated member (mDevice).
* Improve sound support for external controller (#6591) Stream sound data from controller to Webots if the sound file path is accesible by the controller process. This allows external controller to use sounds even if the file path is not accessible from Webots. * Controller: Try to load sound data on controller side and stream it to webots as part of the C_SPEAKER_PLAY_SOUND message. (speaker.c) * Webots: Read controller uploaded sound data in C_SPEAKER_PLAY_SOUND message (WbSpeaker). Use former file based load method if no data was streamed from controller. * Streamed sound data is cached inside WbSpeaker instance as controller provides the data only on first use of a sound file. * Updated speaker.md to explain when wb_speaker_play_sound() streams loads the sound data itself already. * Prevent copy/assignment of WbSoundClip as it now hold a heap allocated member (mDevice). * WbSpeaker.cpp - fix source indentation * Fix comment typo in speaker.c * Address cppcheck issues * Added changelog entry for this PR Fixed ubuntu tester src formatting issue. * Fix formatting issue in WbSpeaker.cpp * Fixed bug radar.py (#6606) * fix bug radar.py Fixed the bug that when using Python to write a controller, using getTargets() could not correctly obtain multiple target data detected by radar * Fixed the bug in obtaining radar detection target information#6606 Fixed the bug that when using Python to write a controller, using getTargets() could not correctly obtain multiple target data detected by radar --------- Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com> * Added changelog entry for this PR Fixed ubuntu tester src formatting issue. * Addressed code review comments #6605 * Incorporated review feedback Added improvement provided by CoolSpy3. * Update src/controller/c/speaker.c --------- Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com> Co-authored-by: Gabryel Reyes <66941456+gabryelreyes@users.noreply.github.com> Co-authored-by: lonely-poppy <77427326+lonely-poppy@users.noreply.github.com>
Describe the Bug
Using a external controller: using the Speaker to play a WAV file that is found relative to the controller executable results in the file not to being found.
This should be possible according to the documentation: https://cyberbotics.com/doc/reference/speaker#description
Root cause
robot->controllerDir();
returns an empty string, asmControllerDir
is not updated if the controller is<extern>
.This results in
QFile::exists(mControllerDir + filename)
returningfalse
for the WAV file.Steps to Reproduce
<extern>
controller.Speaker
device.pathToFile = "sounds/CoolSound.wav"
Expected behavior
Expected to hear the sound.
Observed behavior
System
The text was updated successfully, but these errors were encountered: