本文整理汇总了C++中AudioBuffer::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::Set方法的具体用法?C++ AudioBuffer::Set怎么用?C++ AudioBuffer::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Play
void kGUIAudio::Play(int rate,int channels,const unsigned char *sample,unsigned long samplesize,bool copy,bool loop)
{
AudioBuffer *ab;
// kGUI::Trace("Play:Lock (%s)\n",m_mutex.GetIsLocked()==true?"locked":"unlocked");
m_mutex.Lock();
if(m_playing==false)
{
// kGUI::Trace("Play:%08x, Not Playing, reset packets!\n",this);
m_playbuffer=0;
m_numbuffers=0;
}
m_rate=rate;
m_channels=channels;
m_loop=loop;
// kGUI::Trace("Play:%08x, Adding Packet, rate=%d,channels=%d,size=%d\n",this,rate,channels,samplesize);
/* can we append this packet to the last pending packet? */
if(copy && m_numbuffers>m_playbuffer)
{
ab=m_buffers.GetEntry(m_numbuffers-1);
ab->Append(samplesize,sample);
}
else
{
/* buffer sample data */
ab=m_manager->GetBuffer();
m_buffers.SetEntry(m_numbuffers,ab);
ab->Set(samplesize,sample,copy);
++m_numbuffers;
}
PlayBuffer();
m_mutex.UnLock();
}