-
Sep 12th, 2022, 04:35 PM
#1
Thread Starter
Hyperactive Member
Using Sound Effects in VB?
Hi All,
Just wondering whether it's a difficult thing or not to incorporate sound effects into VB? Short version, experimental VB + Cairo RPG crawler game being tested, I think it would be nice to add sound effects to weapon slashes and general combat.
Humble has released an enormous sound kit (2 days left), but I haven't looked at sound incorporation into VB at this stage of development.
I am wondering if there are sound gurus on here that know about sound and music on VB? Is there a lot involved, can one setup a decent combat system sound-wise? Can I play recorded MP3's at the same time as fighting? Would it sound good or trashy? Can multiple sounds play at once?
Any knowledge greatly appreciated.
Last edited by -Corso->; Sep 12th, 2022 at 04:58 PM.
-
Sep 12th, 2022, 05:47 PM
#2
Re: Using Sound Effects in VB?
Can't help anyone with silly, meaningless and childish images inserted, it just deflates my will to assist.
Make it grown up and my will to help might be restored.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Sep 12th, 2022, 05:59 PM
#3
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Not going to happen, my RPG game is about monstergirls, and Iris above, is an Anime dragon girl from the target audience I'm aiming the RPG at. So you are going to see more and more monstergirls from my posts as time passes. Some artwork made by me, some from the web. If you don't want to help, I'll understand your bitterness and prejudice against monstergirls. :P
-
Sep 12th, 2022, 06:05 PM
#4
Re: Using Sound Effects in VB?
Damn. I'm sure someone else will help.
WAV files can be played by default. MP3 and other formats can be played with assistance of Win APIs
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Sep 12th, 2022, 06:12 PM
#5
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Ah, I bought the mega sound pack.. Seems to be quite excellent for a starting pack. Crafting noises, monsters, combat, yereverluvinuncleber donkey noises.
Ah, yes, now I DO remember programing in some sounds when I had VB4... But it was pretty lame... API's, Ok.
-
Sep 12th, 2022, 08:47 PM
#6
Re: Using Sound Effects in VB?
For games the best bet is probably using DirectSound, The trick made a VB6-compatible typelib for it.
-
Sep 13th, 2022, 04:16 AM
#7
Re: Using Sound Effects in VB?
I can't stand Japanese style kiddie cartoons, so 70s, so trivial, so passée.
Glad you managed to get help on your cartoon sounds.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Sep 13th, 2022, 05:24 AM
#8
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Originally Posted by fafalone
For games the best bet is probably using DirectSound, The trick made a VB6-compatible typelib for it.
Thanks Fafalone. Oh boy, that does look complicated. I've got some ActiveX/Classes training to do for a while and will scan over the Tricks' stuff following that. Good to know that something can be done. I found this old stuff, which is good enough for a tiny test at least.
Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub PlaySound(strFileName As String)
sndPlaySound strFileName, 1
End Sub
Private Sub Command1_Click()
PlaySound App.Path & "\Windows Logoff Sound.wav"
End Sub
-
Sep 13th, 2022, 05:37 AM
#9
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Originally Posted by yereverluvinuncleber
I can't stand Japanese style kiddie cartoons, so 70s, so trivial, so passée.
Glad you managed to get help on your cartoon sounds.
Ok Cruella de Vil, you'll still be VB Forum's favorite wine aunt.
-
Sep 13th, 2022, 02:08 PM
#10
Re: Using Sound Effects in VB?
Originally Posted by -Corso->
Ok Cruella de Vil, you'll still be VB Forum's favorite wine aunt.
You'd be surprised how good I look in stockings and suspenders.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Sep 13th, 2022, 02:41 PM
#11
Re: Using Sound Effects in VB?
Originally Posted by yereverluvinuncleber
I can't stand Japanese style kiddie cartoons, so 70s, so trivial, so passée.
All media categories have winners, losers, and subjectively ambiguous material. Some can be good enough to appeal to broader audiences and the trick is finding those.
-
Sep 13th, 2022, 03:37 PM
#12
Re: Using Sound Effects in VB?
Originally Posted by -Corso->
Thanks Fafalone. Oh boy, that does look complicated. I've got some ActiveX/Classes training to do for a while and will scan over the Tricks' stuff following that. Good to know that something can be done. I found this old stuff, which is good enough for a tiny test at least.
Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub PlaySound(strFileName As String)
sndPlaySound strFileName, 1
End Sub
Private Sub Command1_Click()
PlaySound App.Path & "\Windows Logoff Sound.wav"
End Sub
Loading a file every time is probably going to be too slow for properly synced sound effects; it would be better to first load the sound effects into memory (read the file into a byte array) and use the SND_MEMORY flag to have PlaySound play it from the preloaded byte array (and of course SND_ASYNC so it doesn't halt your code while it plays).
If you search the forum you'll find examples for doing it from both files on disk and files embedded in your exe as resources.
-
Sep 13th, 2022, 05:18 PM
#13
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Originally Posted by dilettante
All media categories have winners, losers, and subjectively ambiguous material. Some can be good enough to appeal to broader audiences and the trick is finding those.
Very true.
Originally Posted by fafalone
Loading a file every time is probably going to be too slow for properly synced sound effects; it would be better to first load the sound effects into memory (read the file into a byte array) and use the SND_MEMORY flag to have PlaySound play it from the preloaded byte array (and of course SND_ASYNC so it doesn't halt your code while it plays).
Oh, I had no idea that sounds could be treated that way. Thanks for the tidbit.
-
Sep 14th, 2022, 03:43 AM
#14
Re: Using Sound Effects in VB?
-
Sep 14th, 2022, 06:39 PM
#15
Thread Starter
Hyperactive Member
Re: Using Sound Effects in VB?
Thanks Trick, that looks waaay complex for me to understand just this minute, does the PlayFile allow concurrent Wav's to be played?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|