Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Gh0sty on November 15, 2006, 03:36:06 am

Title: searching an "insert-coin" sound
Post by: Gh0sty on November 15, 2006, 03:36:06 am
Good morning,

i seach an Insert-Coin sound, when you insert a real coin into a Cab this kind
of noise. And i plan to use it with Mame when i press key 5 it shold first play
this coin sound and then then go on with the game sound.
I'm not a programmer so i dont know how to solve this, i have the I-Pac
and i could use a free key for starting a small external program for playing
just this Insert-Coin sound, and after that it should examine the standard key 5.
Any helps here, maybe someone wrote such a programm allready?

Best regards
Gh0sty
Title: Re: searching an "insert-coin" sound
Post by: headkaze on November 15, 2006, 04:17:25 am
How will you write a program to do this if your not a programmer?

Anyhow, the best way to get a coin drop sound is to record sound from Mame32 then hit 5 it will play the coin drop sound of any of your favourite games.

To play a sound it's as simple as using the PlaySound API function in winmm.dll. Your program would basically look like this...

Code: [Select]
#include "stdafx.h"
#include <mmsystem.h>

#define VK_5 0x35

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
while (1)
{
Sleep(500);
if(GetAsyncKeyState(VK_5) & 0x8001)
PlaySound("1up.wav", NULL, SND_FILENAME | SND_ASYNC);
}

return 0;
}

Okay I decided to compile it for you. Attached is the program above.
Title: Re: searching an "insert-coin" sound
Post by: Gh0sty on November 15, 2006, 05:43:59 am
hey headkaze,

many thanks for the help so far!
i'm at work right now and only can test out your prog later tonight at home,
i still dont know how it will work, or how to start it, but i will test everthing.
You write " the best way to get a coin drop sound is to record sound from Mame32 "
what do you mean with this? right now a friend is recording a real WAV sound from
an Arcade Cab for me. Does Mame32 have one build in ??

R
Gh0sty
Title: Re: searching an "insert-coin" sound
Post by: headkaze on November 15, 2006, 06:54:47 am
hey headkaze,

many thanks for the help so far!
i'm at work right now and only can test out your prog later tonight at home,
i still dont know how it will work, or how to start it, but i will test everthing.
You write " the best way to get a coin drop sound is to record sound from Mame32 "
what do you mean with this? right now a friend is recording a real WAV sound from
an Arcade Cab for me. Does Mame32 have one build in ??

R
Gh0sty


It's built into Mame32 (File->Play and Record Wave Output...)
Title: Re: searching an "insert-coin" sound
Post by: unclet on November 15, 2006, 07:14:09 am
I attached some WAV sound files of coins being inserted into a game.  Hope it helps you out.
Title: Re: searching an "insert-coin" sound
Post by: Gh0sty on November 15, 2006, 03:47:09 pm
WOW! that is ecsactly what i was searching for !
I start headkazes coinsound prog and i use unclet's coinF 75P.wav,
It sound great, but something is still not working like the real thing.
Headkaze, it plays the virtual Coin sound simultaneously with the Mame one
when pressing key 5. In reality your would first hear the Coin drop sound
and after that the Game sound.

coinF 75P.wav is aprox 1.66 seconds long, i dont know how much work it
would be for you to change the small programm so it plays the coin sound
and after 1.5 seconds it continue with Mame Sound?

R
Gh0sty
Title: Re: searching an "insert-coin" sound
Post by: headkaze on November 15, 2006, 05:51:26 pm
I'm afraid that would be alot harder to do! The only way to have a delay (without me writing some heavy low level stuff to hook the keyboard), would be to have an AutoIt script or AutoHotKey script that will trap the 5 key then send the 5 key again after a delay.

Something like this:
Code: [Select]
5::
Sleep 5000
Send 5
return

Although I just tried the above script and the sound still plays then it loops over for some reason.
Title: Re: searching an "insert-coin" sound
Post by: Silver on November 15, 2006, 07:49:01 pm
I think it plays twice as the original 5 press is being sent along with the 2nd after a delay....


Try a new unused key - that could trigger your personal sound, then get autohk to send a "5" after a delay.
Title: Re: searching an "insert-coin" sound
Post by: headkaze on November 15, 2006, 09:31:33 pm
I think it plays twice as the original 5 press is being sent along with the 2nd after a delay....


Try a new unused key - that could trigger your personal sound, then get autohk to send a "5" after a delay.

