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

Author Topic: Bug when reading OGG files?  (Read 5054 times)

0 Members and 1 Guest are viewing this topic.

divineqn90

  • Newbie
  • *
  • Posts: 6
    • View Profile
Bug when reading OGG files?
« on: April 08, 2010, 04:02:10 am »
Hi,

Recently, I have updated to SFML 2.0. The sf::SoundBuffer works in SFML 1.5 and 1.6 with OGG files and WAV files. But, in 2.0, seems that it plays OGG files wrongly (feels like the sound is over amplified), but works fine with WAV files.

Just to make sure, this is my sound code.
Code: [Select]
struct Sound
{
sf::Sound *sound;
sf::SoundBuffer *buffer;
ByteArray data;
};

Sound sound;
Sound *sd = &sound;
Malloc(sd->buffer, sf::SoundBuffer);
if(!sd->buffer->LoadFromFile(file.GetFilePath()))
{
Free(sd->buffer); // Free
WriteLog3("Missing audio file: %@1", file.TrimFilePath());
return;
}

Malloc(sd->sound, sf::Sound);
mSoundList.push_back(sound);

// Play sound
sd->sound->SetBuffer(*sd->buffer);
sd->sound->SetVolume(mSoundVol);

if(Math.DistanceSq(pos, mEye) < 1)
{
// 2D
sd->sound->SetRelativeToListener(true);
sd->sound->SetPosition(0, 0, 0);
}
else
{
// 3D
sd->sound->SetPosition(pos.x, pos.y, pos.z);
}

sd->sound->SetMinDistance(mDistance);
sd->sound->SetAttenuation(mAttenuation);
sd->sound->Play();


In case you're wondering, Volume is 100, Distance is 1, Attenuation is 1. DistanceSq() is <1.

Am I doing anything wrong? Or is this a bug?

Cheers!

EDIT:
I reduced the OGG sound dB by a little bit in Audacity and the problem is solved. Seems that a max dB in OGG files would cause this problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Bug when reading OGG files?
« Reply #1 on: April 08, 2010, 08:03:53 am »
Hi

It's weird because SFML 2 uses the official ogg/vorbis decoder library, whereas SFML 1.x uses a library written from scratch. So when something's wrong, it is usually in SFML 1.x.
Laurent Gomila - SFML developer

intripoon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Bug when reading OGG files?
« Reply #2 on: September 27, 2010, 08:42:59 pm »
I just watned to say I experience the same problem. I reduced it to this simple code piece which just plays the music, not even 3d:

Code: [Select]

music.OpenFromFile(filename);
music.Play();


The corresponding ogg file is this: http://www.transmogrifier.de/temp/1-01Intro.ogg. You can hear a loud cracking directly during the first few seconds when the deep drums get hit. This cracking doesn't happen with various audio players I tried, for example foobar - only sfml2. (No idea about afml1 though, I started using sfml today and went for 2 directly)

fieryrage

  • Newbie
  • *
  • Posts: 2
    • View Profile
Bug when reading OGG files?
« Reply #3 on: January 28, 2011, 02:25:44 pm »
I am also experiencing the same problem. Certain ogg's have loud static/noise when played. Switching back to sfml 1.6 seems to fix the problem...

Matogel

  • Newbie
  • *
  • Posts: 3
    • View Profile
Bug when reading OGG files?
« Reply #4 on: October 12, 2011, 06:55:23 am »
Quote from: "fieryrage"
I am also experiencing the same problem. Certain ogg's have loud static/noise when played. Switching back to sfml 1.6 seems to fix the problem...


Thanks for the info. I had the same problem before. I found this post used your recommendations. The static is gone now.

intripoon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Bug when reading OGG files?
« Reply #5 on: September 22, 2012, 09:44:50 pm »
I just tried sfml 2.0 rc and the problem is still there.

In case you want to investigate this, I uploaded a wrongly played file here http://www.transmogrifier.de/temp/1-01Intro.ogg.

I'ld really like this to be fixed :/

 

anything