Speaker entity

A forum about everything related to the Cafu World Editor CaWE: mapping, editing, scripting, making GUIs and fonts, using the BSP, PVS and Light compilers.
Post Reply
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:
Speaker entity

Post by Hidong » 2008-11-12, 14:02

I've got some Problems while using the "Speaker entity".
I placed it somewhere, but my Problem is, that Ca3D can not found the specified Soundfile.
The Soundfile it self is laying in sound/file.wav
My Question is, what is the right path to my soundfile?

"Error auto creating sound shader: File 'Sounds/file.wav' not existent

Thanks
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-12, 17:43

Dear Hidong,
Hidong wrote:The Soundfile it self is laying in sound/file.wav
My Question is, what is the right path to my soundfile?

"Error auto creating sound shader: File 'Sounds/file.wav' not existent
The Sounds folder is relative to the game folder. That is, you should put your sounds into folder Games/DeathMatch/Sounds. (The Ca3D-Engine demos already come with some example sounds in this directory, just put yours next to it.)
The name of a sound is then, for example, Sounds/jungle.wav

(Note that you should always used forwar slashes, as in the example above. This way the sound will work on all platforms (Windows, Linux, ...). If you use backward slashes instead (Sounds\jungle.wav), then the sound will only work under Windows.)
:up:
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-12, 20:05

My Soundfile is in Games/DeathMatch/Sounds, but it doesn't work :(
speaker.png
Here is my "speaker" setting
speaker.png (10.53KiB)Viewed 12177 times
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-13, 00:09

Hidong, I'm very sorry, I made a mistake in my previous post! :oops:

When you specify a file name as a sound shader, the path is not relative to the game folder, but to the Ca3D-Engine main directory (the current-working directory).

That is, the correct way to specify the sound file is to include the path relative to the Ca3D-Engine main directory, for example Games/DeathMatch/Sounds/jungle.wav
It works then, I've checked. ;)
You can even use paths beginning with .., e.g. ../../a/very/different/directory but I'd not recommend it. Only absolute paths like c:\xy won't work.

