bass.dll - sorry to bump

Blitz3D Forums/Blitz3D Userlibs/bass.dll - sorry to bump

John Blackledge(Posted 2009) [#1]
I'm afraid that Abrexxes may have stopped reading the other thread believing it to be answered.

But I still have a problem with bass.dll, so sorry people I have to bump this question...

Turning my camera has no effect on the 3D sound.
Obviously I need something like your BASS_Set3DPositionFront%(X#,Y#,Z#) function.
I've fed in the X#,Y#,Z# coords of a target pivot always directly in front of the camera, thus providing orientation, but to no avail.
Sorry to bother you again Abrexxes, but can you explain how to use this call?

The overall problem is that if bass cannot be made to react to a camera turning then 3D sound goes out the window, and it becomes just a super vu meter driver.


Abrexxes(Posted 2009) [#2]
Hi, i am sorry that i have also a RL. ;)

You now that you must update the bass3D position with your cammera?

;from demo_3D.bb
If KeyDown(203)
		MoveEntity camera,-0.1,0,0
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))
	Else If KeyDown(205)
		MoveEntity camera,0.1,0,0
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))
	EndIf
	
	If KeyDown(200)
		MoveEntity camera,0,0,0.1
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))	
	Else If KeyDown(208)
		MoveEntity camera,0,0,-0.1
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))	
	EndIf

;And dont forget 
BASS_Apply3D()
	Flip


Else, can you make me a little example that i can try, so i can maybee reproduce your problem here?

cu

cu


John Blackledge(Posted 2009) [#3]
Yeah, I've already got BASS_Set3DPositionPos working thanks to your example.

But it's BASS_Set3DPositionFront that I have to get working, otherwise when I turn the camera to left or right (standing in the same place) there's no change.


Abrexxes(Posted 2009) [#4]
Ok... see your problem now

i am working on the next update for BBS. I think i will rewrite some 3D stuff to make it easier to use. I dont think that i will release a new version this week(end). But i will take a closer look to the 3D secion first and try to give you the new stuff as an inoffiziel release during this weekend.

so..you can be my betatester. ;)


John Blackledge(Posted 2009) [#5]
I'll gladly test.
The surrounding code is all set up.


Abrexxes(Posted 2009) [#6]
just to understand, this here (just copie to the demos of bass) works fine for me. So what you want is now to "turn" the camera? Right?

Include "includes\bass.bb"

Graphics3D 800,600,32,2
camera=CreateCamera()
PositionEntity camera,0,0,-10
TurnEntity camera,0,0,0
CameraRange camera,0.1,10000
AmbientLight 255,0,0

character = CreateSphere(32)

BASS_Init(-1,44100,BASS_DEVICE_3D,0,BASS_NULL)
;file$ = "media\dfor.ogg" ; <- your file here
; for this demo make sure it's a good 'speaking' file with lots of pauses.
;channel = BASS_StreamCreateFile(0,"media\snare.wav",0,0,BASS_SAMPLE_3D)
channel  = BASS_MusicLoad(0,"media\Stardust.mod",0,0,BASS_SAMPLE_3D,0)
BASS_ChannelPlay(channel,BASS_TRUE)
;BASS_Set3DFactors(0.9144, -1.0, -1.0) ; don't think this is needed.
BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera)) ; set initial Listener pos

Repeat

	; Move the character around the stereo field
	deg# = deg# + 0.5
	If deg# => 360 Then deg# = 0
	cx# = Sin(deg#) * 7
	cz# = Cos(deg#) * 7
	PositionEntity character,cx#,0,cz#
	UpdateWorld
	RenderWorld

	; Update where the character is speaking from	
	pos=CreateBank(12) : rot=CreateBank(12) : vel=CreateBank(12)
	PokeFloat pos,0,EntityX(character,1) : PokeFloat pos,4,EntityY(character,1) : PokeFloat pos,8,EntityZ(character,1)
	PokeFloat rot,0,0 : PokeFloat rot,4,0 : PokeFloat rot,8,0
	PokeFloat vel,0,0 : PokeFloat vel,4,0 : PokeFloat vel,8,0
	BASS_ChannelSet3DPosition(channel,pos,rot,vel) 
	FreeBank pos : FreeBank rot : FreeBank vel

	; Update the Listener if camera moved.
	If KeyDown(203)
		MoveEntity camera,-0.1,0,0
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))
	Else If KeyDown(205)
		MoveEntity camera,0.1,0,0
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))
	EndIf
	If KeyDown(200)
		MoveEntity camera,0,0,0.1
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))	
	Else If KeyDown(208)
		MoveEntity camera,0,0,-0.1
		BASS_Set3DPositionPos(EntityX(camera),EntityY(camera),EntityZ(camera))	
	EndIf

	If KeyDown(57) Then BASS_ChannelPlay(channel,BASS_TRUE) ; play again

	BASS_Apply3D()

	; Instructions
	Color 255,255,255
	Text 400,600-60,"Press Spacebar to restart sound", True, True
	Text 400,600-40,"Use arrows to slide forward, backward, right, left", True, True
	Text 400,600-20,"Camera "+EntityX(camera)+" "+EntityY(camera)+" "+EntityZ(camera), True, True

	; Get the Level/Amplitude of the channel
	; Maxumum should be 32767 on either left or right
	vumono = BASS_ChannelGetLevel (channel)
	vuleft = BASS_MakeLoWord (vumono)
	vuright = BASS_MakeHiWord (vumono)
	If vuright < 65535
		Text 0,020,"Left channel : "+vuleft
		Rect 0,050,vuleft/100,20,1
		Rect 0,090,vuright/100,20,1
		Text 0,120,"Right channel : "+vuright
	Else
	 vuright = 0 ; ended, so close the mouth.
	EndIf
	
	; Simulated mouth response
	Color 204,127,125
	Rect 600,50,100,50,True
	If vuright < 7500 ; adjust this for the threshold below which it's closed.
		Color 0,0,0
		Rect 605,75,90,1,True
		Color 255,255,255
		Text 600,30,"Closed"
	Else
		Color 255,255,255
		Text 600,30,"Open"
		Rect 610,65,80,20,True
		Color 0,0,0
		Rect 610,70,80,10,True
	EndIf
	
	Flip
