本文整理汇总了C++中SoundSource::getPitch方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundSource::getPitch方法的具体用法?C++ SoundSource::getPitch怎么用?C++ SoundSource::getPitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundSource
的用法示例。
在下文中一共展示了SoundSource::getPitch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPitch
SoundSource::SoundSource(const SoundSource& copy)
: m_channel(copy.m_channel)
{
setPitch(copy.getPitch());
setVolume(copy.getVolume());
setPosition(copy.getPosition());
setRelativeToListener(copy.isRelativeToListener());
setMinDistance(copy.getMinDistance());
setAttenuation(copy.getAttenuation());
}
示例2: alCheck
SoundSource::SoundSource(const SoundSource& copy)
{
alCheck(alGenSources(1, &m_source));
alCheck(alSourcei(m_source, AL_BUFFER, 0));
setPitch(copy.getPitch());
setVolume(copy.getVolume());
setPosition(copy.getPosition());
setRelativeToListener(copy.isRelativeToListener());
setMinDistance(copy.getMinDistance());
setAttenuation(copy.getAttenuation());
}
示例3: lock
void DeviceAudioDX11::tick (const DTfloat dt)
{
PROFILER(PROFILER_SOUND);
if (!_x_audio_2)
return;
DTfloat sound_on = castFromString<DTboolean>(Globals::getGlobal("SYS_SOUND")) ? 1.0F : 0.0F;
DTfloat sound_gain = Globals::hasGlobal("SYS_SOUND_GAIN") ? castFromString<DTfloat>(Globals::getGlobal("SYS_SOUND_GAIN")) : 1.0F;
_gain = sound_on * sound_gain;
//
// Update Camera
//
if (getCamera()) {
// Update Listener
Vector3 position = getCamera()->getTranslation();
Vector3 velocity = getCamera()->getVelocity();
Vector3 forward = getCamera()->getForwards();
Vector3 up = getCamera()->getUp();
_x3_listener.OrientFront = X3DAUDIO_VECTOR(forward.x,forward.y,forward.z);
_x3_listener.OrientTop = X3DAUDIO_VECTOR(up.x,up.y,up.z);
_x3_listener.Position = X3DAUDIO_VECTOR(position.x,position.y,position.z);
_x3_listener.Velocity = X3DAUDIO_VECTOR(velocity.x,velocity.y,velocity.z);
_x_master_voice->SetVolume(_gain);
} else {
_x3_listener.OrientFront = X3DAUDIO_VECTOR(0.0F,0.0F,-1.0F);
_x3_listener.OrientTop = X3DAUDIO_VECTOR(0.0F,1.0F,0.0F);
_x3_listener.Position = X3DAUDIO_VECTOR(0.0F,0.0F,0.0F);
_x3_listener.Velocity = X3DAUDIO_VECTOR(0.0F,0.0F,0.0F);
_x_master_voice->SetVolume(_gain);
}
//
// Update channels
//
for (DTuint c = 0; c < _channels.size(); ++c) {
DeviceAudioDX11Channel &channel = _channels[c];
SoundSource *source = channel._source;
// If there's a source and a sound then this channel is playing
if (source) {
SoundPacket &packet = channel._packets[channel._current_packet];
// Check to see if sound buffer was starved
if (!channel._ready_to_start && packet.getNumBytes() > 0 && !channel._is_playing) {
channel._ready_to_start = true;
LOG_MESSAGE << "Audio stream starved";
// Check if sound data has been depleted
} else if (!channel._ready_to_start && packet.getNumBytes() == 0 && !channel._is_playing) {
#if DT2_MULTITHREADED_AUDIO
AutoSpinLockRecursive lock(&_lock);
#endif
stopOnChannel(channel);
LOG_MESSAGE << "Audio stream done";
// Update sound
} else {
// Maybe channel needs to be started
if (channel._ready_to_start) {
#if DT2_MULTITHREADED_AUDIO
AutoSpinLockRecursive lock(&_lock);
#endif
// Fill buffers
if (channel._needs_priming)
primeStreaming (channel);
channel._is_playing = true;
channel._x_voice->Start();
channel._ready_to_start = false;
}
Vector3 position = source->getTranslation();
Vector3 velocity = source->getVelocity();
//DTboolean looping = source->Get_Looping(); // Instead we loop sounds ourselves
DTfloat pitch = source->getPitch();
DTfloat rolloff = source->getRolloff();
DTfloat gain = source->getGain();
// position sound
//.........这里部分代码省略.........