本文整理汇总了C++中checkALError函数的典型用法代码示例。如果您正苦于以下问题:C++ checkALError函数的具体用法?C++ checkALError怎么用?C++ checkALError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkALError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: preloadEffect
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop)
{
// Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
EffectsMap::iterator iter = s_effects.find(fullPath);
if (iter == s_effects.end())
{
preloadEffect(fullPath.c_str());
// let's try again
iter = s_effects.find(fullPath);
if (iter == s_effects.end())
{
fprintf(stderr, "could not find play sound %s\n", fullPath.c_str());
return -1;
}
}
checkALError("playEffect");
iter->second->isLooped = bLoop;
alSourcei(iter->second->source, AL_LOOPING, iter->second->isLooped ? AL_TRUE : AL_FALSE);
alSourcePlay(iter->second->source);
checkALError("playEffect");
return iter->second->source;
}
开发者ID:Prios,项目名称:panda2,代码行数:28,代码来源:SimpleAudioEngine.cpp
示例2: preloadEffect
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop)
{
EffectsMap::iterator iter = s_effects.find(pszFilePath);
if (iter == s_effects.end())
{
preloadEffect(pszFilePath);
// let's try again
iter = s_effects.find(pszFilePath);
if (iter == s_effects.end())
{
fprintf(stderr, "could not find play sound %s\n", pszFilePath);
return -1;
}
}
checkALError("playEffect");
iter->second->isLooped = bLoop;
alSourcei(iter->second->source, AL_LOOPING, iter->second->isLooped ? AL_TRUE : AL_FALSE);
alSourcePlay(iter->second->source);
checkALError("playEffect");
return iter->second->source;
}
开发者ID:JayKingston,项目名称:StupidTest,代码行数:25,代码来源:SimpleAudioEngine.cpp
示例3: stopBackground
static void stopBackground(bool bReleaseData)
{
// The background music might have been already stopped
// Stop request can come from
// - stopBackgroundMusic(..)
// - end(..)
if (s_backgroundSource != AL_NONE)
alSourceStop(s_backgroundSource);
if (bReleaseData)
{
for (auto it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it)
{
if (it->second->source == s_backgroundSource)
{
alDeleteSources(1, &it->second->source);
checkALError("stopBackground:alDeleteSources");
alDeleteBuffers(1, &it->second->buffer);
checkALError("stopBackground:alDeleteBuffers");
delete it->second;
s_backgroundMusics.erase(it);
break;
}
}
}
s_backgroundSource = AL_NONE;
}
开发者ID:skatpgusskat,项目名称:December,代码行数:28,代码来源:SimpleAudioEngineOpenAL.cpp
示例4: alGenBuffers
void LLAudioEngine_OpenAL::initWind()
{
if (true)
return;
llinfos << "initWind() start" << llendl;
alGenBuffers(mNumWindBuffers,mWindBuffers);
alGenSources(1,&mWindSource);
checkALError();
// ok lets make a wind buffer now
for(int counter=0;counter<mNumWindBuffers;counter++)
{
alBufferData(mWindBuffers[counter],AL_FORMAT_STEREO16,windDSP((void*)mWindData,mWindDataSize/mBytesPerSample),mWindDataSize,mSampleRate);
checkALError();
}
alSourceQueueBuffers(mWindSource, mNumWindBuffers, mWindBuffers);
checkALError();
alSourcePlay(mWindSource);
checkALError();
llinfos << "LLAudioEngine_OpenAL::initWind() done" << llendl;
}
开发者ID:OS-Development,项目名称:VW.Meerkat,代码行数:29,代码来源:audioengine_openal.cpp
示例5: alSourcefv
OPAL_SOUND_MGR bool SoundManager::setSoundPosition( unsigned int audioID, Vector3 position,
Vector3 velocity, Vector3 direction )
{
if ( audioID >= MAX_AUDIO_SOURCES || !mAudioSourceInUse[ audioID ] )
return false;
// Set the position
ALfloat pos[] = { position.x, position.y, position.z };
alSourcefv( mAudioSources[ audioID ], AL_POSITION, pos );
if ( checkALError( "setSound::alSourcefv:AL_POSITION" ) )
return false;
// Set the veclocity
ALfloat vel[] = { velocity.x, velocity.y, velocity.z };
alSourcefv( mAudioSources[ audioID ], AL_VELOCITY, vel );
if ( checkALError( "setSound::alSourcefv:AL_VELOCITY" ) )
return false;
// Set the direction
ALfloat dir[] = { velocity.x, velocity.y, velocity.z };
alSourcefv( mAudioSources[ audioID ], AL_DIRECTION, dir );
if ( checkALError( "setSound::alSourcefv:AL_DIRECTION" ) )
return false;
return true;
}
开发者ID:xuyunhan,项目名称:Dancing,代码行数:32,代码来源:libOpenAl.cpp
示例6: checkALError
void SimpleAudioEngine::stopAllEffects()
{
EffectsMap::iterator iter = s_effects.begin();
if (iter != s_effects.end())
{
checkALError("stopAllEffects:init");
alSourceStop(iter->second->source);
checkALError("stopAllEffects:alSourceStop");
}
}
开发者ID:skatpgusskat,项目名称:December,代码行数:11,代码来源:SimpleAudioEngineOpenAL.cpp
示例7: checkALError
void SimpleAudioEngine::resumeAllEffects()
{
EffectsMap::iterator iter = s_effects.begin();
if (iter != s_effects.end())
{
checkALError("resumeAllEffects");
alSourcePlay(iter->second->source);
checkALError("resumeAllEffects");
}
}
开发者ID:JayKingston,项目名称:StupidTest,代码行数:11,代码来源:SimpleAudioEngine.cpp
示例8: checkALError
void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
{
// Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
EffectsMap::iterator iter = s_effects.find(fullPath);
// check if we have this already
if (iter == s_effects.end())
{
ALuint buffer;
ALuint source;
soundData *data = new soundData;
string path = fullPath;
checkALError("preloadEffect");
if (isOGGFile(path.data()))
{
buffer = createBufferFromOGG(path.data());
}
else
{
buffer = alutCreateBufferFromFile(path.data());
checkALError("preloadEffect");
}
if (buffer == AL_NONE)
{
fprintf(stderr, "Error loading file: '%s'\n", path.data());
alDeleteBuffers(1, &buffer);
return;
}
alGenSources(1, &source);
if (checkALError("preloadEffect") != AL_NO_ERROR)
{
alDeleteBuffers(1, &buffer);
return;
}
alSourcei(source, AL_BUFFER, buffer);
checkALError("preloadEffect");
data->isLooped = false;
data->buffer = buffer;
data->source = source;
s_effects.insert(EffectsMap::value_type(fullPath, data));
}
}
开发者ID:Prios,项目名称:panda2,代码行数:52,代码来源:SimpleAudioEngine.cpp
示例9: stopBackground
static void stopBackground(bool bReleaseData)
{
alSourceStop(s_backgroundSource);
if (bReleaseData)
{
s_currentBackgroundStr = "";
s_isBackgroundInitialized = false;
alDeleteBuffers(1, &s_backgroundBuffer);
checkALError("stopBackground");
alDeleteSources(1, &s_backgroundSource);
checkALError("stopBackground");
}
}
开发者ID:JayKingston,项目名称:StupidTest,代码行数:15,代码来源:SimpleAudioEngine.cpp
示例10: gst_openal_sink_unprepare
static gboolean
gst_openal_sink_unprepare (GstAudioSink * asink)
{
GstOpenALSink *openal = GST_OPENAL_SINK (asink);
ALCcontext *old;
if (!openal->context)
return TRUE;
old = pushContext (openal->context);
alSourceStop (openal->sID);
alSourcei (openal->sID, AL_BUFFER, 0);
if (!openal->custom_sID)
alDeleteSources (1, &openal->sID);
openal->sID = 0;
alDeleteBuffers (openal->bID_count, openal->bIDs);
g_free (openal->bIDs);
openal->bIDs = NULL;
openal->bID_idx = 0;
openal->bID_count = 0;
openal->bID_length = 0;
checkALError ();
popContext (old, openal->context);
if (!openal->custom_ctx)
alcDestroyContext (openal->context);
openal->context = NULL;
return TRUE;
}
开发者ID:kanongil,项目名称:gst-plugins-bad,代码行数:33,代码来源:gstopenalsink.c
示例11: stopBackgroundMusic
void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{
// If there is already a background music source we stop it first
if (s_backgroundSource != AL_NONE)
stopBackgroundMusic(false);
// Changing file path to full path
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(pszFilePath);
BackgroundMusicsMap::const_iterator it = s_backgroundMusics.find(fullPath);
if (it == s_backgroundMusics.end())
{
preloadBackgroundMusic(fullPath.c_str());
it = s_backgroundMusics.find(fullPath);
}
if (it != s_backgroundMusics.end())
{
s_backgroundSource = it->second->source;
alSourcei(s_backgroundSource, AL_LOOPING, bLoop ? AL_TRUE : AL_FALSE);
setBackgroundVolume(s_volume);
alSourcePlay(s_backgroundSource);
checkALError("playBackgroundMusic:alSourcePlay");
}
}
开发者ID:skatpgusskat,项目名称:December,代码行数:25,代码来源:SimpleAudioEngineOpenAL.cpp
示例12: alGetError
OPAL_SOUND_MGR bool SoundManager::resumeAllAudio( void )
{
if ( mAudioSourcesInUseCount >= MAX_AUDIO_SOURCES )
return false;
alGetError();
int sourceAudioState = 0;
for ( int i=0; i<mAudioSourcesInUseCount; i++ )
{
// Are we currently playing the audio source?
alGetSourcei( mAudioSources[i], AL_SOURCE_STATE, &sourceAudioState );
if ( sourceAudioState == AL_PAUSED )
{
resumeAudio( i );
}
}
if ( checkALError( "resumeAllAudio::alSourceStop ") )
return false;
return true;
}
开发者ID:xuyunhan,项目名称:Dancing,代码行数:25,代码来源:libOpenAl.cpp
示例13: gst_openal_sink_delay
static guint
gst_openal_sink_delay (GstAudioSink * asink)
{
GstOpenALSink *openal = GST_OPENAL_SINK (asink);
ALint queued, state, offset, delay;
ALCcontext *old;
if (!openal->context)
return 0;
GST_OPENAL_SINK_LOCK (openal);
old = pushContext (openal->context);
delay = 0;
alGetSourcei (openal->sID, AL_BUFFERS_QUEUED, &queued);
/* Order here is important. If the offset is queried after the state and an
* underrun occurs in between the two calls, it can end up with a 0 offset
* in a playing state, incorrectly reporting a len*queued/bps delay. */
alGetSourcei (openal->sID, AL_BYTE_OFFSET, &offset);
alGetSourcei (openal->sID, AL_SOURCE_STATE, &state);
/* Note: state=stopped is an underrun, meaning all buffers are processed
* and there's no delay when writing the next buffer. Pre-buffering is
* state=initial, which will introduce a delay while writing. */
if (checkALError () == AL_NO_ERROR && state != AL_STOPPED)
delay = ((queued * openal->bID_length) - offset) / openal->bytes_per_sample;
popContext (old, openal->context);
GST_OPENAL_SINK_UNLOCK (openal);
return delay;
}
开发者ID:kanongil,项目名称:gst-plugins-bad,代码行数:32,代码来源:gstopenalsink.c
示例14: gst_openal_sink_unprepare
static gboolean
gst_openal_sink_unprepare (GstAudioSink * audiosink)
{
GstOpenALSink *sink = GST_OPENAL_SINK (audiosink);
ALCcontext *old;
if (!sink->default_context)
return TRUE;
old = pushContext (sink->default_context);
alSourceStop (sink->default_source);
alSourcei (sink->default_source, AL_BUFFER, 0);
if (!sink->user_source)
alDeleteSources (1, &sink->default_source);
sink->default_source = 0;
alDeleteBuffers (sink->buffer_count, sink->buffers);
g_free (sink->buffers);
sink->buffers = NULL;
sink->buffer_idx = 0;
sink->buffer_count = 0;
sink->buffer_length = 0;
checkALError ();
popContext (old, sink->default_context);
if (!sink->user_context)
alcDestroyContext (sink->default_context);
sink->default_context = NULL;
return TRUE;
}
开发者ID:jhgorse,项目名称:gst-plugins-bad,代码行数:33,代码来源:gstopenalsink.c
示例15: alGetSourcei
void SimpleAudioEngine::pauseBackgroundMusic()
{
ALint state;
alGetSourcei(s_backgroundSource, AL_SOURCE_STATE, &state);
if (state == AL_PLAYING)
alSourcePause(s_backgroundSource);
checkALError("pauseBackgroundMusic");
}
开发者ID:Prios,项目名称:panda2,代码行数:8,代码来源:SimpleAudioEngine.cpp
示例16: checkAndPrintALError
void checkAndPrintALError(const char *file, int line)
{
#ifdef _DEBUG
auto err = checkALError();
if (!err.empty())
base::glog << "OpenAL error:" << err << ". File:" << file << ". Line:" << line << base::logwarn;
#endif
}
开发者ID:selony,项目名称:libdf3d,代码行数:8,代码来源:OpenALCommon.cpp
示例17: alGetSourcei
void SimpleAudioEngine::pauseEffect(unsigned int nSoundId)
{
ALint state;
alGetSourcei(nSoundId, AL_SOURCE_STATE, &state);
if (state == AL_PLAYING)
alSourcePause(nSoundId);
checkALError("pauseEffect:alSourcePause");
}
开发者ID:skatpgusskat,项目名称:December,代码行数:8,代码来源:SimpleAudioEngineOpenAL.cpp
示例18: checkALError
void SimpleAudioEngine::end()
{
checkALError("end");
// clear all the sounds
EffectsMap::const_iterator end = s_effects.end();
for (EffectsMap::iterator it = s_effects.begin(); it != end; it++)
{
alSourceStop(it->second->source);
checkALError("end");
alDeleteBuffers(1, &it->second->buffer);
checkALError("end");
alDeleteSources(1, &it->second->source);
checkALError("end");
delete it->second;
}
s_effects.clear();
// and the background too
stopBackground(true);
for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it)
{
alSourceStop(it->second->source);
checkALError("end");
alDeleteBuffers(1, &it->second->buffer);
checkALError("end");
alDeleteSources(1, &it->second->source);
checkALError("end");
delete it->second;
}
s_backgroundMusics.clear();
}
开发者ID:AleffHenrique,项目名称:cocos2d-x,代码行数:33,代码来源:SimpleAudioEngine.cpp
示例19: RemoveSound
void RemoveSound()
{
alSourceStop(source);
checkALError();
alDeleteSources(1, &source);
checkALError();
alDeleteBuffers(BUFFER_QUANTITY, buffers);
checkALError();
// Reset the current context to NULL.
alcMakeContextCurrent(NULL);
checkALCError();
// RELEASE the context and the device.
alcDestroyContext(pContext);
checkALCError();
alcCloseDevice(pDevice);
}
开发者ID:DAOWAce,项目名称:pcsxr,代码行数:18,代码来源:openal.c
示例20: preloadBackgroundMusic
void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{
if (!s_isBackgroundInitialized)
preloadBackgroundMusic(pszFilePath);
alSourcei(s_backgroundSource, AL_LOOPING, bLoop ? AL_TRUE : AL_FALSE);
alSourcePlay(s_backgroundSource);
checkALError("playBackgroundMusic");
}
开发者ID:JayKingston,项目名称:StupidTest,代码行数:9,代码来源:SimpleAudioEngine.cpp
注:本文中的checkALError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论