本文整理汇总了C++中sf::Sound::setPitch方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::setPitch方法的具体用法?C++ Sound::setPitch怎么用?C++ Sound::setPitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Sound
的用法示例。
在下文中一共展示了Sound::setPitch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: width
Textbox::Textbox(std::map<std::string, sf::Sprite>& faceMap, const sf::Font& font, sf::Sound& bleep, int width_box, int height_box, bool block, int font_size, int padding) :
faceMap(faceMap), width(width_box), height(height_box), bleep(bleep), block_draw(block), padding(padding) {
displayText.setFont(font);
displayText.setCharacterSize(font_size);
displayText.setColor(sf::Color::White);
bleep.setPitch(2);
if (!block_draw)
{
faceSprite.setTextureRect(sf::IntRect(0, 0, faceSprite.getLocalBounds().width, faceSprite.getLocalBounds().height));
faceSprite.setOrigin(faceSprite.getLocalBounds().width*.5, faceSprite.getLocalBounds().height*.5);
faceSprite2.setTextureRect(sf::IntRect(0, 0, faceSprite2.getLocalBounds().width, faceSprite2.getLocalBounds().height));
faceSprite2.setOrigin(faceSprite2.getLocalBounds().width*.5, faceSprite2.getLocalBounds().height*.5);
rectText.setSize(sf::Vector2f(width - padding, height*.3));
rectText.setOrigin((width - padding)*.5, height*.5);
rectText.setFillColor(sf::Color::Black);
rectText.setOutlineColor(sf::Color::White);
rectText.setOutlineThickness(2);
actorName.setColor(sf::Color::Yellow);
actorName.setFont(font);
}
else {
rectText.setSize(sf::Vector2f(width, height));
rectText.setOrigin(width*.5, height*.5);
}
}
示例2: play_sound
void play_sound(sf::Sound& sound, const SoundSample& sample, const PlaybackProperties& properties, bool looped)
{
sound.setBuffer(sample);
sound.setPitch(properties.pitch);
sound.setAttenuation(properties.attenuation);
sound.setLoop(looped);
sound.setRelativeToListener(properties.relative_to_listener);
sound.setMinDistance(properties.min_distance);
sound.setVolume(properties.volume * 100.0f);
sound.play();
}