Playing Wavs And Buffering Wavs
Ok in my game i dont want to use direct x as i have no idea on how to use it but to use API commands instead
I need to buffer 2 wav files
and then be able to play them
and is it possible to play both sounds at the same time?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Playing Wavs
I want my end user to be able to play a series of .wav files which are in a list. I am currently using "shell mplayer.exe" because I want my user to be able to stop, go back, repeat, etc.
The problems I have are:
* "Shell" is asinchronous, I mean my app does not wait for the sound to complete
* If my user does not close Mplayer, and clicks on another .wav file to listen, he will end up with multiple instances of mplayer open at the same time.
* Stupid dumb mplayer starts each time in a different zone of the screen in an apparently random fashion. Can I make it to locate in a defined position, or maybe inside a form?
Thanks in advance.
Playing Multiple WAVS
Hi, I'm able to play a single WAV file no problem by following the books and built-in help
but I have a very inconsistent result when trying to play multiple WAVS. What are the rules
regarding this? Can you direct me to a better FAQ or tutorial which addresses this? Thanks.
P.S.-The files seem to not be "closing" properly since they are often inaccessible after the
program is run.
Playing WAVs RES Files
How do you play a wav sound that is embeded in a resource file? (And how do you stop it playing!!)
I'd rather not have to save it to disk first, if at all possible.
------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892
Web Sites:The Blue Link My Home Page (Not up at the moment!)
Playing Multiple *.wavs ( HELP PLEASE )
Hi
can anyone help i am wanting to play multiple *.wav files in my program and haven't a clue how it is done, but i have managed to get the odd *.wav file to play on the command button, but i would like to play *.wav files with the following code
One has used the following to play my *.wav files can anyone direct me in the correct way of doing this ?.
Option Expilcit
(HERE) Represents where one wants to play different *.wav files within the If statements.
Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Sub cmdStick_Click()
Dim x As Integer
cmdDeal.Enabled = True
cmdStick.Enabled = False
'check for aces in players hand and adjust the score
'to highest possible
'Uncover dealers face down card
imgD0.Picture = PicCard(Shuffle(CardCount)).Picture
Dtot = Dtot + GetCardValue(Shuffle(CardCount), Dtot, "D")
DealerAceCheck
lblDscore.Caption = Dtot
CardCount = CardCount + 1
DealerCardCount = DealerCardCount + 1
'Deal dealers cards and
'check to see if dealer has 21 inside the For
'and also do check for BJ or a Push
For x = 1 To 4
'this covers five card trick
If PlayerCardCount >= 5 And Dtot = 21 And DealerCardCount = 2 Then
'player wins dealer loses add 15 to score
If lblNotify.Visible = True Then
lblNotify.Caption = "Player Wins" 'need to play *.wav file HERE
Ppoint = Ppoint + 15
lblPPoints.Caption = Ppoint
Exit For
End If
End If
If DealerCardCount >= 5 And Ptot = 21 And PlayerCardCount = 2 Then
'dealer wins take 10 from score
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins" 'Need to play *.Wav HERE
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
Exit For
End If
If PlayerCardCount = 2 And DealerCardCount = 2 And Dtot = 21 And Ptot = 21 Then
'both got blackjack its a push
lblNotify.Visible = True ( HERE )
lblNotify.Caption = "Push"
Exit For
End If
If DealerCardCount = 5 And Ptot >= Dtot And Ptot <= 21 Then
If DealerCardCount = 5 Then
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins!He Got 5 Card Trick" (HERE )
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
Exit For
End If
End If
If PlayerCardCount = 5 And Dtot >= Ptot And Dtot <= 21 Then
If PlayerCardCount = 5 Then
lblNotify.Visible = True
lblNotify.Caption = "Player Wins! You Got 5 Card Trick" (HERE)
Ppoint = Ppoint + 15
lblPPoints.Caption = Ppoint
Exit For
End If
End If
'check to see if player has BJ
If Dtot = 21 And DealerCardCount = 2 Then
If Ptot = 21 And PlayerCardCount <> 2 Then
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins! BlackJack" (HERE)
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
Exit For
End If
End If
If Ptot = 21 And PlayerCardCount = 2 Then
If Dtot = 21 And DealerCardCount <> 2 Then
lblNotify.Visible = True
lblNotify.Caption = "Player Wins! BlackJack" (HERE)
Ppoint = Ppoint + 15
lblPPoints.Caption = Ppoint
Exit For
End If
End If
If Dtot > 21 Then
If Ptot <= 21 Then
'player wins dealer loses add 15 to score
lblNotify.Visible = True
lblNotify.Caption = "Player Wins"
Ppoint = Ppoint + 15
lblPPoints.Caption = Ppoint
If Ptot = 21 And PlayerCardCount = 2 Then
lblNotify.Caption = "Player Wins BlackJack!" (HERE)
End If
Exit For
Else
lblNotify.Visible = True
lblNotify.Caption = "Push As Both House & Player Have Bust" (HERE)
Exit For
End If
End If
If Dtot > Ptot Then
'dealer wins take 10 from score
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins"
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
If Dtot = 21 And DealerCardCount = 2 Then
lblNotify.Caption = "Dealer Wins BlackJack!" (HERE)
End If
Exit For
End If
If Dtot <= 21 And Ptot > 21 And Dtot >= 16 Then
'dealer wins take 10 from score
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins"
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
If Dtot = 21 And DealerCardCount = 2 Then
lblNotify.Caption = "Dealer Wins BlackJack!" (HERE)
End If
Exit For
End If
If Dtot = Ptot Then
lblNotify.Visible = True
lblNotify.Caption = "Push!, No Points Added Or Taken Away" (HERE)
Exit For
End If
If Dtot > 16 And Ptot > 21 Then
'dealer wins take 10 from score
lblNotify.Visible = True
lblNotify.Caption = "Dealer Wins"
Ppoint = Ppoint - 10
lblPPoints.Caption = Ppoint
If Dtot = 21 And DealerCardCount = 2 Then
lblNotify.Caption = "Dealer Wins BlackJack" (HERE)
End If
Exit For
End If
If Ppoint <= 0 Then
'player has lost
MsgBox "Player Has Lost All Points! GoodBye" (HERE)
frmGameOver.Show
Unload Me
'End
'take end out & replace with unload frm or hide frm
'when adding other frm's for
'endgame
End If
'deal dealer cards
If DealerCardCount = 2 Then
ImgD2.Visible = True
ImgD2.Picture = PicCard(Shuffle(CardCount)).Picture
End If
If DealerCardCount = 3 Then
ImgD3.Visible = True
ImgD3.Picture = PicCard(Shuffle(CardCount)).Picture
End If
If DealerCardCount = 4 Then
ImgD4.Visible = True
ImgD4.Picture = PicCard(Shuffle(CardCount)).Picture
End If
Dtot = Dtot + GetCardValue(Shuffle(CardCount), Dtot, "D")
DealerAceCheck
lblDscore.Caption = Dtot
DealerCardCount = DealerCardCount + 1
CardCount = CardCount + 1
Next
Check_Card
End Sub
Playing Windows Default Wavs
hi all
whats the best way to go about playing a default program event sound in windows, eg asterix, critical stop, etc.
ive used PlaySound api but id like to just use the system defaults instead of specifying each file.
VB5
thanks, jack.
Playing Midi And Wavs Simultaneously
Can this be done?
I want to load a Midi file and have it playing in a loop as background music for a game. In addition to that, wave file sound effects should be able to be played "on top" of that without interrupting the flow of the Midi file. I am familiar with the PlaySound API for waves. I also checked out the mciSendString for Midi, but couldn't find a loop function.
Has anybody done this before? Any pseudo-code for me please?
Playing Mp3's && Wavs Without Starting RUNDLL32.Exe
Winamp and every other player manage to play MP3's and Wavs without the RUNDLL32.exe starting up. THis code i have uses the winmm.dll and the mcisendstring API. I can't figure out why every time i open or close and MP3 or wav the RunDLL32 loads and unloads.
This would not be a problem except for the fact that you get that annoying Windows dfefault sound for when a program loads and unloads every time a new song starts.
ANyone have code that works and runs MP3's and WAvs and DOesnt use the RUNDLL32.exe?
I would be glad to upload the Bas i'm using if anyone wants to take a look at it.
Reallllly reallly appreciate any help!
Playing Multiple WAVs Simultaneously
Is it possible to play multiple WAV files from VB simultaneously? If so, how? (Sample source code would be greatly appreciated.)
Thanks in advance!
SndPlaySound API And Playing Multiple Wavs At A Single Time.
Using the API and contants below is there a way to have it play the sound and if another call is made to play another sound that it does not cancel out the other sound which is in the middle of playing but just play them ontop of each other and let each finish normally?
Code:
Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (lpszSoundName As Any, ByVal uFlags As Long) As Long
Private Const SND_SYNC = &H0 ' Play synchronously (default).
Private Const SND_NODEFAULT = &H2 ' Do not use default sound.
Private Const SND_MEMORY = &H4
Private Const SND_LOOP = &H8 ' Loop the sound until next
Private Const SND_NOSTOP = &H10 ' Do not stop any currently
Private Const SND_ASYNC = &H1 ' play asynchronously
Clint LaFever (aka: DaVBMan)
How Do I Add Echo To Wavs ?
I've written an app. that records .wavs via microphone using mcisendstring but I would like to be able to add a bit of echo.
I've searched but can't find any info on this so can anybody help me out ?
Thanks.
Wavs From A Resource
I've got two wav files in my resource file and I'm trying to play them. (In a quiz program, one's for the correct answer and one's for the wrong)
Code:
CorrectSound = LoadResData(102, "CUSTOM")
PlaySound CorrectSound, ByVal 0&, SND_FILENAME Or SND_ASYNC
That's what I'm using, and it does play a sound...just not mine. Instead of the one I loaded into the resource file, it's just the generic Windows beep.
Play Wavs?
I looked all around here but couldn't find anything about playing wav's. Can you? If so could someone tell me the right syntax.
Thanks
Vb6 Compare Wavs
is there a control that can compare pieces of wav files and find how close they are to each other?
How To Play To Wavs At Once
How can I play two sounds simultaneously using either a control or API. I have tired the multimedia control - couldn't get it to work, I tried the PlaySound API function but that didn't work either. I know it is possible without using DirectX or something like that.
Any help would be appreciated.
Chilibean
Wavs And Modems
hi all :
i wanna be able to open the Comm port to my Modem And As if
lifting the handset to talk :
then play a wav over the Phone:
can anyone help me with
this
thanks
Tapi Wavs
How can I send WAV files thru my TAPI modem,, Code help ??
TAPI Wavs
im trying to send WAV Files Over my Phone whenver it Dials out to
someone, the dialout part i have just getting it send a WAV is the problem
can someone help me
>
Recording Wavs
Can anyone tell me how to create a buffer array from a WAVEHDR structure
(created using waveinaddbuffer,waveinStart...) ??????
I want to play that buffer using Directsound but i don't know how to convert it.
Play 10 .wavs In Succession?
I have a form with a list box that contains 10 items: titles of 10 .wavs that I have stored in a resource file. The dialog has 3 buttons: Play, Stop, and PLAY ALL. I have Play working perfectly, when the user clicks a selection in the listbox then clicks Play the .wav plays perfectly, and can be stopped or interrupted by another .wav at the user's whim.
How do I get PLAY ALL to play all 10 .wavs and still allow the user to interrupt the playback with the Stop button? My issue is that I can't just loop through the resource IDs (101 to 110) because I need 102 to finish playing before 103 starts for example. I also don't want to lock up the program and force the user to WAIT until all 10 have played before s/he can do something else in the program. With all those wav playback schemes ie: sndplaySound etc.. there are all sorts of constants NOSYNCH ASYNCH etc.. etc.. but I can't figure out how to play 10 different wavs together and allow the user to interrupt. All the examples of "looping" I have seen are all about looping a single .wav sound. Thanks.
Play Wavs? DirectX Does The Job
Hi all VB users out here!
I am workin on a laptimer project, and I wanted the program to play sound every now and then, and each time a car went thorugh the finish line. The thing was that when 2 or more cars pass at he same time I could only reproduce 1 sound if I used the playsound or something API. So i did some search in the forum and red a little about DirectX and that using it will allow me to play multiple sounds at the same time. THIS WAS WHAT I WAS LOOKING FOR!!! So yesterday I did some research and finally manage to deal with the basics of using DirectX. So here is what I have done so far... there is still much to learn and find out (like 3d audio) but I was really happy to use DirectX!!!
1. In VisualBasic open the menu 'Proyecto' (project) and click the 'Referencias' (references) option. A window is displayed look and select the component: DirectX 8 for Visual Basic Type Libary.
Now you have acces to all the DirectX functions.
2. The next step is to create a DirectX object, I did this in a Module, and to create a DirectSound object (directsound objects are the ones that will allow us to reproduce sounds)
Option Explicit
Public m_dx As DirectX8
Public m_ds As DirectSound8
3. DirectX uses buffers to store tha saound it's going to play. I have so far only manage buffers createsd from a file which can't be longer than a few seconds, but streaming buffers will allow you to reproduce longer sounds. So now I have a form and 2 command buttons in it. In the form I have to create te buffer and tell wich file is to be loaded into it.
Decalrations:
Private m_dx As New DirectX8
Private m_ds As DirectSound8
Private m_dsb1 As DirectSoundSecondaryBuffer8
Private m_dsb2 As DirectSoundSecondaryBuffer8
Private Sub Form_Load()
Dim buffdesc As DSBUFFERDESC
Set m_ds = m_dx.DirectSoundCreate(vbNullString)
m_ds.SetCooperativeLevel Me.hWnd, DSSCL_PRIORITY
buffdesc.lFlags = DSBCAPS_CTRLPAN Or _ DSBCAPS_CTRLVOLUME Or DSBCAPS_CTRLFREQUENCY
Set m_dsb1 = m_ds.CreateSoundBufferFromFile(App.Path _ & "sonido.wav", buffdesc)
Set m_dsb2 = m_ds.DuplicateSoundBuffer(m_dsb1)
End Sub
The lFlgas are flags. The meaning and functionality of each one can be found at msdn.microsoft.com (under DirectX 8.0 for Visual Basic)
m_dsb2 is an exact copy of m_dsb1. This is to have one buffer for each button.
4. Now just play the sound each time you click the button:
Private Sub Command1_Click()
m_dsb1.Play DSBPLAY_DEFAULT
End Sub
Private Sub Command2_Click()
m_dsb2.PLay DSBPLAY_DEFAULT
End Sub
If you press the two buttons one after the other you will hear the sounds overlaping. But the sound will not play again until it has finished. This can be chabged by playing with the flgas but I haven't tried that yet.
Well, I hpe this litle Jump start helps others to take an interest in DirectX and post there test and conclusoins about this excellent tool.
The truth is out there!
Control Volume Of Embedded Wavs
Hi all. Before my head splits in two from searching for an answer, I wanna run this by anyone who may know.
I'm made a form that has embedded wavs in a .res file. I figured out how to play them using command buttons but I can't find anything on how to control the volume of the emedded wavs that does'nt also control the mater volume of Windows also.
I have a slider control on my form and a module, but the module is coded to control the master volume.
How can I edit this so that it ONLY controls the volume output of the wavs within my form without changing any of my windows volume settings?
Or do I need a completely differnt module?
NEED HELP!!! Prog That Plays Multi- .wavs'
Hello everyone!
I am in dire need of a prog that can play multiple .wav files simultaneously.
Here is what I am thinking for this program:
I am looking for a prog that can play at least 50 .wav files at the same time(or maximum possible, but it would be best to be a higher number like 50).This program should be able to load multiple .wav files at the same time as well(in groups rather than one at a time) to ensure efficient loading of .wav files(to help users who have to many files to load individually).
Below items are optional but would make program MUCH more user friendly and just all around better.
It would be best if the program could save file batches in nameable groups that can be sorted in alphabetical order... kinda like a playlist for easy access and loading.
It would also be best if the program could have a built in timer to stop play after a user input time limit and, if user wishes, move onto another .wav set to play for a separately entered time limit.
I am lacking in skills to code my own program of this caliber, but if any of you can figure this one out than I have quite the idea that could be very prosperous if this program is designed to the above listed specifications.
Thanks all for taking the time to read my post!
Kudos!
CVMichael - Scratching Wavs Program
Remember that scratching program you wrote? I modified it a lot and even made an engine out of it. I either need you or someone who knows DirectSound that can help me loop the sound whether it's playing forward or backward when the Loop checkbox is checked. Can you give me a hand on that? Thanks in advance. Here's the project:
Control Volume Of Embedded Wavs
Hi all. Before my head splits in two from searching for an answer, I wanna run this by anyone who may know.
I'm made a form that has embedded wavs in a .res file. I figured out how to play them using command buttons but I can't find anything on how to control the volume of the emedded wavs that does'nt also control the mater volume of Windows also.
I have a slider control on my form and a module, but the module is coded to control the master volume.
How can I edit this so that it ONLY controls the volume output of the wavs within my form without changing any of my windows volume settings?
Or do I need a completely differnt module?
Relatively Simple Problem Regarding Variables And .wavs
Howdy folks!
I'm been busy slapping together a fantasty football auction tracking program, and one of the pet features I want to include is a "draft announcer". I've gotten most of my goals accomplished already, and I'm not much of a programmer, but it's a fairly simple program. Here's my issue:
I'm reading a .wav filename from a text file. It reads into the variable "playersound". This works fine. My next trick is to load and play the similarly named .wav file, based on the "playersound" variable. So, something like:
PlaySound "C:Dle_auctionMikeVick.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
Except, where "C:Dle_auctionMikeVick.wav" can be loaded in as BrettFavre.wav, LeeSuggs.wav, whatever the player's name is.
I intend to string together .wav files- such as "The Purple Storm select"... "Jeff Garcia"... "for Eighteen Dollars." If anyone has suggestions to make these wavs play smoothly back-to-back, I'd welcome the suggestion as well.
(I recognize this is a simple question. I'm heartened that I've gotten as far as I have without asking any others!)
Thanks in advance.
Adding Wavs To Vb6 Apps At Startup
I am looking to add a wav sound to the start of my app and I can not find the proper code to use at this time.
playsound does not seem to want to work for me
Any Ideas ?
Thanks
Map Buffering
In my game, each of my levels is 64x64 tiles. This is a good size because its optium size while being a nice size to explore. However I want to make it so that levels can connect and players will never see the links in between them so outdoor levels can appear as one big map. I am not sure how to go about doing this efficiently and was hoping perhaps someone has a clue or past experience and could lend me their 2 cents. Thanks!
Buffering...
Hi folks,
i'm using the multimedia control to play an radiostream. That works fine however, I don't know how to display the buffering:
i have:
Code:
Private Sub MP_Buffering(ByVal Start As Boolean)
Label1.Caption = "Status: Buffering " & MP.BufferingProgress & "%"
End Sub
but this only shows buffering 0 % and buffering 100% not the percentage between. How can i display them to?
Buffering
Hi
There are 10000 records have to be kept in the Buffer. If I keep them is there any problem to the programme performance? How many records we can keep in the buffer?
According to the Programme architecture it is necessary...
Please let me know if u know
Buffering In VB
Hi
In VB there is any concept like buffering before i put them in the database ?
Also I tried to Use BeginTrans and CommitTrans using ADOData Control ,but the moment i did recordset.update ,the rollbackTrans didnt work . The Transaction was valid but the roll back at the database did not work.
Could some one tell me how do i implement the above , in any other way ??..
Quick help would be really appreciated.
Thanks a lot,
Arunesh.
Double Buffering
I'm using BitBlt in my game. The screen is refreshed 100 times per second so when a sprite is moved it does not leave a trail. My problem is that the sprites flicker. I thought that the whole point of double buffering was to prevent this. Am i doing something wrong?
Double Buffering
Hey guys, how's it goin? The RPG is rolling along pretty well, but I got a question for ya.. I read something about the concept of double buffering, or page flipping. To get this to work, would I have 2 'main forms' so to speak? One being used as a placeholder (not visible, of course..) to blit the pieces of the new image to, and then the main game form that the user actually sees? Then, for every frame update, i'd have to blit the background map (if a redraw is needed), and the character/monsters/npc's in their new positions to the 'placeholder' form, and once that image is composed, blit it to the actual game form? I suppose I could see how it would make the animation and graphics run smoother, but it seems as if it would run somewhat slower.. I know this isn't going to have any noticeable effects in my game, considering it is a 2d tilebased rpg with very low frame rate (as opposed to like a Quake, or Half-Life..) Well, any help/input is appreciated, as always..
Thanks alot,
Keith
Double-Buffering
Hi every1,
(i'm a newbie, so plz help out!) I heard that to reduce flickering in a game involving timers, i should incorporate something called "double-buffering" so that the images don't flicker. How do i do that?
Thx...
Double Buffering
how to use this code :double buffering
can you explain to me what dose it mean...
double buffered grabs
Double Buffering
How this Double buffering works? If I Refresh window fast it flickers... How I can stop this flickering? I think the key is double buffering?? How it works? Please dont say "Use DirectDraw" I want to learn Basics...!!
Help: How To Buffering Data
hi everyone,
I have a application which has a real-time data "x", I want to set a buffer to buffering latest three input of "x" all the time, like x1, x2, x3, and then read them out. Please help me on this, many thanks.
UDTs And Buffering
First see code below:
Public Type ResultProps
DocumentUID As Integer
TestItemUID As Integer
PassFail As String * 4
ResultDate As Date
NameOfTester As String * 30
Comments As String * 250
End Type
Public Type ResultSummary
Buffer As String * 580
End Type
Here I would like to put all my ResultProps details into the Buffer in ResultSummary. However my question is will my total size be 296 or 580? Using Len to return size gives me 296, but using LenB gives 580 (Strings are twice the size with LenB).
So which do I use (296 or 580)?
Help: How To Buffering Data
hi everyone,
I have a application which has a real-time data "x", I want to set a buffer to buffering latest three input of "x" all the time, like x1, x2, x3, and then read them out. Please help me on this, many thanks
Webclass Buffering
Hi,
Couple of questions:
-How does one set the response code explicity?
-Does anyone know how to enbale buffering in the response object?
Thanks,
Rob
MSComm Buffering
Wonder if anyone's come across my problem in their MSComm work :-
I send a string of say 50 characters to my 'OnComm' event handler . The event triggers for every 8 characters i.e I get 7 receive events. (6*8 + 1*2) If I put a breakpoint in the code just before reading the input then I get the whole string read for a single receive event (which is what I want) Some sort of timing problem ?? I have 'InputLen = 0' and 'RThreshold = 1'. Any ideas ??
Thanks in advance,
Dave.
Quickest Way To Do Double Buffering
Hello,
I am building a game in visual basic. But the images flicker when i move them.
I want to use a double buffer but what is the easiest way to do this.
I done double buffering in java and C++ but I dont fancy writing loads of code, i just want to keep this game simple
Thanks,
Tom
Double Buffering Problem
I read something about double-buffering and that it's helps reducing blinking...
But now I have a problem, I want the buffer-picturebox to be hidden, but then I can't bitblt from the bufferpicturebox to the main-picturebox.
help!
Buffering Media Player In Vb6
Hey all,
I'm using a windows media player control in my app and it is streaming an audio file. Problem is...it stops half way through (i'm guessing to buffer)...so I was trying to find a way to have it buffer before it starts. How do I set the % it buffers to before starting?
Thanks!
|