WavPlayerService_impl.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <cstdlib>
00003 #include <cstdio>
00004 #include <pthread.h>
00005 #include "hrpsys/util/Hrpsys.h"
00006 #include "WavPlayerService_impl.h"
00007 
00008 
00009 WavPlayerService_impl::WavPlayerService_impl()
00010 {
00011 }
00012 
00013 WavPlayerService_impl::~WavPlayerService_impl()
00014 {
00015 }
00016 
00017 void WavPlayerService_impl::playWav(const char *filename)
00018 {
00019     char buf[256];
00020     sprintf(buf, "aplay %s", filename);
00021     std::cout << "cmd = [" << buf << "]" << std::endl;
00022     int ret = system(buf);
00023 }
00024 
00025 void *thread_main(void *args)
00026 {
00027     char *filename = (char *)args;
00028     char buf[256];
00029     sprintf(buf, "aplay %s", filename);
00030     std::cout << "cmd = [" << buf << "]" << std::endl;
00031     int ret = system(buf);
00032     return NULL;
00033 }
00034 
00035 void WavPlayerService_impl::playWavNoWait(const char *filename)
00036 {
00037     pthread_t thr;
00038     pthread_create(&thr, NULL, thread_main, (void *)filename);
00039 }


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed May 15 2019 05:02:19