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 / Trouble with LoadSound/playSound

Author
Message
BrokenCodeMonkey
7
Years of Service
User Offline
Joined: 21st Mar 2017
Location:
Posted: 23rd Mar 2017 22:28
I'm creating a grid based game where when a character touches a door, a new map is drawn and the player is moved outside the door. I currently have music from http://soundimage.org/ (credits to Eric Matyas for the site) and im trying to play sounds.

The audio i have is loaded like this



and is ran before any music is called. this works as i have the menuMusic playing at the start, when its looking for input. however, while the music is playing and i hit a door, the doorSound file doesnt play. I have checks for it all over the place just to make sure that its not only found, but playing. but the one line of code



keeps printing 0. I've changed it from LoadSound to LoadMusic and the file works flawlessly, but i havent been able to find a way to make both the background ambient music and the door sound play at the same time.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Mar 2017 08:58
Are menuMusic/playerMusic/battleMusic and doorSound declared as global variables. (global menuMusic)
If not, then they won't be accessible outside the setAudio() method.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Mar 2017 09:00
the online doku said it needs wave files "Filename - The filename of the sound file to load, must be a WAV file."
you can use a media converter.
LoadSound
see also LoadSoundOGG
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Mar 2017 10:17
Agree with Markus, you can't use MP3 as sounds.
I would recommend using OGG over Wav, use Audacity (free) if you need to convert.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
BrokenCodeMonkey
7
Years of Service
User Offline
Joined: 21st Mar 2017
Location:
Posted: 24th Mar 2017 11:31
Mobiius
Quote: "Are menuMusic/playerMusic/battleMusic and doorSound declared as global variables. (global menuMusic)
If not, then they won't be accessible outside the setAudio() method."


I found they were giving me problems otherwise, so they're in the main, just under the #include's.


Markus
Quote: "the online doku said it needs wave files "Filename - The filename of the sound file to load, must be a WAV file.""


I thought I remembered something about wav files, but didn't think it applied as "wav ONLY" formats. Once I loaded a wav sound, it worked perfectly! Thank you!

Login to post a reply

Server time is: 2024-03-28 09:58:50
Your offset time is: 2024-03-28 09:58:50