예제 #1
0
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;
}
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;
}