static void play() { ALCdevice *dev; ALCcontext *ctx; unsigned src; unsigned bufs[2]; unsigned buf; int v; float zero[3]; memset(zero, 0, sizeof zero); dev = alcOpenDevice(NULL); ctx = alcCreateContext(dev, NULL); alcMakeContextCurrent(ctx); alGenSources(1, &src); alGenBuffers(2, bufs); alSourcef(src, AL_PITCH, 1.0f); alSourcef(src, AL_GAIN, 1.0f); alSourcefv(src, AL_POSITION, zero); alSourcefv(src, AL_VELOCITY, zero); alSourcei(src, AL_SOURCE_RELATIVE, AL_TRUE); alSourcei(src, AL_LOOPING, AL_FALSE); ima_init(&ima_state); queue(src, bufs[0]); queue(src, bufs[1]); alSourcePlay(src); for (;;) { alGetSourcei(src, AL_BUFFERS_PROCESSED, &v); while (v-- > 0) { alSourceUnqueueBuffers(src, 1, &buf); queue(src, buf); } alGetSourcei(src, AL_SOURCE_STATE, &v); if (v == AL_STOPPED) break; usleep(1000); } alDeleteSources(1, &src); alDeleteBuffers(2, bufs); alcMakeContextCurrent(NULL); alcDestroyContext(ctx); alcCloseDevice(dev); }
void Game::cleanup () { if (!errorLoadingLibraries) { SDL_FreeSurface (screen); TTF_Quit (); SDL_Quit (); alcDestroyContext (alcContext); alcCloseDevice (alcDevice); } }
AudioContext::~AudioContext() { if (m_handle) { alcMakeContextCurrent(nullptr); alcDestroyContext((ALCcontext*) m_handle); } if (m_device) alcCloseDevice((ALCdevice*) m_device); }
CSound::~CSound() { alDeleteSources( 3, source ); alDeleteBuffers( 3, buffer ); // Выключаем текущий контекст alcMakeContextCurrent(0); // Уничтожаем контекст alcDestroyContext( pContext ); // Закрываем звуковое устройство alcCloseDevice( pDevice ); }
SoundManager::~SoundManager() { while (soundSources->size() > 0) { delete soundSources->back(); soundSources->pop_back(); } delete soundSources; alcMakeContextCurrent(NULL); alcDestroyContext(context); alcCloseDevice(device); }
void clAudioThread::ShutdownOpenAL() { #if L_AUDIO_USE_OPENAL guard(); alcDestroyContext( FContext ); alcCloseDevice( FDevice ); unguard(); #endif }
Context::~Context() { if (context) { alcMakeContextCurrent(NULL); alcDestroyContext((ALCcontext*) context); } if (device) alcCloseDevice((ALCdevice*) device); }
void Audio::closeOutput() { if (alContext) { alcMakeContextCurrent(nullptr); alcDestroyContext(alContext); } if (alOutDev) alcCloseDevice(alOutDev); }
//--------------------------------------- void ofOpenALSoundPlayer::close(){ if(alContext != NULL){ alcMakeContextCurrent(NULL); alcDestroyContext(alContext); alContext = NULL; } if(alDevice != NULL){ alcCloseDevice(alDevice); alDevice = NULL; } }
static void cleanup(void) { alcDestroyContext(cc); #ifdef DMALLOC dmalloc_verify(0); dmalloc_log_unfreed(); #endif #ifdef JLIB jv_check_mem(); #endif }
COALDevice::~COALDevice(){ Log::Write(L"Deinitializing OpenAL Device..."); if(this->m_pContext){ auto pCtx = alcGetCurrentContext(); if(pCtx == this->m_pContext){ alcMakeContextCurrent(0); } alcDestroyContext(this->m_pContext); this->m_pContext = 0; } }
//--------------------------------------- void ofOpenALSoundPlayer_TimelineAdditions::close(){ if(alDevice){ alcCloseDevice(alDevice); alDevice = NULL; alcDestroyContext(alContext); alContext = 0; #ifdef OF_USING_MPG123 mpg123_exit(); #endif } }
void audio_close_device(void) { if (gAudioDevice.Device != NULL) { alcMakeContextCurrent(NULL); alcDestroyContext(gAudioDevice.Context); alcCloseDevice(gAudioDevice.Device); gAudioDevice.Device = NULL; gAudioDevice.Context = NULL; } }
CWav::~CWav() { if (m_PCM.raw) { free(m_PCM.raw); m_PCM.raw = 0; } alDeleteSources(1, &m_AL.source); alDeleteBuffers(1, &m_AL.buffer); alcMakeContextCurrent(NULL); alcDestroyContext(m_AL.context); alcCloseDevice(m_AL.device); }
//--------------------------------------- void ofSoundPlayerExtended::close(){ if(alDevice){ alcCloseDevice(alDevice); alDevice = NULL; alcDestroyContext(alContext); alContext = 0; #ifdef OF_USING_MPG123 mpg123_exit(); #endif } }
WSoundComponent::~WSoundComponent(void) { for (uint i = 0; i < m_soundV.size(); i) delete (m_soundV[i]); // Exit open AL m_oalContext = alcGetCurrentContext(); m_oalDevice = alcGetContextsDevice(m_oalContext); alcMakeContextCurrent(nullptr); alcDestroyContext(m_oalContext); alcCloseDevice(m_oalDevice); }
AudioDevice::~AudioDevice() { // Destroy the context alcMakeContextCurrent(NULL); if (audioContext) alcDestroyContext(audioContext); // Destroy the device if (audioDevice) alcCloseDevice(audioDevice); }
//--------------------------------------- void ofOpenALSoundPlayer::close(){ if(alDevice){ alcCloseDevice(alDevice); alDevice = nullptr; alcDestroyContext(alContext); alContext = 0; #ifdef OF_USING_MPG123 mpg123_exit(); #endif } }
SoundManager::~SoundManager() { // De-initialize OpenAL if(alContext) { alcMakeContextCurrent(NULL); alcDestroyContext(alContext); } if(alDevice) alcCloseDevice(alDevice); }
gc_result gaX_device_close_openAl(ga_DeviceImpl_OpenAl* in_device) { alDeleteSources(1, &in_device->hwSource); alDeleteBuffers(in_device->numBuffers, in_device->hwBuffers); alcDestroyContext(in_device->context); alcCloseDevice(in_device->dev); in_device->devType = GA_DEVICE_TYPE_UNKNOWN; gcX_ops->freeFunc(in_device->hwBuffers); gcX_ops->freeFunc(in_device); return GC_SUCCESS; }
OALAudioEngine::~OALAudioEngine() { audio_buffs_.clear(); ALCcontext* context = alcGetCurrentContext(); ALCdevice* device = alcGetContextsDevice(context); alcMakeContextCurrent(0); alcDestroyContext(context); alcCloseDevice(device); }
void DS_Shutdown(void) { if(!initOk) return; alcMakeContextCurrent(NULL); alcDestroyContext(context); alcCloseDevice(device); context = NULL; device = NULL; initOk = false; }
void __alexit() { ALCcontext *context; ALCdevice *device; context = alcGetCurrentContext(); device = alcGetContextsDevice(context); alcMakeContextCurrent(NULL); alcDestroyContext(context); alcCloseDevice(device); }
static void openal_close(void *data) { struct openal_data *od = data; timer_free(od->timer); alcMakeContextCurrent(od->context); alDeleteSources(1, &od->source); alDeleteBuffers(NUM_BUFFERS, od->buffers); alcDestroyContext(od->context); alcCloseDevice(od->device); }
AudioDevice::~AudioDevice() { for(auto itr = m_audioFiles.begin(); itr != m_audioFiles.end(); itr++) { if(alIsBuffer(itr->second.buffer)) alDeleteBuffers(1, &itr->second.buffer); } alcMakeContextCurrent(NULL); alcDestroyContext(m_context); alcCloseDevice(m_device); }
~Audio() { DOUT << "~Audio()" << std::endl; stopAll(); cleanup(); alcMakeContextCurrent(0); /* TIPS:解放する為にカレントコンテキストをNULLにする */ alcDestroyContext(context_); alcCloseDevice(device_); }
void say_audio_context_clean_up() { alcMakeContextCurrent(NULL); if (say_audio_context) alcDestroyContext(say_audio_context); if (say_audio_device) alcCloseDevice(say_audio_device); say_audio_context = NULL; say_audio_device = NULL; }
SoundContext::~SoundContext(void) { ALContextData::makeCurrent(0); delete contextData; #if ALSUPPORT_CONFIG_HAVE_OPENAL if(alcGetCurrentContext()==alContext) alcMakeContextCurrent(0); alcDestroyContext(alContext); alcCloseDevice(alDevice); #endif }
Sound::~Sound() // destructor, just an example { //Clean-up fclose(fp); delete[] buf; alDeleteSources(1, &source); alDeleteBuffers(1, &buffer); alcMakeContextCurrent(NULL); alcDestroyContext(context); alcCloseDevice(device); }
void SoundSystemOAL::release() { ChannelOAL::stopThread(); _channels._channels.clear(); alcMakeContextCurrent(0); alcDestroyContext(_context); _context = 0; alcCloseDevice(_device); _device = 0; }