void Recognizer::initialize(const ci::fs::path& hmmPath, const ci::fs::path& dictPath) { // Configure recognizer: mConfig = cmd_ln_init( NULL, ps_args(), true, "-hmm", hmmPath.c_str(), "-dict", dictPath.c_str(), "-logfn", "/dev/null", NULL ); if( mConfig == NULL ) throw std::runtime_error( "Could not configure speech recognizer" ); // Initialize recognizer: mDecoder = ps_init( mConfig ); if( mDecoder == NULL ) throw std::runtime_error( "Could not initialize speech recognizer" ); }
//------------------------------------------------------------ void FmodexPlayer::loadSound(ci::fs::path fileName, bool stream){ // fmod uses IO posix internally, might have trouble // with unicode paths... // says this code: // http://66.102.9.104/search?q=cache:LM47mq8hytwJ:www.cleeker.com/doxygen/audioengine__fmod_8cpp-source.html+FSOUND_Sample_Load+cpp&hl=en&ct=clnk&cd=18&client=firefox-a // for now we use FMODs way, but we could switch if // there are problems: bMultiPlay = false; // [1] init fmod, if necessary initializeFmod(); // [2] try to unload any previously loaded sounds // & prevent user-created memory leaks // if they call "loadSound" repeatedly, for example unloadSound(); // [3] load sound //choose if we want streaming int fmodFlags = FMOD_SOFTWARE; if(stream)fmodFlags = FMOD_SOFTWARE | FMOD_CREATESTREAM; result = sys->createSound(fileName.c_str(), fmodFlags, NULL, &sound); if (result != FMOD_OK){ bLoadedOk = false; console() << "FmodexPlayer: Could not load sound file " << fileName << std::endl; } else { bLoadedOk = true; sound->getLength(&length, FMOD_TIMEUNIT_PCM); isStreaming = stream; } }
bool ciWMFVideoPlayer::loadMovie(ci::fs::path path, string audioDevice) { if (!_player) { //ofLogError("ciWMFVideoPlayer") << "Player not created. Can't open the movie."; return false; } //fs::path path = getAssetPath(name); DWORD fileAttr = GetFileAttributesW(path.c_str()); if (fileAttr == INVALID_FILE_ATTRIBUTES) { stringstream s; s << "The video file '" << path << "'is missing."; //ofLog(OF_LOG_ERROR,"ciWMFVideoPlayer:" + s.str()); return false; } //cout << "Videoplayer[" << _id << "] loading " << name << endl; HRESULT hr = S_OK; string s = path.string(); std::wstring w(s.length(), L' '); std::copy(s.begin(), s.end(), w.begin()); std::wstring a(audioDevice.length(), L' '); std::copy(audioDevice.begin(), audioDevice.end(), a.begin()); hr = _player->OpenURL( w.c_str(), a.c_str() ); if (!_sharedTextureCreated) { _width = _player->getWidth(); _height = _player->getHeight(); gl::Texture::Format format; format.setInternalFormat(GL_RGBA); format.setTargetRect(); _tex = gl::Texture::create(_width,_height, format); //_tex.allocate(_width,_height,GL_RGBA,true); _player->m_pEVRPresenter->createSharedTexture(_width, _height, _tex->getId()); _sharedTextureCreated = true; } else { if ((_width != _player->getWidth()) || (_height != _player->getHeight())) { _player->m_pEVRPresenter->releaseSharedTexture(); _width = _player->getWidth(); _height = _player->getHeight(); gl::Texture::Format format; format.setInternalFormat(GL_RGBA); format.setTargetRect(); _tex = gl::Texture::create(_width,_height, format); //_tex.allocate(_width,_height,GL_RGBA,true); _player->m_pEVRPresenter->createSharedTexture(_width, _height, _tex->getId()); } } _waitForLoadedToPlay = false; return true; }