[ In contrast, when you specify a "real" sound shader name in place of a file name, the specification of sounds in shader definition files is relative to Sounds/ (see Games/DeathMatch/SoundShaders/*.caud for examples). ]

I also realized that there is a bug in CaWE: The "classname" in the dialog should of course show "speaker", not "weapon_egon". However it seems that only the display is affected, the internal data structure is still correct, so you can work normally. I'll look into this and fix it for the next release.

Hope this helps, let us know if it worked! :up:
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-13, 22:53

Now the Engine found my sound file, but i can't hear anything :shock:
What did i wrong?

Thanks
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-13, 23:10

Hidong wrote:Now the Engine found my sound file, but i can't hear anything :shock:
What did i wrong?
Are the settings as in the screenshot that you posted, i.e. are the volumes at 1 and is autoplay checked?

Note that an interval value of 0 means that the sound is only played once at level start, which is rarely ever useful. Try values of e.g. 3 or 5, so that the sound is repeated every 3 or 5 seconds. (I'll change the default setting for the next release as well.)
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-13, 23:57

Everything is set up, but no sound. The Soundfile it self is about 1 Minute long.
speaker2.png
speaker3.png
speaker3.png (10.84KiB)Viewed 12145 times
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-14, 00:57

Hmm, the screenshot shows innerVolume=0 and interval=0.
Can you please try innerVolume=1 and interval=30 ?

If it still doesn't work then (btw., do you hear other sounds in Ca3DE, e.g. the weapon-pick-up sound?), please send me your map and sound file, and I'll have a look.
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-14, 01:15

I can hear Weapon and Pick-up Sounds, but not the Speaker sound =)

Here is my map, hope it helps. (i'm using the jungle.wav)
Attachments
Galery.zip
My Map
(20.68KiB)Downloaded 412 times
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-14, 22:52

Dear Hidong,

ok, I looked into the map and the matter. ;)

In the map that you uploaded, the shadername was given as "\Games\DeathMatch\Sounds\jungle.wav" - note the "\" at the beginning.
When you remove the "\", the file name is techically correct.

Then, you're right that there is still a problem: You can hear the sound, but only if you're very close to the speaker, and even then it's usually very low. I found that this is related to distance attenuation computations, which are currently not entirely correctly implemented in the Ca3DE SoundSys.

The biggest problem though is that you cannot change the related settings from within CaWE, but fortunately, there is a work-around:
Instead of using the sound file (Games\DeathMatch\Sounds\jungle.wav) directly, write your own sound shader.

For example, open file Games\DeathMatch\SoundShader\Ambient.caud in a text editor, and add a sound shader like the one that is already there. For example:

Code: Select all

Ambient/MySound
{
    AudioFile   Sounds/myFile.wav    // Now relative to Games/DeathMatch!
    MinDistance 6.0     // This is important, see text below.  :-)
}
The important line is MinDistance 6.0, which causes a better distance attenuation setup.
Without all this, the SoundSys implicitly takes a MinDistance value of 0.0, which causes the problems.
I found that a value of 6.0 causes the sound to be well audible near the source and to fade near the far parts of your map. If you use e.g. MinDistance 30.0, there is even less fading, i.e. the sound is equally loud throughout the map (almost like background music). You may want to experiment with values somewhere in range 2 ... 40 until you find one that you like best. (If you don't want to experiement: 6 or 10 work well. ;) ) Good thing about the sound shader is that you don't have to recompile your map whenever you changed the value.

Then, back in CaWE, use Ambient/MySound (from the example above) for the shadername. The other settings in CaWE about volume etc. remain valid, as they override any equivalent settings from the sound shader definition file.

Btw., great map!! :up:
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-15, 00:05

Thanks, but the Map is still in a very early status (0.01) :D

I had done everything, you say, but i can't hear any sound!!!
There must be something, that i do wrong.
Is it possible, to send me a "testmap" with a standart Sound that works at your PC?
It will be great :lol:

Thanks
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-17, 00:15

Hidong wrote:There must be something, that i do wrong.
You're doing everything right, the fault is with Ca3DE. :roll:
I'm still investigating the issue (tomorrow at the office I'll be able to make faster progress), but I've already narrowed down the cause and will post more details early this week.

In the meanwhile, as a work-around, could you please try to compile the map with CaBSP only? That is, omit CaPVS and CaLight (in the "Compile" menu at http://www.ca3d-engine.de/wiki/mapping:compiling_new, un-check steps 3 and 4). Then it should work and you should hear the sound.
Note that you should still use the hand-written sound shader as explained in my previous post. For my tests, I also reduced the interval setting to 3 (rather than 30) for better testing.

I'll fix all these issues for the next release, and when I tomorrow learn the precise cause of the problem, I might be able to come up with a better solution to bridge to time until the next release.
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-17, 18:28

I have to augment my previous post:
In the old test map that I used (Maps/TestPatches.cmap), the speaker was wrongly placed "inside" a solid entity :shock: :
TestSpeaker.png
TestSpeaker.png (888Bytes)Viewed 12072 times
(Note how the origin of the speaker is inside the small solid brush, outlined green.)

This was the problem that caused the speaker to work in my tests when the PVS was not taken into account (map compiled with CaBSP only), but failed when the PVS was properly activated (map compiled with CaPVS, too). So everything worked all right here, the fix is of course to move the speaker slightly out of the solid brush.

Hidong, as your map did not seem to be affected by this problem, I'll send you a working .cw world file for further testing later tonight. :up:
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Speaker entity

Post by Carsten » 2008-11-17, 21:49

Ok, attached to this post you find a small test map with a speaker that works.
Tested on Win2000 and WinXP, both with the OpenAL sound system implementation and FMOD. The speaker is plainly setup just as explained above.

Please let us know if this map work for you, we can then continue to find the problem in your map.
Attachments
TestSound_cmap.zip
The cmap source file.
Copy into Games/DeathMatch/Maps, then you can open it like the other maps with CaWE.
(3.29KiB)Downloaded 425 times
TestSound_cw.zip
The precompiled cw world file.
Copy the unzipped file into Games/DeathMatch/Worlds, then select "TestSound" in the New Game list.
(83.46KiB)Downloaded 401 times
Best regards,
Carsten
User avatar
Hidong
Posts:22
Joined:2008-04-19, 21:09
Location:Germany, Bremen
Contact:

Re: Speaker entity

Post by Hidong » 2008-11-18, 07:39

Wow, i can hear sounds :D :D :D
Your Map works fine. I've compiled it with capvs and light and it works, too.
Today i copy your entity to my map, and test this then.

Thank You Carsten, Master :lol: :wink:
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests