Ejemplo n.º 1
0
static gboolean
gst_openal_sink_open (GstAudioSink * audiosink)
{
  GstOpenALSink *sink = GST_OPENAL_SINK (audiosink);

  if (sink->user_device) {
    ALCint value = -1;
    alcGetIntegerv (sink->user_device, ALC_ATTRIBUTES_SIZE, 1, &value);
    if (value > 0) {
      if (!sink->user_context
          || alcGetContextsDevice (sink->user_context) == sink->user_device)
        sink->default_device = sink->user_device;
    }
  } else if (sink->user_context)
    sink->default_device = alcGetContextsDevice (sink->user_context);
  else
    sink->default_device = alcOpenDevice (sink->device_name);
  if (!sink->default_device) {
    GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
        ("Could not open device."), GST_ALC_ERROR (sink->default_device));
    return FALSE;
  }

  return TRUE;
}
Ejemplo n.º 2
0
static gboolean
gst_openal_sink_open (GstAudioSink * asink)
{
    GstOpenALSink *openal = GST_OPENAL_SINK (asink);

    if (openal->custom_dev) {
        ALCint val = -1;
        alcGetIntegerv (openal->custom_dev, ALC_ATTRIBUTES_SIZE, 1, &val);
        if (val > 0) {
            if (!openal->custom_ctx ||
                    alcGetContextsDevice (openal->custom_ctx) == openal->custom_dev)
                openal->device = openal->custom_dev;
        }
    } else if (openal->custom_ctx)
        openal->device = alcGetContextsDevice (openal->custom_ctx);
    else
        openal->device = alcOpenDevice (openal->devname);
    if (!openal->device) {
        GST_ELEMENT_ERROR (openal, RESOURCE, OPEN_WRITE,
                           ("Could not open audio device for playback."),
                           GST_ALC_ERROR (openal->device));
        return FALSE;
    }

    return TRUE;
}
Ejemplo n.º 3
0
	value lime_alc_get_contexts_device (value context) {
		
		ALCcontext* alcContext = (ALCcontext*)val_data (context);
		ALCdevice* alcDevice = alcGetContextsDevice (alcContext);
		return CFFIPointer (alcDevice);
		
	}
Ejemplo n.º 4
0
value lime_alc_get_contexts_device (value context) {

    ALCcontext* alcContext = (ALCcontext*)(intptr_t)val_float (context);
    ALCdevice* alcDevice = alcGetContextsDevice (alcContext);
    return alloc_float ((intptr_t)alcDevice);

}
Ejemplo n.º 5
0
	//-----------------------------------------------------------------//
	void audio_io::alc_info() const
	{
		if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE) {
			if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATE_ALL_EXT") == AL_TRUE) {
				printDevices(ALC_ALL_DEVICES_SPECIFIER, "playback ");
			} else {
				printDevices(ALC_DEVICE_SPECIFIER, "playback ");
				printDevices(ALC_CAPTURE_DEVICE_SPECIFIER, "capture ");
			}
		} else {
			std::cout << boost::format("No device enumeration available\n");
		}

		ALCdevice* device = alcGetContextsDevice(alcGetCurrentContext());
		checkForErrors();

		std::cout << boost::format("Default device: %s\n")
			% alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER);

		std::cout << boost::format("Default capture device: %s\n")
			% alcGetString(device, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);

		ALCint major, minor;
		alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major);
		alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor);
		checkForErrors();
		std::cout << boost::format("ALC version: %d.%d\n") % static_cast<int>(major) % static_cast<int>(minor);

		printExtensions("ALC extensions", ' ',
			alcGetString(device, ALC_EXTENSIONS));
		checkForErrors();
	}