There is still the problem that AutoHotKey dosn't seem to stop GetAsyncKeyState() from detecting the key, so it plays the sound anyway.
Title: Re: searching an "insert-coin" sound
Post by: Gh0sty on November 17, 2006, 10:54:46 am
ok, thank you anyway for small programm and the listing!
Headkaze if you dont mind i will ask other programmers
to view & modify your program, maybe someone can figure it
out how to delay the sound.

Best Regards
Gh0sty
Title: Re: searching an "insert-coin" sound
Post by: jlfreund on November 20, 2006, 11:19:00 pm
Wouldn't it be easier to use some kind of sound authoring tool to construct a wav file that has a delay, then a coin drop, then a clink sound?

Jason
Title: Re: searching an "insert-coin" sound
Post by: leapinlew on November 21, 2006, 12:15:14 am
Wouldn't it be easier to use some kind of sound authoring tool to construct a wav file that has a delay, then a coin drop, then a clink sound?

Jason


awesome....

a few seconds of dead air.

Sometimes the easiest solution is the hardest to come up with. That was a genius suggestion.
Title: Re: searching an "insert-coin" sound
Post by: headkaze on November 21, 2006, 09:53:28 am
You could use the Sleep() function to have a delay

Code: [Select]
if(GetAsyncKeyState(VK_5) & 0x8001)
{
Sleep(1000);
PlaySound("1up.wav", NULL, SND_FILENAME | SND_ASYNC);
}

But I think the problem is he wants the 1up sound in Mame to have the delay not the coin drop.
Title: Re: searching an "insert-coin" sound
Post by: Gh0sty on November 21, 2006, 10:23:39 am
Folks, what Headkaze said, the Problem is not the insert-coin sound at all.
The problem is that both sounds (insert-coin & 1up-mame) play simultaneously.
But it should play the Insert-coin first till its finished and after that mame should
start his 1up sound.  I hope everyone understand this fundamental Problem now ;)
Title: Re: searching an "insert-coin" sound
Post by: ahofle on January 31, 2007, 01:38:51 pm
Has anyone gotten this to work?  I still don't understand why Silver's suggestion doesn't work.  I would think it should work if you made your coin button activate some other key than 5 (let's say 0).  Recompile headkaze's program to look for VK_0, and play the coin wav, then have the AutoHotKey listen for the 0, wait a second or two, and then send a 5 for MAME to consume and play the coinup sound. 
Title: Re: searching an "insert-coin" sound
Post by: Nologic on February 01, 2007, 09:54:43 am
Actually here is a silly idea...why not join the sound files. :)

Seems like it would be fair less hassle, plus you can tweak the pitch, fade, and delay to where your perfectly happy.
Title: Re: searching an "insert-coin" sound
Post by: FrizzleFried on February 01, 2007, 10:10:01 am
I took the easy way out and just attached a coin sound to the SELECTION button in mamewah.

Sure,  it doesn't make the coin noise when I actually give credits in MAME,  but it does play the noise every time you enter in to a new game from the FE.

Simple...acceptable...OK.

Title: Re: searching an "insert-coin" sound
Post by: Minwah on February 01, 2007, 11:30:31 am
Simplest solution: wire up a coin mech!
Title: Re: searching an "insert-coin" sound
Post by: ahofle on February 01, 2007, 04:21:41 pm
Actually here is a silly idea...why not join the sound files. :)

Because every game has a different coinup sound effect.  I wouldn't want the Frogger coinup sound to play for Pacman.  Only the coin drop sound is common. 
Title: Re: searching an "insert-coin" sound
Post by: Nologic on February 02, 2007, 04:05:09 am
well a batch script or autoit script could be written to batch process the files being joined...if need be...ideally shouldn't be a big deal to code up if you had access to all the coinup sounds.

hehe tho maybe Minwah has a point. ;)

Other wise chat up the emu dev's to see if they could add such a novelity as an option to enable.
Title: Re: searching an "insert-coin" sound
Post by: Minwah on February 02, 2007, 04:53:34 am
well a batch script or autoit script could be written to batch process the files being joined...if need be...ideally shouldn't be a big deal to code up if you had access to all the coinup sounds.

If the sounds in Mame were all samples that might be a solution but I don't think that is the way to go.

Quote
Other wise chat up the emu dev's to see if they could add such a novelity as an option to enable.

Don't hold your breathe!