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

Author Topic: [SOLVED] Problems with .setPitch  (Read 12217 times)

0 Members and 3 Guests are viewing this topic.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
[SOLVED] Problems with .setPitch
« on: July 01, 2014, 05:01:41 am »
This has been solved for my own errors although unsure of whether openal would cause anything else related.

Here's some code to test pitches (mine now works for all of these!):
#include <SFML/Audio.hpp>
#include <iostream>

int main()
{
        sf::SoundBuffer soundBuffer;
        if (!soundBuffer.loadFromFile("piano_a3.wav"))
                return -1;
        sf::Sound sound;
        sound.setBuffer(soundBuffer);
        for (float i{ 10 }; i <= 100; ++i)
        {
                std::cout << i << std::endl;
                sound.setPitch(i);
                sound.play();
                while (sound.getStatus() == sf::Sound::Playing) { }
        }
        return 0;
}


Here's the original post:
(click to show/hide)
« Last Edit: September 18, 2014, 04:01:20 am by Hapax »
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: Problems with .setPitch
« Reply #1 on: July 01, 2014, 12:00:27 pm »
Just did a preliminary test and I couldn't reproduce the crash (on Ubuntu 14.04) - everything worked as expected. Do you have a stack trace we can look at? It might be helpful if you attached the samples you used too.
« Last Edit: July 01, 2014, 12:02:45 pm by select_this »
Follow me on Twitter, why don'tcha? @select_this

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #2 on: July 01, 2014, 01:36:51 pm »
I forgot to mention that I'm using Visual Studio 2013 Express on Windows 7 64-bit. It suppose that it's possible that it could be Windows-related.

I've uploaded to Mediafire the exact sounds I used for this particular test.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problems with .setPitch
« Reply #3 on: July 01, 2014, 01:47:21 pm »
Are you sure that you're using the OpenAL32.dll file of the SFML SDK, and not another one that would be installed in a default path (like Windows/System)?
Laurent Gomila - SFML developer

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: Problems with .setPitch
« Reply #4 on: July 01, 2014, 01:51:11 pm »
I can confirm that none of your samples cause a crash on Linux, which does suggest your problem is pertaining to the platform-specific implementation.
« Last Edit: July 01, 2014, 01:52:45 pm by select_this »
Follow me on Twitter, why don'tcha? @select_this

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #5 on: July 01, 2014, 01:54:33 pm »
Are you sure that you're using the OpenAL32.dll file of the SFML SDK?
Yes. If I rename the openal32.dll file (from the SFML download) that is in the directory with the compiled program, it fails to run.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #6 on: July 01, 2014, 04:43:48 pm »
I can confirm that none of your samples cause a crash on Linux, which does suggest your problem is pertaining to the platform-specific implementation.
I could be only happening on my setup rather than all Windows setups so if someone could test those samples with Windows, it would be a lot of help.

Has this problem arisen before? My SFML build is a couple of months old (it was the latest GitHub version at the time) and I was wondering if it had been fixed since then.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #7 on: July 01, 2014, 05:54:23 pm »
The error that the debugger reports is:
Quote
Unhandled exception at 0x54382EB4 (openal32.dll) in PitchTest.exe: 0xC0000005: Access violation reading location 0x06C35000.

I downloaded a random sample and that particular sample does not cause these errors. I have even resaved the sample in the same format using the same software (Audacity) and it still doesn't cause the error. What does my openal32.dll have against these other samples?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems with .setPitch
« Reply #8 on: July 01, 2014, 08:07:52 pm »
Just a few random guesses/sugestions that could perhaps bring you closer to figuring out what goes wrong:

- build SFML and openal yourself as debug builds. If you are lucky then sanity checks (asserts, range checks etc) in one of the libraries may trigger and provide a hint.

- do a build with a different compiler (like GCC) to perhaps get a different crash/stack trace with more/different details.

- do a GCC build with 'address sanitizer' enabled and hope that it catches something at runtime.

- do a build on Linux and run the executable through Valgrind and see if it reports anything.

- do a build of openal & SFML through 'clang analyze' and see if any of the stuff it reports looks relevant to your crash.

- ask on the openal mailing list if they have any ideas.

That's what I can come up with for now and is probably what I'd do in your situation. I hope it helps :)

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #9 on: July 01, 2014, 08:27:33 pm »
- build SFML and openal yourself as debug builds. If you are lucky then sanity checks (asserts, range checks etc) in one of the libraries may trigger and provide a hint.

- do a build with a different compiler (like GCC) to perhaps get a different crash/stack trace with more/different details.

- do a GCC build with 'address sanitizer' enabled and hope that it catches something at runtime.

- do a build on Linux and run the executable through Valgrind and see if it reports anything.

- do a build of openal & SFML through 'clang analyze' and see if any of the stuff it reports looks relevant to your crash.

- ask on the openal mailing list if they have any ideas.
This is all way beyond my skill level. Building SFML myself was difficult enough and I don't think even that went perfectly.

Do you have a stack trace we can look at?
Call Stack at time of debugger break:
>   openal32.dll!54b92eb4()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for openal32.dll]   
    openal32.dll!54b912c1()   Unknown
    openal32.dll!54b8911e()   Unknown
    openal32.dll!54b937e6()   Unknown
    openal32.dll!54b8d1ec()   Unknown
    [External Code]   
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems with .setPitch
« Reply #10 on: July 01, 2014, 08:36:18 pm »
Quote
Do you have a stack trace we can look at?
Call Stack at time of debugger break:
>   openal32.dll!54b92eb4()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for openal32.dll]   
    openal32.dll!54b912c1()   Unknown
    openal32.dll!54b8911e()   Unknown
    openal32.dll!54b937e6()   Unknown
    openal32.dll!54b8d1ec()   Unknown
    [External Code]
This would be a lot more useful if OpenAL, SFML & your app had been built with debug symbols ;)

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #11 on: July 01, 2014, 08:39:20 pm »
This would be a lot more useful if OpenAL, SFML & your app had been built with debug symbols ;)
It's really the first time I've tried to use the debugger ;D Never really had anything that needed debugging.
I don't know what debug symbols are... :(
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems with .setPitch
« Reply #12 on: July 01, 2014, 08:52:55 pm »
Quote
This is all way beyond my skill level.
Fair enough. However, there's no time like the present (and an actual problem) to learn new stuff. And trust me, being able to do the things I listed will be useful in the future. Might as well learn now :)

Quote
Quote
This would be a lot more useful if OpenAL, SFML & your app had been built with debug symbols ;)
It's really the first time I've tried to use the debugger ;D Never really had anything that needed debugging.
I don't know what debug symbols are... :(
Debug symbols are information that your compiler can insert into the compiled object files/binaries that make it possible to work backwards from the machine-code to the original source file(s). Debugging without them is of course possible, but a lot harder and usually requires you to know some asm for your target platform - when debugging something you usually want a non-optimized build with debug symbols or you are going to have a huge challenge ahead of you compared to what you could have.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problems with .setPitch
« Reply #13 on: July 01, 2014, 11:49:55 pm »
Might as well learn now :)
I'd like to rebuild SFML to include the debugging libraries but I'm worried that if I risk attemping it again and fail, I could cause it SFML to not work at all whereas it currently works without the debugging.

Quote
[Interesting and useful information about Debug symbols]
I did wonder what that .PDB file was  ;D
I stopped trying to use the debugger when I realised that I didn't manage to build SFML with the debugger libraries and didn't know how to fix that.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Problems with .setPitch
« Reply #14 on: July 02, 2014, 08:27:07 am »
You can still use my nightly builds if you'd break your SFML setup. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/