Ejemplo n.º 6
0
void OpenALStream::Stop()
{
  m_run_thread.Clear();
  // kick the thread if it's waiting
  soundSyncEvent.Set();

  soundTouch.clear();

  thread.join();

  alSourceStop(uiSource);
  alSourcei(uiSource, AL_BUFFER, 0);

  // Clean up buffers and sources
  alDeleteSources(1, &uiSource);
  uiSource = 0;
  alDeleteBuffers(numBuffers, uiBuffers);

  ALCcontext* pContext = alcGetCurrentContext();
  ALCdevice* pDevice = alcGetContextsDevice(pContext);

  alcMakeContextCurrent(nullptr);
  alcDestroyContext(pContext);
  alcCloseDevice(pDevice);
}
Ejemplo n.º 7
0
static void
checkForErrors (void)
{
  {
    ALenum error = alutGetError ();
    if (error != ALUT_ERROR_NO_ERROR)
      {
        die ("ALUT", alutGetErrorString (error));
      }
  }
  {
    ALCdevice *device = alcGetContextsDevice (alcGetCurrentContext ());
    ALCenum error = alcGetError (device);
    if (error != ALC_NO_ERROR)
      {
        die ("ALC", (const char *) alcGetString (device, error));
      }
  }
  {
    ALenum error = alGetError ();
    if (error != AL_NO_ERROR)
      {
        die ("AL", (const char *) alGetString (error));
      }
  }
}
Ejemplo n.º 8
0
COpenALSound::~COpenALSound()
{
	if (noSound) {
		delete[] Sources;
		return;
	}
	LoadedFiles.clear();
	for (int i = 0; i < maxSounds; i++) {
		alSourceStop(Sources[i]);
		alDeleteSources(1,&Sources[i]);
	}
	delete[] Sources;
	while (!Buffers.empty()) {
		alDeleteBuffers(1,&Buffers.back());
		Buffers.pop_back();
	}
	ALCcontext *curcontext = alcGetCurrentContext();
	ALCdevice *curdevice = alcGetContextsDevice(curcontext);
	alcSuspendContext(curcontext);
	/*
	 * FIXME
	 * Technically you're supposed to detach and destroy the
	 * current context with these two lines, but it deadlocks.
	 * As a not-quite-as-clean shortcut, if we skip this step
	 * and just close the device, OpenAL theoretically
	 * destroys the context associated with that device.
	 * 
	 * alcMakeContextCurrent(NULL);
	 * alcDestroyContext(curcontext);
	 */
	alcCloseDevice(curdevice);
}
Ejemplo n.º 9
0
AL_API void OPENAL_Close()
{
    if (!initialized) return;

    ALCcontext *ctx = alcGetCurrentContext();
    if (ctx)
    {
        for (int i = 0; i < num_channels; i++)
        {
            alSourceStop(channels[i].sid);
            alSourcei(channels[i].sid, AL_BUFFER, 0);
            alDeleteSources(1, &channels[i].sid);
        }
        ALCdevice *dev = alcGetContextsDevice(ctx);
        alcMakeContextCurrent(NULL);
        alcSuspendContext(ctx);
        alcDestroyContext(ctx);
        alcCloseDevice(dev);
    }

    num_channels = 0;
    delete[] channels;
    channels = NULL;

    unload_alsyms();
    initialized = false;
}
Ejemplo n.º 10
0
void alCleanUp(void){
	context = alcGetCurrentContext();
	device = alcGetContextsDevice(context);
	alcMakeContextCurrent(NULL);
	alcDestroyContext(context);
	alcCloseDevice(device);
}
Ejemplo n.º 11
0
	void CaptureThread::initializeSound()
	{
		
		_pContext = NULL;
		_pDevice = NULL;	

		// Check for Capture Extension support
		_pContext = alcGetCurrentContext();
		_pDevice = alcGetContextsDevice( _pContext );
		if( alcIsExtensionPresent( _pDevice, "ALC_EXT_CAPTURE") == AL_FALSE ) {
			return;
		}

		// Get list of available Capture Devices
		const ALchar *pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
		if ( pDeviceList )
		{
			while (*pDeviceList)
			{
				pDeviceList += strlen(pDeviceList) + 1;
			}
		}

		// Get the name of the 'default' capture device
		_szDefaultCaptureDevice = alcGetString( NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER );

		//pCaptureDevice = alcCaptureOpenDevice( szDefaultCaptureDevice, 44100, AL_FORMAT_MONO16, BUFFERSIZE );
		this->changeDevice( QString( _szDefaultCaptureDevice ) );
	}
