Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Alvaro

Pages: [1]
1
Audio / Re: AW: Delay when using sf::Sound
« on: November 01, 2013, 12:27:03 pm »
With delay I assume you mean that it takes a bit when pressing space for thd sound to start?
Yes.

Quote
I further assume that you've already made sure it's not the event propagation that's delayed, right?
Yes, my full code has visual feedback and that works just fine.

Quote
Again to clearify the issue only exists in the VM?
Yes.

Quote
Did you run other sound applications in there, my first guess would go to your VM lagging behind somehow...
Rats! I thought I had checked this, but I just checked again, and there's my delay. Sorry for wasting everybody's time. [Walks away in shame]

I looked around the web for reports of delays in Ubuntu and found that removing PulseAudio fixes my problem.

Thank you all for your time.


2
Audio / Re: Delay when using sf::Sound
« on: November 01, 2013, 02:42:15 am »
Here it goes. I removed most of what was unrelated to the problem, and I verified that the problem is still there.

#include <iostream>
#include <cstdlib>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>

int main() {
  sf::Window window;
  window.create(sf::VideoMode(800,600), "SFML Audio Test");
 
  // Load sound data
  sf::SoundBuffer sample_sb;
  if (!sample_sb.loadFromFile("sfx/Sample.wav")) {
    std::cerr << "Can't open \"sfx/Sample.wav\"\n";
    std::exit(1);
  }
  sf::Sound sound;
  sound.setBuffer(sample_sb);
 
  while (window.isOpen()) {
    // Process events
    sf::Event event;
    while (window.pollEvent(event)) {
      switch (event.type) {
      case sf::Event::Closed:
        window.close();
        break;
      case sf::Event::KeyPressed:
        switch (event.key.code) {
        case sf::Keyboard::Escape:
          window.close();
          break;
        case sf::Keyboard::Space:
          sound.play();
        default:;
        }
        break;
      default:;
      }
    }
  }
}
 

3
Audio / Re: Delay when using sf::Sound
« on: October 31, 2013, 08:41:27 pm »
True that. I'll make a minimal program that shows the problem and post it here.

4
Audio / Delay when using sf::Sound
« on: October 31, 2013, 07:28:37 pm »
Hi,

I am getting a large delay (about 0.2 seconds) when trying to play a sound using sf::Sound.

I am using SFML 2.1 with Ubuntu 13.10 Linux in VirtualBox, with a MacBook Air running OSX 10.9 as the host. I tried installing XCode 5 and SFML 2.1 on the OSX directly and then there is no appreciable delay. I am pretty confident at this point that my program is correct (it's a simple test and I am a competent programmer, plus it works fine on OSX, as I just explained). So it must be something with the OpenAL driver in my Linux installation , or something of that sort (and this is the type of thing where I am not competent at all).

Does anyone have any ideas on how to fix this, or where to even begin to look? I will continue programming on OSX for the time being, but I really like programming on Linux much better, and it would be nice if SFML 2.1 could be used in my VirtualBox setup.

Thanks!


Pages: [1]