00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00036 #include <sound_play/sound_play.h> 00037 #include <unistd.h> 00038 #include <ros/package.h> 00039 00040 void sleepok(int t, ros::NodeHandle &nh) 00041 { 00042 if (nh.ok()) sleep(t); 00043 } 00044 00045 00046 00047 int main(int argc, char **argv) 00048 { 00049 ros::init(argc, argv, "sound_play_test"); 00050 00051 ros::NodeHandle nh; 00052 sound_play::SoundClient sc; 00053 00054 sleepok(1, nh); 00055 00056 while(nh.ok()) 00057 { 00058 // sc.say("Hello world!"); 00059 // sleepok(2, nh); 00060 // 00061 // const char *str1 = "I am annoying."; 00062 // sc.repeat(str1); 00063 // sleepok(4, nh); 00064 // sc.stopSaying(str1); 00065 00066 std::string path= ros::package::getPath("atlas_sound_player")+ "/Recordings/Audrey/0063_following_obstacle.wav"; 00067 sc.playWave(path); 00068 sleepok(0.1, nh); 00069 00070 std::string path1= ros::package::getPath("atlas_sound_player")+ "/Recordings/Audrey/0063_following_obstacle.wav"; 00071 sc.playWave(path1); 00072 sleepok(2, nh); 00073 00074 // const char *str2 = "/usr/share/xemacs21/xemacs-packages/etc/sounds/piano-beep.wav"; 00075 // sc.startWave(str2); 00076 // sleepok(4, nh); 00077 // sc.stopWave(str2); 00078 // 00079 // sc.play(sound_play::SoundRequest::NEEDS_UNPLUGGING); 00080 // sleepok(2, nh); 00081 // 00082 // sc.start(sound_play::SoundRequest::BACKINGUP); 00083 // sleepok(4, nh); 00084 // sc.stop(sound_play::SoundRequest::BACKINGUP); 00085 // 00086 // sleepok(2, nh); 00087 // sound_play::Sound s1 = sc.waveSound("/usr/share/xemacs21/xemacs-packages/etc/sounds/boing.wav"); 00088 // s1.repeat(); 00089 // sleepok(1, nh); 00090 // s1.stop(); 00091 // 00092 // sleepok(2, nh); 00093 // sound_play::Sound s2 = sc.voiceSound("This is a really long sentence that will get cut off."); 00094 // s2.play(); 00095 // sleepok(1, nh); 00096 // s2.stop(); 00097 // 00098 // sleepok(2, nh); 00099 // sound_play::Sound s3 = sc.builtinSound(sound_play::SoundRequest::NEEDS_UNPLUGGING_BADLY); 00100 // s3.play(); 00101 // sleepok(1, nh); 00102 // s3.stop(); 00103 } 00104 }