Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Problem with sound playback in VS2012

Author
Message
AGK Native
11
Years of Service
User Offline
Joined: 19th Nov 2012
Location:
Posted: 19th Nov 2012 20:49
Hi Everyone!

I'm quite new in this, but I have some experience in game development in other environments. I have created simple game, and now its time to add sound. It looks pretty simple, as it should be, but it's not working. Can somebody please give me some guidelines what to do.
I have something like this:


According to tutorials it should work, but I can't hear anything.
P.S. I have configured all include and debug/release folders, and I don't have any error.

Any help is appreciated!
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 19th Nov 2012 23:35
Why are you loading from a lower directory?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 20th Nov 2012 01:34 Edited at: 20th Nov 2012 01:35
Your code shows that you are attempting to play a sound at the start of each frame, which means it is trying to play the file 60+ times a second. You should instead play it based on a trigger within the loop, or at least check to see if it is playing (using GetSoundsPlaying) before playing it again.

If you want to loop sound or music, you can do that as well but again this should be done outside of the loop or only at specific times using conditional checks.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2012 18:26

This is going to cause you additional problems.

None of the platforms publishable with AppGameKit will allow you to reference a directory above the app directory.

Additionally, in C/C++, if you want to include a backslash (\) in a string, you need to escape it. Your string should be "..\\burp.wav" (ignoring that the reference to the directory above is not allowed).

I would say that the missing backslash is your first problem.

Your burp.wav file needs to be either in the same directory as your executable or in a subdirectory under it.

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-05-05 20:45:09
Your offset time is: 2024-05-05 20:45:09