Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / I need help.

Author
Message
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 14th Apr 2005 16:38
Hey i am new here and i am teaching my self coding with darkbasic. I am using one of the tutorials on the site but i am having a bit of a problem with the projectile sound. I seem to be doing everything correctly but i cant hear the sound when i shoot the projectile. Im probably making a very obvious mistake, lol.
WhizzRich
22
Years of Service
User Offline
Joined: 30th Nov 2002
Location:
Posted: 15th Apr 2005 08:00
cant get to ur code mate, post it straight into the forum using the code button.

WhizzRich ---
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 15th Apr 2005 12:56
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 15th Apr 2005 17:02
Sync on
Hide mouse
Sync rate 0
Backdrop on

Set camera range 1,5000
Fog on
Fog distance 4000
Fog color RGB(128,128,128)
Color backdrop RGB(128,128,128)

Make matrix 1,10000,10000,20,20

Load image "C:\Darkbasic\grass.jpg",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

Randomize matrix 1,125
x#=5000
Y#=5000

Make object cylinder 1,2
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
Lock object on 1

Make Object Sphere 2,2
Hide Object 2

Load sound "C:\Darkbasic\crickets.wav",1
Loop sound 1

Load 3Dsound "C:\Darkbasic\gunshot1.wav",2

Load Image "C:\Darkbasic\matrix.jpg",2
For x = 0 to 10
Make object plain x+10,5,5
Texture object x+10,2
Set object x+10,1,0,0
Ghost object on x+10
Next x

Rem intialize particle counter
Pn=10

Do
OldcamangleY# = cameraangleY#
OldcamangleX# = cameraangleX#
CameraangleY# = wrapvalue(cameraangleY#+mousemovex()*0.2)
CameraangleX# = wrapvalue(cameraangleX#+mousemoveY()*0.2)

If upkey()=1
Xtest# = newxvalue(X#,cameraangleY#,10)
Ztest# = newzvalue(Z#,cameraangleY#,10)
If Xtest#>0 and Xtest#<10000 and ZTest#>0 and Ztest#<10000
X#=Xtest#
Z#=Ztest#
Endif
Endif

If downkey()=1
Xtest# = newxvalue(X#,wrapvalue(cameraangleY#-180),10)
Ztest# = newzvalue(Z#,wrapvalue(cameraangleY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=Xtest#
Z#=Ztest#
Endif
Endif

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

if Mouseclick()=1 and BulletLife=0
Position object 2,X#,Y#+43,Z#
Set object to camera orientation 2
BulletLife=25
show object 2
Loop sound 2
Endif

If BulletLife > 0
Dec BulletLife
Move object 2,10
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)

inc Pn
if Pn=20 then Pn=10
Scale object Pn,100,100,100
Position object Pn,bX#,bY#,bZ#
point object Pn,X#,Y#,Z#
Zrotate object Pn,rnd(180)

for x = 1 to 10
scale object int((Wrapvalue((Pn-9+x)*36))/36)+10,100+x*25,100+x*25,100+x*25
set cursor 10,10
print int((Wrapvalue((Pn+x)*36))/36)+10
next x

Position sound 2,bX#,bY#,bZ#
set cursor 10,10
if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2) <20
print "hit hit hit hit hit hit hit hit"
BulletLife = 0
Endif

if BulletLife = 0
Hide object 2
stop sound 2
Endif
Endif

Yrotate camera curveangle(cameraangleY#,oldcamangleY#,24)
Xrotate camera curveangle(cameraangleX#,oldcamangleX#,24)

Y# = get ground height(1,X#,Z#)
Position camera X#,Y#+50,Z#

Sync
Loop
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Apr 2005 02:04
I replaced the sounds by one of my sounds and the sounds work fine...
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 16th Apr 2005 02:31
Hmmm.....Well i don't know then, lol. I just cant hear the sound when i fire it, everything else is fine....
Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 16th Apr 2005 07:50
are your speakers on, or the volume turned up? Happens a lot with me.

The happenings of tommorow are behind us now
Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 16th Apr 2005 10:55
Well, first check your volume and stuff like Robot said, then try just playing the actually audio file like in Windows Media Player or whatever else you want to use. If it does play in Windows Media Player or whatever then it should work just fine in DB...

PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 16th Apr 2005 12:51
LoL...Na i can't here it. Only the crickets chirping, no projectile sound....
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Apr 2005 16:57
Mystery solved...
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 16th Apr 2005 17:51
Actually, its not solved....i really should of said i can hear it in media player but not darkbasic....i can only hear the cricket chirping loop noise in DB, not the gunshot....
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Apr 2005 04:30
PuPPy,

What type is the sound? WAV, MP3, etc. Will you upload the sound to this forum for testing, that we may be enabled to help you more efficiently?

+NanoBrain+
Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 17th Apr 2005 07:37
it's a wav

The happenings of tommorow are behind us now
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 17th Apr 2005 16:32
Yes its a .wav but i will upload if it will help.

Attachments

Login to view attachments
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 18th Apr 2005 08:20
PuPPy,

I have noticed that you have not made use of the POSITION LISTENER or ROTATE LISTENER commands. This could be your problem, because the listener is used to calculate 3D sounds based on its position and orientation. The syntax is POSITION LISTENER X,Y,Z and ROTATE LISTENER X,Y,Z. So, make use of these, and place the listener where the player is, and use the same angle values for the listener, as used by the player for his rotation.

+NanoBrain+
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 18th Apr 2005 11:29
NanoBrain,

With those, i have put them in but they still dont seem to make a difference. If you don't mind, could you just show how to place the listner where the player is, because, i have no idea.
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 18th Apr 2005 23:14 Edited at: 18th Apr 2005 23:16
PuPPy,

You are going to want to place the listener at the same location of the camera, since it is a first-person game and you are the listener of the 3D sounds. So, simply place position listener X#,Y#+50,Z#, into your code to do this.

Also, listener rotation is very important also, because it is also a calculator of how intense a sound should be within each computer speaker. Initially, the camera and listener's angle of rotation on any axis will be 0. So, in your case if you just simply place rotate listener Xrotate camera curveangle(cameraangleX#,oldcamangleX#,24),curveangle(cameraangleY#,oldcamangleY#,24),0 will do you fine.

+NanoBrain+
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 19th Apr 2005 16:36
Hmmm i'm still having problems...I will put the code in and if you dont mind, could you place in the position listener and rotate listener so i can see what i am doing wrong.

NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 20th Apr 2005 10:12 Edited at: 22nd Apr 2005 14:32
PuPPY,

In the code snippet below, is the very last lines of your code in which I have edited. Notice how that position listener x,y,z is given the same coordinates that you used to position the camera. Also, rotate listener x,y,z, the x and y coordinates are given the same x and y rotation values as your camera rotation command. I have left the z rotation to zero, since the camera is never rotating on its z axis.

This should fix the problem of not being able to hear your sound. Initially, the listener is placed at coordinate 0 for all axises. Therefore, the listener can only hear sounds to a certain distance.

[EDIT]:



Sorry for the mispost.

+NanoBrain+
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 20th Apr 2005 12:43
I don't see any code snippet below, or are you talking about my other post?
PuPPy
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 22nd Apr 2005 17:55
It worked! Thanks alot for your help

Login to post a reply

Server time is: 2025-05-23 11:29:54
Your offset time is: 2025-05-23 11:29:54