From the 'Code API' link on the sound_play wiki page you can get to the documentation and example for the C++ SoundPlay client.
The function you probably want to use is playWaveFromPkg
; it should look something like this:
int main(int argc, char ** argv) {
ros::init(argc, argv, "example");
ros::NodeHandle nh;
sound_play::SoundClient sc;
sc.playWaveFromPkg("sound_play", "sounds/BACKINGUP.ogg");
ros::spin();
}
Originally posted by ahendrix with karma: 47576 on 2016-05-10
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Joy.Lin on 2016-05-14:
Thank you very much . I can play the sound file successfully!!
However, I can't control its volume, it's always too low.
Comment by rodrigobdz on 2016-06-11:
The documentation and example links are broken
Comment by rodrigobdz on 2016-06-11:
The links are now found under the docs directory for each distribution
Comment by ahendrix on 2016-06-11:
Fixed the links; thanks for catching that.