本文整理汇总了C++中yse::sound::getSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ sound::getSpeed方法的具体用法?C++ sound::getSpeed怎么用?C++ sound::getSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yse::sound
的用法示例。
在下文中一共展示了sound::getSpeed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
YSE::System().init();
// setting the last parameter to true will enable streaming
sound.create("pulse1.ogg", NULL, true, 1.0f, true);
if (!sound.isValid()) {
std::cout << "sound 'pulse1.ogg' not found" << std::endl;
std::cin.get();
goto exit;
}
std::cout << "Use q/a to change the sound speed up and down." << std::endl;
std::cout << "Use s/d/f to pause/stop/play." << std::endl;
std::cout << "...or e to exit." << std::endl;
sound.play();
while (true) {
if (_kbhit()) {
char ch = _getch();
switch (ch) {
case 'q': sound.setSpeed(sound.getSpeed() + 0.01); break;
case 'a': sound.setSpeed(sound.getSpeed() - 0.01); break;
case 's': sound.pause(); break;
case 'd': sound.stop(); break;
case 'f': sound.play(); break;
case 'e': goto exit;
}
}
YSE::System().sleep(100);
YSE::System().update();
}
exit:
YSE::System().close();
return 0;
}
示例2: main
int main() {
YSE::System().init();
sound.create("contact.ogg", NULL, true);
if (!sound.isValid()) {
std::cout << "sound 'contact.ogg' not found" << std::endl;
std::cin.get();
goto exit;
}
std::cout << "This shows how to alter basic sound properties." << std::endl;
std::cout << "Use q/a to change the sound speed up and down." << std::endl;
std::cout << "Use w/s to change the volume up and down." << std::endl;
std::cout << "...or e to exit." << std::endl;
sound.play();
while (true) {
if (_kbhit()) {
char ch = _getch();
switch (ch) {
case 'q': sound.setSpeed(sound.getSpeed() + 0.01f); break;
case 'a': sound.setSpeed(sound.getSpeed() - 0.01f); break;
case 's': sound.setVolume(sound.getVolume() - 0.1f); break;
case 'w': sound.setVolume(sound.getVolume() + 0.1f); break;
case 'e': goto exit;
}
}
YSE::System().sleep(100);
YSE::System().update();
}
exit:
YSE::System().close();
return 0;
}