|
-
Jun 10th, 2001, 05:41 AM
#1
Thread Starter
Lively Member
DirectSound
Hi.
I tried using DirectSound in my game but it did not work.
What's happening is that when I run my program, it doesn't run. Instead, VB is just closed.
Can someone help me please?
Thank you.
-
Jun 10th, 2001, 05:45 AM
#2
PowerPoster
Could you provide a little more info please?
What error messages, where's it crash, an example of the code?
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Jun 10th, 2001, 08:19 AM
#3
PowerPoster
You can review my DSound8 example
-
Jun 10th, 2001, 10:38 AM
#4
Thread Starter
Lively Member
Fox, I'm using DirectSound7.
-
Jun 10th, 2001, 10:40 AM
#5
Thread Starter
Lively Member
Arbiter, there aren't any error messages.
VB is just closing its window.
-
Jun 10th, 2001, 04:13 PM
#6
Good Ol' Platypus
It would help if you posted some code
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 10th, 2001, 04:33 PM
#7
Thread Starter
Lively Member
OK, this is somehow the code I'm using:
Code:
LoadSounds 'using CreateSoundBufFromFile()
LoadGraphics 'Using CreateSurfFromFile()
Game Loop
If Certain_Condition Then
Play
End If
Loop
StopSounds 'Buffer.Stop
UnloadSounds 'Buffer=Nothing
-
Jun 10th, 2001, 05:32 PM
#8
Good Ol' Platypus
I would need actual VB code, if you could post it.
Don't worry we wont steal
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 11th, 2001, 02:42 AM
#9
PowerPoster
Well, there's not a lot to go on there... 
Are there no error messages because you're trapping them?
If you step through the code line by line and then have a look at the line that's causing it to fall over it may give you a clue.
If you could post the code and then point out the line that's the culprit we could have a look.
PS - Fox's tutorials are normally pretty good. Have you had a look at his code and see if it's of any use?
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Jun 11th, 2001, 05:33 AM
#10
-
Jun 11th, 2001, 12:07 PM
#11
Thread Starter
Lively Member
-
Jun 12th, 2001, 10:49 AM
#12
Thread Starter
Lively Member
Very Urgent
Please,
DSound worked once and only once.
Can I please post my game for someone to try and help me, because I think the only solution.
Thank you for all those who will help me, you will be saving my life.
-
Jun 12th, 2001, 12:11 PM
#13
Lively Member
here is the problem
Set Buffer = dsMain.CreateSoundBufferFromFile(Picture.bmp, BufferDesc, wavFormatex)
should be
Set Buffer = dsMain.CreateSoundBufferFromFile(Sound.wav, BufferDesc, wavFormatex)

Chris
-
Jun 12th, 2001, 02:19 PM
#14
Thread Starter
Lively Member
Oups!
I'm sorry I haven't moticed what I wrote.
But this isn't what I wrote in my code, OK?
I still need the urgent help.
Thank you.
-
Jun 12th, 2001, 03:06 PM
#15
PowerPoster
If there's somewhere we can download your game we can have a look.
A tip - In order to narrow down where the fault it you could strategically place message boxes through the code starting at the beginning. Crude, but effective.
Bit like me really....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Jun 12th, 2001, 03:14 PM
#16
Lively Member
The Way I do it
VB Code:
'I set up a UDT
Type DSSound
Filename As String
Loop As Boolean
DBuffer As DirectSoundBuffer
DSDesc As DSBUFFERDESC
WAVEFORMAT As WAVEFORMATEX
Number As Integer
End Type
'declare it
Public TheSounds(0 to 99) As TBSound
'I pull values in through an xml file, to get filename and number
' THen I load all my sounds
Function LoadSounds() As Boolean
Dim I As Integer
For I = 0 To UBound(TheSound)
Set TheSound(I).DBuffer = DS.CreateSoundBufferFromFile(App.Path & _
"\sound\" & TheSound(I).Filename, TheSound(I).DSDesc, _
TheSound(I).WAVEFORMAT)
Next
End Function
'then to play it
TheSound(uSoundNumber).DBuffer.Play DSBPLAY_DEFAULT
Hope that helps some
Chris Wilson
Last edited by TType85; Jun 12th, 2001 at 04:22 PM.
Chris Wilson
-
Jun 12th, 2001, 03:41 PM
#17
Thread Starter
Lively Member
I'm sorry but I did not understand your code.
-
Jun 12th, 2001, 03:57 PM
#18
Lively Member
ok here it is a bit simpler :)
VB Code:
Dim DBuffer as DirectSoundBuffer 'Direct Sound Buffer
Dim DSDesc as DSBUFFERDESC 'Direct Sound Buffer Description
Set DBuffer = DS.CreateSoundBufferFromFile(whatever.wav, DSDesc, WAVEFORMATEX)
'Non-Looping
DBuffer.Play DSBPLAY_DEFAULT
'Looping
DBuffer.Play DSBPLAY_LOOPING
Last edited by TType85; Jun 12th, 2001 at 04:21 PM.
Chris Wilson
-
Jun 12th, 2001, 04:10 PM
#19
Good Ol' Platypus
Use the new vbCode tag:
VB Code:
For I = 1 To 3
If I > 2 Then
Do
Msgbox "HaHa"
Loop
End If
Next I
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 13th, 2001, 04:24 PM
#20
Thread Starter
Lively Member
Actually, Sastraxi, I'm so mad at this game that I can't laugh for the moment.
And by the way, TType85, the second code you gave me is the one I'm using (or is this a jake that I did not understand? )
-
Jun 13th, 2001, 04:48 PM
#21
Thread Starter
Lively Member
I don't know if you will believe this, I know I don't, but DS worked just like that.
I don't know how it did, I haven't changed anything in the code, but it just felt like working so it did!
-
Jun 14th, 2001, 12:02 AM
#22
PowerPoster
...and I still recommend you starting out with DX8
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
|