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 - Kappa

Pages: [1]
1
Thank you! After a long dedicated research about it, I have discover the solution.

I had to link msvcrt.lib, then define the _DLL macro. Now it successfully compiles my SFML project statically.

2
So far, I am able to dynamically link SFML and run the executable just fine. However, statically linking the SFML errors saying:

Quote
sfml-graphics-s.lib(RenderWindow.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in Main.o

My clang version and information are:
Quote
clang version 15.0.7
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: ...
which made me not accomplish any solutions from quick google search about my problem as their build system or environment is different from mine.

I downloaded the SFML version for Visual Studio 64 bit, and then setted up the required search directories and linkers such as sfml-graphics-s.lib.
My command line is:
clang++.exe -DSFML_STATIC -fms-extensions -O2 -Wnon-virtual-dtor -Wall -std=c++14 -I"Deps\SFML\include" -c "Main.cpp" -o "Main.o"

clang++.exe -L"Deps\SFML\lib" -o "Main.exe" "Main.o" -m64 -lfreetype.lib -lopengl32.lib -lwinmm.lib -lgdi32.lib -luser32.lib -lsfml-window.lib -lsfml-graphics-s.lib -lsfml-system.lib
 

3
Audio / Re: Playing sound outside the main function doesn't work.
« on: November 13, 2022, 05:17:52 am »
That really explains a lot, I didn't even notice that it was going out of scope and destroying the sound and soundbuffer after it called .play().

I created two manager that stores the sf::Sound and sf::SoundBuffer inside a map so that it would never be destroyed, unless deleted manually. This is also solves the issue of the variables going out of scope causing them to be destroyed.

Now it finally works!

Thank you!

4
Audio / Playing sound outside the main function doesn't work.
« on: November 13, 2022, 02:02:00 am »
I'm trying to make an audio manager that stores the pointers of sound buffer in a **map**.
Retrieving the sound buffer pointers and playing them works fine inside the main function.

But when you play a sound outside the main function, it doesn't. Even when the sound buffer still exists.

An example code that recreates this problem:

void say()
{
        sf::SoundBuffer buffer;
        buffer.loadFromFile("Assets/Audio/burp.wav");

        sf::Sound sound;
        sound.setBuffer(buffer);

        sound.play(); // Doesn't play the sound.
}

int main()
{
        say();
        // SFML window stuff...
}
 
   

Pages: [1]