当前位置: 首页>>代码示例>>C++>>正文


C++ alcGetContextsDevice函数代码示例

本文整理汇总了C++中alcGetContextsDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ alcGetContextsDevice函数的具体用法?C++ alcGetContextsDevice怎么用?C++ alcGetContextsDevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了alcGetContextsDevice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gst_openal_sink_open

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;
}
开发者ID:jhgorse,项目名称:gst-plugins-bad,代码行数:25,代码来源:gstopenalsink.c

示例2: gst_openal_sink_open

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;
}
开发者ID:kanongil,项目名称:gst-plugins-bad,代码行数:26,代码来源:gstopenalsink.c

示例3: lime_alc_get_contexts_device

	value lime_alc_get_contexts_device (value context) {
		
		ALCcontext* alcContext = (ALCcontext*)val_data (context);
		ALCdevice* alcDevice = alcGetContextsDevice (alcContext);
		return CFFIPointer (alcDevice);
		
	}
开发者ID:Leander1P,项目名称:lime,代码行数:7,代码来源:OpenALBindings.cpp

示例4: lime_alc_get_contexts_device

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);

}
开发者ID:darkdarkdragon,项目名称:lime,代码行数:7,代码来源:OpenALBindings.cpp

示例5: alSourceStop

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);
}
开发者ID:jloehr,项目名称:dolphin,代码行数:25,代码来源:OpenALStream.cpp

示例6: checkForErrors

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));
      }
  }
}
开发者ID:JyothishM,项目名称:openal-svn-mirror,代码行数:26,代码来源:openal-info.c

示例7: alSourceStop

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);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:32,代码来源:OpenALSound.cpp

示例8: OPENAL_Close

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;
}
开发者ID:Vlakulor,项目名称:lugaru,代码行数:27,代码来源:openal_wrapper.cpp

示例9: alCleanUp

void alCleanUp(void){
	context = alcGetCurrentContext();
	device = alcGetContextsDevice(context);
	alcMakeContextCurrent(NULL);
	alcDestroyContext(context);
	alcCloseDevice(device);
}
开发者ID:CovertIII,项目名称:Tron-Clone,代码行数:7,代码来源:main_client.c

示例10: alcGetCurrentContext

	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 ) );
	}
开发者ID:Cnotinfor,项目名称:TopQX_Sound,代码行数:29,代码来源:capturethread.cpp

示例11: alcGetContextsDevice

// 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();
}
开发者ID:Nora28,项目名称:imprudence,代码行数:28,代码来源:audioengine_openal.cpp

示例12: _releaseALData

//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);
	
}
开发者ID:DarthMike,项目名称:Monkey-Madness,代码行数:35,代码来源:SoundManager.cpp

示例13: alDeleteSources

//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);
}
开发者ID:cs335fps,项目名称:p,代码行数:31,代码来源:lizandroP.cpp

示例14: alSourceStop

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);
	 */
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:34,代码来源:OpenALSound.cpp

示例15: _alutSanityCheck

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;
}
开发者ID:AlphaO,项目名称:Starfox,代码行数:32,代码来源:alutInit.c


注:本文中的alcGetContextsDevice函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。