Ejemplo n.º 12
0
// virtual
std::string LLAudioEngine_OpenAL::getDriverName(bool verbose)
{
	ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext());
	std::ostringstream version;

	version <<
		"OpenAL";

	if (verbose)
	{
		version <<
			", version " <<
			ll_safe_string(alGetString(AL_VERSION)) <<
			" / " <<
			ll_safe_string(alGetString(AL_VENDOR)) <<
			" / " <<
			ll_safe_string(alGetString(AL_RENDERER));
		
		if (device)
			version <<
				": " <<
				ll_safe_string(alcGetString(device,
				    ALC_DEFAULT_DEVICE_SPECIFIER));
	}

	return version.str();
}
Ejemplo n.º 13
0
//Cleanup of OPENAL system
void SoundManager::_releaseAL()
{
	bool success = true;

	SingletonLogMgr::Instance()->AddNewLine("SoundManager::releaseAL","Releasing sound system..",LOGNORMAL);
	
	//Clear all data
	_releaseALData();
	
	ALCcontext* pCurContext;
	ALCdevice* pCurDevice;

	// Get the current context.
	pCurContext = alcGetCurrentContext();

	// Get the device used by that context.
	pCurDevice = alcGetContextsDevice(pCurContext);

	// Reset the current context to NULL.
	if(!alcMakeContextCurrent(NULL))
		success = false;

	// Release the context and the device.
	alcDestroyContext(pCurContext);
	
	if(!alcCloseDevice(pCurDevice))
		success = false;
	
	if(!success)
		SingletonLogMgr::Instance()->AddNewLine("SoundManager::releaseAL","Sound system released INCORRECLY",LOGEXCEPTION);
	else
		SingletonLogMgr::Instance()->AddNewLine("SoundManager::releaseAL","Sound system released correctly",LOGNORMAL);
	
}
Ejemplo n.º 14
0
//Function to clean and delete sound files
void Openal::clean_al()
{
	//clear source 
	alDeleteSources(1, &alSource[0]);
	alDeleteSources(1, &alSource[1]);
	alDeleteSources(1, &alSource[2]);
	alDeleteSources(1, &alSource[3]);
	alDeleteSources(1, &alSource[4]);
	alDeleteSources(1, &alSource[5]);


	//clear buffer
	alDeleteBuffers(1, &alBuffer0);
	alDeleteBuffers(1, &alBuffer1);
	alDeleteBuffers(1, &alBuffer2);
	alDeleteBuffers(1, &alBuffer3);
	alDeleteBuffers(1, &alBuffer4);
	alDeleteBuffers(1, &alBuffer5);
	
	for (int i = 0; i < 5; i++) {
		alDeleteSources(1, &dinoSour[i]);
		alDeleteBuffers(1, &dinoBuff[i]);
	}

	ALCcontext *Context = alcGetCurrentContext();
	ALCdevice *Device = alcGetContextsDevice(Context);
	alcMakeContextCurrent(NULL);
	alcDestroyContext(Context);
	alcCloseDevice(Device);
}
Ejemplo n.º 15
0
COpenALSound::~COpenALSound()
{
	for (int i = 0; i < maxSounds; i++) {
		alSourceStop(Sources[i]);
		alDeleteSources(1,&Sources[i]);
	}
	delete[] Sources;
	map<string, ALuint>::iterator it;
	for (it = soundMap.begin(); it != soundMap.end(); ++it) {
		alDeleteBuffers(1, &it->second);
	}
	ALCcontext *curcontext = alcGetCurrentContext();
	ALCdevice *curdevice = alcGetContextsDevice(curcontext);
	alcSuspendContext(curcontext);
	/*
	 * FIXME
	 * Technically you're supposed to detach and destroy the
	 * current context with these two lines, but it deadlocks.
	 * As a not-quite-as-clean shortcut, if we skip this step
	 * and just close the device, OpenAL theoretically
	 * destroys the context associated with that device.
	 *
	 * alcMakeContextCurrent(NULL);
	 * alcDestroyContext(curcontext);
	 */
	/*
	 * FIXME
	 * Technically you're supposed to close the device, but
	 * the OpenAL sound thread crashes if we do this manually.
	 * The device seems to be closed automagically anyway.
	 *
	 *  alcCloseDevice(curdevice);
	 */
}
Ejemplo n.º 16
0
ALboolean
_alutSanityCheck (void)
{
  ALCcontext *context;

  if (initialisationState == Unintialized)
    {
      _alutSetError (ALUT_ERROR_INVALID_OPERATION);
      return AL_FALSE;
    }

  context = alcGetCurrentContext ();
  if (context == NULL)
    {
      _alutSetError (ALUT_ERROR_NO_CURRENT_CONTEXT);
      return AL_FALSE;
    }

  if (alGetError () != AL_NO_ERROR)
    {
      _alutSetError (ALUT_ERROR_AL_ERROR_ON_ENTRY);
      return AL_FALSE;
    }

  if (alcGetError (alcGetContextsDevice (context)) != ALC_NO_ERROR)
    {
      _alutSetError (ALUT_ERROR_ALC_ERROR_ON_ENTRY);
      return AL_FALSE;
    }

  return AL_TRUE;
}
Ejemplo n.º 17
0
void HGE_Impl::_SoundDone()
{
	CStreamList *stmItem=streams, *stmNext;

	if(hOpenAL)
	{
		for (int i = 0; i < sidcount; i++)
			alSourceStop(sids[i]);
		alDeleteSources(sidcount, sids);
		sidcount = 0;
		memset(sids, '\0', sizeof (sids));

		ALCcontext *ctx = alcGetCurrentContext();
		ALCdevice *dev = alcGetContextsDevice(ctx);
		alcMakeContextCurrent(NULL);
		alcSuspendContext(ctx);
		alcDestroyContext(ctx);
		alcCloseDevice(dev);

		hOpenAL=0;

		while(stmItem)
		{
			stmNext=stmItem->next;
			Resource_Free(stmItem->data);
			delete stmItem;
			stmItem=stmNext;
		}
		streams=0;
	}
}
Ejemplo n.º 18
0
static void
printALCInfo (void)
{
  ALCint major, minor;
  ALCdevice *device;

  if (alcIsExtensionPresent (NULL, (const ALCchar *) "ALC_ENUMERATION_EXT") ==
      AL_TRUE)
    {
      printDevices (ALC_DEVICE_SPECIFIER, "");
      printDevices (ALC_CAPTURE_DEVICE_SPECIFIER, "capture ");
    }
  else
    {
      printf ("no device enumeration available\n");
    }

  device = alcGetContextsDevice (alcGetCurrentContext ());
  checkForErrors ();

  printf ("default device: %s\n",
          getStringALC (device, ALC_DEFAULT_DEVICE_SPECIFIER));

  printf ("default capture device: %s\n",
          getStringALC (device, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));

  alcGetIntegerv (device, ALC_MAJOR_VERSION, 1, &major);
  alcGetIntegerv (device, ALC_MAJOR_VERSION, 1, &minor);
  checkForErrors ();
  printf ("ALC version: %d.%d\n", (int) major, (int) minor);

  printExtensions ("ALC extensions", ' ',
                   getStringALC (device, ALC_EXTENSIONS));
}
Ejemplo n.º 19
0
ALboolean QOpenALEngine::ALFWIsEFXSupported()
{
    ALCdevice *pDevice = NULL;
    ALCcontext *pContext = NULL;
    ALboolean bEFXSupport = AL_FALSE;

    pContext = alcGetCurrentContext();
    pDevice = alcGetContextsDevice(pContext);

    if (alcIsExtensionPresent(pDevice, (ALCchar*)ALC_EXT_EFX_NAME))
    {
        // Get function pointers
        alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects");
        alDeleteEffects = (LPALDELETEEFFECTS )alGetProcAddress("alDeleteEffects");
        alIsEffect = (LPALISEFFECT )alGetProcAddress("alIsEffect");
        alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti");
        alEffectiv = (LPALEFFECTIV)alGetProcAddress("alEffectiv");
        alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf");
        alEffectfv = (LPALEFFECTFV)alGetProcAddress("alEffectfv");
        alGetEffecti = (LPALGETEFFECTI)alGetProcAddress("alGetEffecti");
        alGetEffectiv = (LPALGETEFFECTIV)alGetProcAddress("alGetEffectiv");
        alGetEffectf = (LPALGETEFFECTF)alGetProcAddress("alGetEffectf");
        alGetEffectfv = (LPALGETEFFECTFV)alGetProcAddress("alGetEffectfv");
        alGenFilters = (LPALGENFILTERS)alGetProcAddress("alGenFilters");
        alDeleteFilters = (LPALDELETEFILTERS)alGetProcAddress("alDeleteFilters");
        alIsFilter = (LPALISFILTER)alGetProcAddress("alIsFilter");
        alFilteri = (LPALFILTERI)alGetProcAddress("alFilteri");
        alFilteriv = (LPALFILTERIV)alGetProcAddress("alFilteriv");
        alFilterf = (LPALFILTERF)alGetProcAddress("alFilterf");
        alFilterfv = (LPALFILTERFV)alGetProcAddress("alFilterfv");
        alGetFilteri = (LPALGETFILTERI )alGetProcAddress("alGetFilteri");
        alGetFilteriv= (LPALGETFILTERIV )alGetProcAddress("alGetFilteriv");
        alGetFilterf = (LPALGETFILTERF )alGetProcAddress("alGetFilterf");
        alGetFilterfv= (LPALGETFILTERFV )alGetProcAddress("alGetFilterfv");
        alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress("alGenAuxiliaryEffectSlots");
        alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots");
        alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)alGetProcAddress("alIsAuxiliaryEffectSlot");
        alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti");
        alAuxiliaryEffectSlotiv = (LPALAUXILIARYEFFECTSLOTIV)alGetProcAddress("alAuxiliaryEffectSlotiv");
        alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)alGetProcAddress("alAuxiliaryEffectSlotf");
        alAuxiliaryEffectSlotfv = (LPALAUXILIARYEFFECTSLOTFV)alGetProcAddress("alAuxiliaryEffectSlotfv");
        alGetAuxiliaryEffectSloti = (LPALGETAUXILIARYEFFECTSLOTI)alGetProcAddress("alGetAuxiliaryEffectSloti");
        alGetAuxiliaryEffectSlotiv = (LPALGETAUXILIARYEFFECTSLOTIV)alGetProcAddress("alGetAuxiliaryEffectSlotiv");
        alGetAuxiliaryEffectSlotf = (LPALGETAUXILIARYEFFECTSLOTF)alGetProcAddress("alGetAuxiliaryEffectSlotf");
        alGetAuxiliaryEffectSlotfv = (LPALGETAUXILIARYEFFECTSLOTFV)alGetProcAddress("alGetAuxiliaryEffectSlotfv");

        if (alGenEffects &&	alDeleteEffects && alIsEffect && alEffecti && alEffectiv &&	alEffectf &&
                alEffectfv && alGetEffecti && alGetEffectiv && alGetEffectf && alGetEffectfv &&	alGenFilters &&
                alDeleteFilters && alIsFilter && alFilteri && alFilteriv &&	alFilterf && alFilterfv &&
                alGetFilteri &&	alGetFilteriv && alGetFilterf && alGetFilterfv && alGenAuxiliaryEffectSlots &&
                alDeleteAuxiliaryEffectSlots &&	alIsAuxiliaryEffectSlot && alAuxiliaryEffectSloti &&
                alAuxiliaryEffectSlotiv && alAuxiliaryEffectSlotf && alAuxiliaryEffectSlotfv &&
                alGetAuxiliaryEffectSloti && alGetAuxiliaryEffectSlotiv && alGetAuxiliaryEffectSlotf &&
                alGetAuxiliaryEffectSlotfv)
            bEFXSupport = AL_TRUE;
    }

    return bEFXSupport;
}
Ejemplo n.º 20
0
	void Audio::Cleanup()
	{
		ALCcontext *alcContext = alcGetCurrentContext();
		ALCdevice *alcDevice = alcGetContextsDevice(alcContext);
		alcMakeContextCurrent(NULL);
		alcDestroyContext(alcContext);
		alcCloseDevice(alcDevice);
	}
