PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby reneuend » Mon Oct 28, 2013 5:45 am

Good News! PlaySound does work.
I was using Audacity for recording my sounds and there is a setting that is causing it to not work with PlaySound. Oddly, the files work in AM otherwise. I have a different tool I can use.
Update: I am now using a very old version of Acoustica MP3 Mixer (ver. 2.471 - copyright 2001) and it works fine. Crashes after recording on Windows 7 sometimes, but its the best I can do right now.




Help!

The updated PlaySound() routine for Windows7 is not working for me. I thought it was working not too long ago and it is making me wonder if when I installed XVid if that would cause it to fail. Does this mess up MediaPlayer object somehow?

I will uninstall Xvid and test. With all the videos in my game, if I can't use XVid because of this issue...I'm not sure what to do but remove a lot of sound effects. At this time, all my videos in my project add up to over 5 gig. Before I release it, I would like to convert these files to something smaller if possible.

Anyway, I'll post back if I solve the sound issue. Meanwhile, I anxiously await anyone's ideas.

Update: XVid has nothing to do with this issue. It seems TKG was right about the PlaySound code not working in this latest AM version. I know it worked in 4.6, but I'm not going back. I can't find a work-around for this game, but I will for future games. After this game is done, I'm going to build an Inventory plugin.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby igelkott » Tue Dec 01, 2015 10:12 pm

Hello, reneuend!
OS Windows 7. The problem with the sound in my game. When AM is running, at the mode "Run Project (Start)" everything is OK. But after the compilation exe-file and its installation, when I click on the hotspot which having a sound effect, occurs an error:
"An error has occurred. The programm may not work properly. Click OK and then press Ctrl+Q to quet. Error description:
Error executing script. The Scripting Engine returned the following error message:
Automation error
Unspecified error "
Maybe I doing something wrong..?
It would be great if someone would make a small example - a one frame with three hotspots, contains sound effects (mp3, wave, ogg), like the AM project (not exec). I would look how things are done, and perhaps would have found my mistakes.
igelkott
Junior Member
 
Posts: 12
Joined: Sun Dec 28, 2014 10:36 pm

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby reneuend » Wed Dec 02, 2015 3:31 am

Hello Igelkott!

Where are attempting to play sound from? the built-in audio channels in AM? or are you using VBscript?

Here is a sample project: http://www.hickchickgames.com/downloads/SoundTest.zip
I would suggest when adding sounds to your project to stick with either WAV or MP3.

If you are using the vbscript routine, be sure that you use channel 9 or higher!

Also, make use of the audio channel numbers to keep types of sounds organized:

example:

Channel Type
-----------|---------------
1 Ambient
2 Sound Effects
3 Voices


let me know if you have any further questions and of course let us know how it works out for you!!!
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby igelkott » Wed Dec 02, 2015 9:49 pm

Thank you for your response, Reneuend!
The sound in my project is done the same way as you, using VBscript.
After much experiments, I discovered the cause of the error:
After installing, the audio files changed its extension - the file *.wav became *.225, and the file *.mp3 became *.128.
What's this?! The machinations of evil Voldemort? :))
When I renamed them back, everythings was OK, the sounds in the game working properly.
What do you think, how I can fix this problem?
igelkott
Junior Member
 
Posts: 12
Joined: Sun Dec 28, 2014 10:36 pm

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby reneuend » Thu Dec 03, 2015 1:22 am

To avoid this issue, it is recommended that you put any files that you call from VBScript in the "External" folder of the project. When you have to pass in the file as a parameter to the PlaySound routine, prefix it with this:
Action.GetPath(2) + "your_sound_file.mp3"

Action.GetPath(2) : where 2 is the index for the "External" folder

Other Indexes:
1 - Root
2 - External
3 - Config
4 - Areas
5 - Frames
6 - FramesData
7 - Icons


I'm glad you got it to work!
let me know if you have any other questions or run into any other issues!!!!!
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby igelkott » Thu Dec 03, 2015 10:59 pm

I put mp3, wave and ogg into the "External" folder, compiled exec and... Everything worked out! It's just like Christmass!))
But... a couple questions:
1) For what purpose is а folder "Sound Files" in AM, if the putted in it sound files doesn't work? Collision between installator and Win7?
2) Why you don't recommend to use "ogg"? They will work not for all users pc?
3) The video files also need to put in the "External" folder?
...Thank you for help, Reneuend!
igelkott
Junior Member
 
Posts: 12
Joined: Sun Dec 28, 2014 10:36 pm

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby reneuend » Fri Dec 04, 2015 1:45 am

The rule of thumb is that if you call something from a VB Script, put the file in the External folder. This is because when the project is compiled, the files in the external folder are not renamed. Files in the other project folders are renamed. This is why you ran into errors.

I didn't mention ogg files because I didn't think they were supported by native Windows. The player that doesn't have the correct audio codek might run into issues. Do ogg files play via media player without any additional options be added?
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby igelkott » Thu Dec 24, 2015 11:53 pm

PlaySoundWin7() is OK. The next problem:

Sub StopSoundWin7()
Component("MediaPlayer1").Object.Stop
End Sub

...Doesn't work((
Error description: The Component named "MediaPlayer1" could not be found.
igelkott
Junior Member
 
Posts: 12
Joined: Sun Dec 28, 2014 10:36 pm

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby reneuend » Fri Dec 25, 2015 1:00 am

Use this updated version instead, which is actually more versatile because you can specify the channel.

Code: Select all
Sub StopSoundWin7(ChannelNumber)
  Component("MediaPlayer" + CStr(ChannelNumber)).Object.Stop
End Sub
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2691
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: PlaySound Routine not working with ver. 4.7.1 (RESOLVED)

Postby igelkott » Sat Dec 26, 2015 5:41 pm

Thanks. It works :D
igelkott
Junior Member
 
Posts: 12
Joined: Sun Dec 28, 2014 10:36 pm


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 3 guests