本文整理汇总了C++中SoundData::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundData::getData方法的具体用法?C++ SoundData::getData怎么用?C++ SoundData::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundData
的用法示例。
在下文中一共展示了SoundData::getData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playAmbientSound
/**
* Play sound once.
* @param name sound name
* @param distance mag2 distance
*/
void SDLSound::playAmbientSound(const char* name, long distance)
{
SoundData *sdata = findChunk(name);
if (sdata)
{
if ( sdata->last_played.isTimeOut() )
{
int oldVolume = Mix_VolumeChunk(sdata->getData(), getSoundVolume(distance));
if (Mix_PlayChannel(-1, sdata->getData(), 0) == -1)
{
//LOG (("Couldn't play sound '%s': %s", name, Mix_GetError()));
}
Mix_VolumeChunk(sdata->getData(), oldVolume);
sdata->last_played.reset();
}
else
{
// LOGGER.debug("Skipped ambient sound '%s' due to timeout", name);
}
}
}
示例2: playSoundRepeatedly
/**
* Play sound repeatedly.
* @param name sound name
* @return the channel the sample is played on. On any errors, -1 is returned.
*/
int SDLSound::playSoundRepeatedly(const char* name)
{
int channel = -1;
SoundData *sdata = findChunk(name);
if (sdata) {
if ((channel = Mix_PlayChannel(-1, sdata->getData(), -1)) == -1) {
LOG (("Couldn't play sound '%s': %s", name, Mix_GetError()));
}
}
return channel;
}
示例3: playSound
/**
* Play sound once.
* @param name sound name
*/
void SDLSound::playSound(const char* name)
{
SoundData *sdata = findChunk(name);
if (sdata)
{
if ( sdata->last_played.isTimeOut() )
{
if (Mix_PlayChannel(-1, sdata->getData(), 0) == -1)
{
//LOG (("Couldn't play sound '%s': %s", name, Mix_GetError()));
}
sdata->last_played.reset();
}
else
{
// LOGGER.debug("Skipped sound '%s' due to timeout", name);
}
}
}