本文整理汇总了C++中StreamContext::init方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamContext::init方法的具体用法?C++ StreamContext::init怎么用?C++ StreamContext::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamContext
的用法示例。
在下文中一共展示了StreamContext::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}