本文整理汇总了C++中StreamContext::stream_data方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamContext::stream_data方法的具体用法?C++ StreamContext::stream_data怎么用?C++ StreamContext::stream_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamContext
的用法示例。
在下文中一共展示了StreamContext::stream_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: yield
void OpenALAudio::yield()
{
/* FIXME: This object causes a frame flip. Looks like a hack that could
* use some fixing.
*/
VgaFrontLock vgaLock;
StreamMap::iterator si;
for (si = this->streams.begin(); si != this->streams.end();)
{
ALint state;
StreamContext *sc;
sc = si->second;
if (sc->stream_data())
{
++si;
continue;
}
alGetSourcei(sc->source, AL_SOURCE_STATE, &state);
if (state == AL_STOPPED)
{
delete sc;
this->streams.erase(si++);
continue;
}
++si;
}
}
示例2: play_long_wav
/*
* in - wav file stream to play. Claims ownership and will delete it.
* vol - volume/panning
*
* return: 1 on success, 0 on failure
*/
int OpenALAudio::play_long_wav(InputStream *in, const DsVolume &vol)
{
const int BUFFER_COUNT = 4;
StreamContext *sc = NULL;
WavStream *ws = NULL;
int id;
assert(this->wav_init_flag);
ws = new WavStream;
if (!ws->open(in))
{
delete in;
goto err;
}
sc = new StreamContext;
if (!sc->init(ws))
goto err;
set_source_panning(sc->source, vol.ds_pan);
set_source_volume(sc->source, vol.ds_vol + this->wav_volume);
if (!check_al())
goto err;
sc->stream_data(BUFFER_COUNT);
id = unused_key(&this->streams);
this->streams[id] = sc;
return id;
err:
delete sc;
delete ws;
return 0;
}