本文整理汇总了C++中Memory::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Memory::GetSize方法的具体用法?C++ Memory::GetSize怎么用?C++ Memory::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memory
的用法示例。
在下文中一共展示了Memory::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
bool StreamedInstance::Update()
{
if (mState != State::Playing) return false;
int queued;
alGetSourcei(mSource, AL_BUFFERS_QUEUED, &queued);
ASSERT(alGetError() == 0, "AL error occured");
if (queued)
{
int processed;
alGetSourcei(mSource, AL_BUFFERS_PROCESSED, &processed);
ASSERT(alGetError() == 0, "AL error occured");
while (processed--)
{
uint processedBuffer;
alSourceUnqueueBuffers(mSource, 1, &processedBuffer);
ASSERT(alGetError() == 0, "AL error occured");
if (((StreamedSound*)mSound)->GetAudioData()->IsEOF() && mRepeat)
{
((StreamedSound*)mSound)->GetAudioData()->Reset();
}
if (!((StreamedSound*)mSound)->GetAudioData()->IsEOF())
{
Memory dataOut;
ALenum format = (((StreamedSound*)mSound)->GetAudioData()->GetChannels() == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
((StreamedSound*)mSound)->GetAudioData()->Decode(dataOut);
alBufferData(processedBuffer, format, dataOut.GetBuffer(), dataOut.GetSize(), ((StreamedSound*)mSound)->GetAudioData()->GetRate());
ASSERT(alGetError() == 0, "AL error occured");
alSourceQueueBuffers(mSource, 1, &processedBuffer);
ASSERT(alGetError() == 0, "AL error occured");
}
}
int streamState;
alGetSourcei(mSource, AL_SOURCE_STATE, &streamState);
if (streamState == AL_STOPPED)
{
alSourcePlay(mSource);
}
return true;
}
else
{
// Load the buffers with initial data in case the sound is to be played again.
Init();
mState = State::Stopped;
mActiveInstancesEntry = NULL;
return false;
}
}
示例2: Init
void StreamedInstance::Init()
{
Memory dataOut;
ALenum format = (((StreamedSound*)mSound)->GetAudioData()->GetChannels() == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
alSourcei(mSource, AL_BUFFER, 0);
ASSERT(alGetError() == 0, "AL error occured");
((StreamedSound*)mSound)->GetAudioData()->Reset();
((StreamedSound*)mSound)->GetAudioData()->Decode(dataOut);
alBufferData(mBuffers[0], format, dataOut.GetBuffer(), dataOut.GetSize(), ((StreamedSound*)mSound)->GetAudioData()->GetRate());
ASSERT(alGetError() == 0, "AL error occured");
((StreamedSound*)mSound)->GetAudioData()->Decode(dataOut);
alBufferData(mBuffers[1], format, dataOut.GetBuffer(), dataOut.GetSize(), ((StreamedSound*)mSound)->GetAudioData()->GetRate());
ASSERT(alGetError() == 0, "AL error occured");
alSourceQueueBuffers(mSource, 2, mBuffers);
ASSERT(alGetError() == 0, "AL error occured");
}