bass.dll + 3D?

Blitz3D Forums/Blitz3D Userlibs/bass.dll + 3D?

John Blackledge(Posted 2009) [#1]
I've succesfully used bass to get the 'level' of a wav file, so I can drive a characters lip-sync. So far so good.
But now I would like to attach the sound to a 3D entity like Blitz's EmitSound() command.

The bass help file says:

BOOL WINAPI BASS_Set3DPosition(
BASS_3DVECTOR *pos,
BASS_3DVECTOR *vel,
BASS_3DVECTOR *front
BASS_3DVECTOR *top
);
Parameters
pos The position of the listener... NULL = leave current.

The position of the listener????
Shouldn't that be the position of the Entity?
Any help would be appreciated.


Abrexxes(Posted 2009) [#2]
see blitz_bass_Studio_help_funktions.txt for this.

Note: It is "possible" that also with this you will habe a bug.

In this case whait for my next version, it will habe a:
BASS_Set3DPosition(
BASS_3DVECTOR *pos,
BASS_3DVECTOR *vel,
BASS_3DVECTOR *front
BASS_3DVECTOR *top
);

command, but commpatible to older BBS Versions.

bye


John Blackledge(Posted 2009) [#3]
I've not even got that far, though the code is built in.

Using Leadwerks old code BASS_SamplePlay(sound) works fine but cannot get BASS_SamplePlay3D(sound,pos,rot,vel) used like EmitSound() to make any sound _at all_.
The return value is zero.
So until it makes a sound there's no point me trying to set a position.

Actually I've not yet seen _any_ working example of either call, so I'm beginning to think BASS_SamplePlay3D() is broken.
- which is a shame because I've managed to finally grab the level and am using it for lip-sync.


Abrexxes(Posted 2009) [#4]
I am sorry, but since bass 2.1 BASS_SamplePlay3D no longer exits. You must use a recent Version because the API has changed completely and older versions are not longer supported (since years).

Download BBS (Signature/Bass 2.3) and try the 3D demo included.

bye


John Blackledge(Posted 2009) [#5]
Thanks for pointing me in the right direction.
BASS_Init(-1,44100,BASS_DEVICE_3D,hWnd) needed the BASS_DEVICE_3D flag and now I have 3d playback.
Unfortunately level = BASS_ChannelGetLevel(chan) now returns -1 (error).
Continuing working on it...


Abrexxes(Posted 2009) [#6]
Try the demos (most of them use GetLevel), if there is a Problem, look in your Windows/system32 folder if there is an older bass.dll. ich yes, delete this one.
Local vuglobal = BASS_ChannelGetLevel (music);mono
Local vuleft = BASS_MakeLoWord (vuglobal)
Local vuright = BASS_MakeHiWord (vuglobal)
;Stereo


Else you must give me a "Working Projekt" so i can reproduce this.

bye


John Blackledge(Posted 2009) [#7]
Abrexxes - thanks, I've realised that I'm using a very old verion of bass and Leadworks old code from 3 years ago.

I have downloaded the latest veersion of bass, but of course my decls is out of date.
Can you point me to the latest decls?


John Blackledge(Posted 2009) [#8]
Update, the latest version of bass.dll with the last known version of the decls causes a Memory Access Violation when running my prog (i.e. loading the dll).

I would appreciate any help here.


LineOf7s(Posted 2009) [#9]
John, the most recent version of any decls file that works with the latest (or near-latest) version of BASS is Abrexxes' own Blitz Bass Studio. It's far and away the most well-maintained and complete Blitz3D/BASS solution currently available (and it's freely available from Abrexxes' signature).

Are you using that? And if not... are you INSANE? ;o)

If you're not, I'd seriously suggest that being your first port of call, rather than faffing about with quite old dribs and drabs of outdated decls and whatnot (and there have been a few - much appreciated - attempts to wrap BASS throughout the years).


John Blackledge(Posted 2009) [#10]
Argghh!
LineOf7's - I had already downloaded the zip, didn't find a normal decls, only the mod one, so gave up and went back to the last version.

I now find the original zip didn't extract properly (-probably my fault, we all know about tiredness here, don't we).
So I now have the full package. Whew.
Ongoing...

Thanks for the help.
And it's nice that you speak so highly of Abrexxes work.


LineOf7s(Posted 2009) [#11]
The fact that Abrexxes isn't charging for it just shows me that he's insane, but I'll take advantage of that for as long as I can.

It really is top-notch stuff, and I'm glad my poke was enough of a heads-up for you to realise your extraction had issues (oo-er).

Looking forward to your lip-synching technique, btw. :o)


Abrexxes(Posted 2009) [#12]
First, thanks for this words LineOf7s, realy nice to read this. :)

The fact that Abrexxes isn't charging for it just shows me that he's insane


I think it is really important for every community if there are peoples who dont ask money for every 10LineCode Wrapper. Bass is from "Ian" and i dont want to have money for "his" great (near fmod the best) audio engine. Dont forget that Bass is only "free" for non-commercial use. If you buy a licence for bass, you have still the best audio engine for a lot of languages (not only Blitz).

but I'll take advantage of that for as long as I can.


I dont take money for my blitz port, not for BBS (Bass 2.3) and not for updates in the future (Bass 2.4), not today and not tommorow. Just, to clear up this point.

bye


John Blackledge(Posted 2009) [#13]
I don't think that there are thanks enough, when someone does months of work and gives it away for free. It's inadequate, but thanks Abrexxes.

3D movement + Channel level detection (- which should be called 'amplitude') to lip-sync by the end of the day, I hope.
I'll post.


John Blackledge(Posted 2009) [#14]
Here's my modified Bass 3D demo.
1) The sound source position is attached to a moving 'character'.
2) Channel level is detected and used to open and close a 'mouth'.
I will be using two textures in my engine, one with mouth open, one with mouth closed, using EntityTexture() as appropriate.
In an ideal world I would attach a new bone to the neck of my character(s) to animate the jaw, but currently I'm using FPS Creator characters (good quality) and if I attach a new bone at all, even before I try to move it, it screws up the animation of the whole model.(?)
So for now I'll just make do with swapping the textures.
Thanks to all on this forum for pointing me in the right direction, and once again to Abrexxes for making free his brilliant work.
Here's the code:



Abrexxes(Posted 2009) [#15]
What can i say? I am happy to see that my work helps others. :)


John Blackledge(Posted 2009) [#16]
Err... just one more thing: 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?


Abrexxes(Posted 2009) [#17]
News:

About the 3D problem: I am only working an listeners position, all the rest ist well done
About the TAG Problems: I will write latter a new "include" for this. (also for Tag 2.4)
About Protracker EX: The modinfo that i use will be included in the next version (modinfo 1.5) (but without DRAW3D you will not be able to have the speed that i have in the Pex Demo. 2D..no chance ;) )
About CD Playback: Yes there is a bug, dont use "device description (with bass_cd.dll)" at the moment.
About the release: I am sorry, i do my best but i have also a RL, i think 15 days from now.
AND: Next version will be compatibel to 1.6.1...so no problems (well..maybee the 3D commands,,i will see)

bye


John Blackledge(Posted 2009) [#18]
Abrexxes, as I said, this is about camera turning, not camera position.
As I turn my camera to the left the sound should swing around to the right.
Possibly the BASS_Set3DPositionFront%(X#,Y#,Z#) function takes care of this, if you could just explain what x,y,z represent.
Thanks for all the work anyway.


Abrexxes(Posted 2009) [#19]
I know, sorry for my bad english. ;) You are right, thats the problem (i know), i will wrapp this (type/pointers) in new functions but i am making some test before to release a "stable" update. Also make the demos, the docs etc etc.


John Blackledge(Posted 2009) [#20]
Well that's the only call I found that needs attention.
But new help docs would be nice - thanks.