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

Author Topic: SFML audio not working win7 prof x86  (Read 4658 times)

0 Members and 1 Guest are viewing this topic.

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« on: February 01, 2010, 04:11:56 am »
Hi

I'm trying to write a music looper with multiple tracks to create mixed and layered music and so I gave a shot at SFML.

Here's the sample code i used:
Code: [Select]
#include <SFML/Audio.hpp>
#include <iostream>

using namespace std;

int main()
{
cout << "Welcome" << endl;
//Load music
sf::Music musik;
if (!musik.OpenFromFile("rockdrums.wav"))
return EXIT_FAILURE;

musik.Play();

cout << "End..." << endl;
return EXIT_SUCCESS;
}


It compiled and linked successfully.
However, it does not play my .wav and instead:
1) Prints garbage on the console
2) Plays a beep beep beep sound repeatedly
3) At times crashes itself quickly and other just stop responding to my CLOSE

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML audio not working win7 prof x86
« Reply #1 on: February 01, 2010, 05:12:12 am »
So, um, that doesn't sound quite right, and that code you are using should almost immediately exit so you can't hear much of the sound.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML audio not working win7 prof x86
« Reply #2 on: February 01, 2010, 08:01:23 am »
What compiler do you use? DO you mix debug and release? Do you use the OpenAL DLL provided with SFML?
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #3 on: February 01, 2010, 08:02:23 am »
@onilink10
Why is that so? If I want to try out to play a .wav file, what then should I write?

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #4 on: February 01, 2010, 08:05:53 am »
I'm using Visual Studio 2008 C++ and creating on a Win32 console app.
What do you mean by "mix debug and release"? I'm on 1.5 SFML. Everything compile and links awesome, and i'm using the .dll files provided by SFML. OpenAL i took it from SFML's extlib, together with the libsnd-1.dll.

But i get the garbage (matrix-like-flooding) on my console and beeping sounds. What's going on? :(

* To re-iterate, I'm on a Win7 Pro x86.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML audio not working win7 prof x86
« Reply #5 on: February 01, 2010, 08:12:43 am »
Quote
What do you mean by "mix debug and release"?

I mean linking to SFML release libraries in your debug configuration.
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #6 on: February 01, 2010, 08:27:42 am »
I'm sorry LAurent, I've no idea what you're talking about. I only started using this IDE recently. I'm on debug mode if you're asking about that.

Okay here's what I did to prep the environment:
1) According to the tut, I put my include folder (SFML) to become  VC/include/SFML
2) threw all the lib contents into the VC/lib folder

The clock example worked flawlessly.

But this code don't. Anything that does with vid or snd don't, so far.

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #7 on: February 01, 2010, 08:28:37 am »
and yes, I place the .dll files on the same folder (debug) as the executable. anyway, it'll warn me if I don't have the files.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML audio not working win7 prof x86
« Reply #8 on: February 01, 2010, 08:32:50 am »
I'm talking about this
Quote from: "Getting started with VC++ tutorial"
Important: for the Debug configuration, you have to link with the debug versions of the libraries, which have the "-d" suffix (sfml-system-d.lib in this case). If you don't, you may get undefined behaviours and crashes.


If you don't know what it refers to, have a look at the tutorial, there are screenshots and detailed explanations.
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #9 on: February 01, 2010, 08:39:54 am »
Okay thanks Laurent, I think I missed that portion. I'll go try fix it again.

:)

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
SFML audio not working win7 prof x86
« Reply #10 on: February 01, 2010, 08:44:30 am »
THANK LAURENT IT WORKED. :)