Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Audio
»
Music not working
Print
Pages: [
1
]
Author
Topic: Music not working (Read 5640 times)
0 Members and 2 Guests are viewing this topic.
epilepticPi
Newbie
Posts: 15
Music not working
«
on:
July 15, 2016, 10:13:11 pm »
I just wrote this:
#include <SFML\Audio\Music.hpp>
sf
::
Music
music
;
if
(
!
music.
openFromFile
(
"music_background.wav"
)
)
{
std
::
cout
<<
"ERROR"
<<
std
::
endl
;
}
music.
setLoop
(
true
)
;
music.
play
(
)
;
But i got an error message in cmd:
Failed to open sound file "music_background.wav" (format not supported)
Failed to play audio stream: sound parameters have not been initialized (call initialize() first)
How can i fix that?
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: Music not working
«
Reply #1 on:
July 15, 2016, 11:16:34 pm »
What format is your music in?
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
epilepticPi
Newbie
Posts: 15
Re: Music not working
«
Reply #2 on:
July 16, 2016, 12:46:06 pm »
.wav
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: Music not working
«
Reply #3 on:
July 16, 2016, 01:39:11 pm »
That's not a format but merely a container.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
epilepticPi
Newbie
Posts: 15
Re: Music not working
«
Reply #4 on:
July 16, 2016, 02:37:08 pm »
"Waveform Audio File Format (WAVE, or more commonly known as WAV due to its filename extension)(rarely, Audio for Windows) is a Microsoft and IBM
audio file format
standard for storing an audio bitstream on PCs" -Wikipedia
Logged
victorlevasseur
Full Member
Posts: 206
Re: Music not working
«
Reply #5 on:
July 17, 2016, 08:36:40 pm »
Look at the "WAV file audio coding formats compared" section in the wikipedia article. You'll see that audio can be encoded in many different ways in a WAV file. You can even put MP3 encoded audio inside a WAV file.
Logged
Hapax
Hero Member
Posts: 3379
My number of posts is shown in hexadecimal.
Re: Music not working
«
Reply #6 on:
July 17, 2016, 08:57:46 pm »
I guess we could rephrase the question:
which codec was used when saving the file?
Logged
Selba Ward
-SFML drawables
Cheese Map
-Drawable Layered Tile Map
Kairos
-Timing Library
Grambol
*
Hapaxia Links
*
epilepticPi
Newbie
Posts: 15
Re: Music not working
«
Reply #7 on:
July 18, 2016, 01:25:36 pm »
vlc says its codec is MPEG Audio Layer 1/2(mpga)
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: Music not working
«
Reply #8 on:
July 18, 2016, 01:40:01 pm »
SFML only support PCM wav files.
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Audio
»
Music not working
anything