Until KeyDown(1)
BASS_Stop()
BASS_Free()
End



John Blackledge(Posted 2009) [#7]
Yeah - that's my code, based on yours ;)

Move left, sound comes out of the right speaker - correct.
Turn 90 degrees right - sound should come out of the left speaker, but nothing changes.


Abrexxes(Posted 2009) [#8]
Yep, i will rewrite some 3D stuff and make a new demo. I see that this part of my code need some polish.


Abrexxes(Posted 2009) [#9]
Good news, i solwed all the problems. Tonight you will have a demo (exe) with 3 object on a plane. Every object has "his" music and you can move around and turn the camera to listen every music. ^^

I found out that my 3D part is realy bad, but i never used it and no feedback. I will rewrite some stuff and hope that i can give you this weekend a copy of the current BBS that you can use to work on your project.

bye


Abrexxes(Posted 2009) [#10]
This is a demo of the new 3d functions (exe/win32)

http://www.abrexxes.huntingsoftware.de/temp4/3dtest.zip

The only that work not at the moment is "your" turn_entity value (camera). I am still working on it.

What works is: Channel3DPosition, Bass3Dposition,distanceFaktor, rollOver, doppler faktor
for the channels: 3D processing mode, min3DvolDistance, max3DvolDistance, The angle of the inside projection,The angle of the outside projection ,The delta-volume outside the outer projection ...so...BASS_ChannelSet3DAttributes

bye


John Blackledge(Posted 2009) [#11]
That's the one I need, so I'll wait for that.
Thanks for all the work you're doing Abrexxes.