Ejemplo n.º 21
0
void ShutdownOpenAL(void) {
    ALCcontext *Context = alcGetCurrentContext();
    ALCdevice *Device = alcGetContextsDevice(Context);

    alcMakeContextCurrent(NULL);
    alcDestroyContext(Context);
    alcCloseDevice(Device);
}
Ejemplo n.º 22
0
void OpenALThread::Quit()
{
	m_context = alcGetCurrentContext();
	m_device = alcGetContextsDevice(m_context);
	alcMakeContextCurrent(nullptr);
	alcDestroyContext(m_context);
	alcCloseDevice(m_device);
}
 /**
  * Destroy the context and close the device.
  */
 ~OpenAlEngine() {
     LOG_FUNCTION
     ALCcontext* context = alcGetCurrentContext();
     ALCdevice* device = alcGetContextsDevice(context);
     alcMakeContextCurrent(NULL);
     alcDestroyContext(context);
     alcCloseDevice(device);
 }
Ejemplo n.º 24
0
MALContext::~MALContext(void)
{
    M_PROFILE_SCOPE(MALContext::~MALContext);
    ALCcontext * context = alcGetCurrentContext();
    ALCdevice * device = alcGetContextsDevice(context);

    alcMakeContextCurrent(NULL);
    alcDestroyContext(context);
    alcCloseDevice(device);
}
Ejemplo n.º 25
0
void exit_al() {
    ALCdevice *dev = NULL;
    ALCcontext *ctx = NULL;
    ctx = alcGetCurrentContext();
    dev = alcGetContextsDevice(ctx);

    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(dev);
}
Ejemplo n.º 26
0
// close audio device
static void uninit(struct ao *ao)
{
    ALCcontext *ctx = alcGetCurrentContext();
    ALCdevice *dev = alcGetContextsDevice(ctx);
    reset(ao);
    alcMakeContextCurrent(NULL);
    alcDestroyContext(ctx);
    alcCloseDevice(dev);
    ao_data = NULL;
}
Ejemplo n.º 27
0
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);
}
Ejemplo n.º 28
0
void
stop_al(void)
{
    ALCcontext* world = alcGetCurrentContext();
    ALCdevice* output = alcGetContextsDevice(world);
    
    alcMakeContextCurrent(NULL);
    alcDestroyContext(world);
    alcCloseDevice(output);

    return;
}
Ejemplo n.º 29
0
	OALAudioEngine::~OALAudioEngine()
	{
		audio_buffs_.clear();

		ALCcontext* context = alcGetCurrentContext();
		ALCdevice* device = alcGetContextsDevice(context);

		alcMakeContextCurrent(0);

		alcDestroyContext(context);
		alcCloseDevice(device);
	}
Ejemplo n.º 30
0
 void __alexit()
 {
     ALCcontext *context;
     ALCdevice *device;
     
     context = alcGetCurrentContext();
     device = alcGetContextsDevice(context);
     
     alcMakeContextCurrent(NULL);
     alcDestroyContext(context);
     alcCloseDevice(device);
 }