Sound patch

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Sound patch

Post #1by vhpgomes » 01.01.2006, 23:03

Hello everyone, happy new year!!!

I've made a few changes in the code to make Celestia support script controlled sound, i.e., you can tell the program to play a sound file in a script file.

This is the "second release" of this stuff... the first one is in this topic:http://shatters.net/forum/viewtopic.php?t=7628

The previous version really sucked, in many ways... it supported only raw wav files, with very low bitrates; you could only play one file at a time; there was no control on the volume of the sound; etc...

For this new version I used a library called OpenAL (http://www.openal.org), that is cross-platform, so theorically these changes will work in Windows and Mac too, theorically... I don't have a Mac to try...

I wasn't able to compile a windows version, even with a fresh copy of the released source code 1.4.0 (cvs version also doesn't work)... I kept getting several errors messages in the octree.cpp file, something with the DynamicStarOctree... probably the micro$oft compiler is making something stupid with the templates... (I tried with the Visual Studio 2005)

This code was made and tested in Ubuntu 5.10.. tomorrow I'll test in a Fedora Core 4...

The features of this version:
* Supports up to 8 channels (you can play 8 sound files simultaneously) - you can use one as background music, one for narration, one for sound effects, ... (yes, I know sound doesn't travel in space...)
* Supports various formats, and bitrates, .wav files (all wav files that I tried worked just fine)
* Supports both legacy scripts files (.cel) as new scripting language (.celx)
* Supports looping
* Supports volume changing
* Supports play stop

I don't know if there's a way to attach a file in this forum... so I uploaded the patch file to the virtual drive of my ISP. The address is:http://discovirtual.uol.com.br/disco_virtual/rluizfilho/celestia

The password is: celestia

To apply the patch, download the patch file from the above url, and in the root directory of your copy of the celestia code type the command: patch -p1 < path_to_patch_file

This patch works both on the release version 1.4.0 and on the cvs-version (01/01/2006). I didn't tested on previous versions.

I don't know if there's a way to apply a patch file automatically on Windows... You can always open the patch file on the wordpad (it's a text file) and apply the changes yourself.

The patch will only change the source files... To compile you'll have add the OpenAL library. One easy way to do that is add the following to the ./configure command: LDFLAGS=-lopenal. For instance, my full ./configure command was:

Code: Select all

./configure --with-gtk --with-lua LDFLAGS=-lopenal


Of course, this assumes that you already have installed OpenAL on your system, and that it is on the path...


Now, finally, how you use this stuff...

On legacy scripts (.cel):

There's a new command: Play
This command accepts four arguments:
channel - specifies the channel that'll be affected by this call. If not given, will assume the default value of 0, You can put any number between 0 and 7. Any number out of this range will cause the script to fail.
volume - specifies the new volume of this channel. If not given, the volume of the channel will remain unchanged. It starts with the volume 1.0. You can specify any number between 0.0 (minimum, mute) and 1.0 (maximum). If the number given is negative, the value is ignored, and the volume remains unchanged. If the number is bigger than 1.0, the volume will be set to the maximum volume, 1.0.
loop - specifies if the sound file will be played in looping or not. If not given, the looping mode of the channel will remain unchanged. It starts with looping off. The value 1 turns the looping on. Any other value turns the looping off.
filename - name of the file that will be played. The name can be in full path or relative path. Full path names must begin with '/'. Relative path names are relative to the dir <CELESTIA_DATA_DIR>/sounds. The default <CELESTIA_DATA_DIR> is /usr/local/share/celestia. To stop the playback in one channel, you should pass "" as the filename argument.

Small example:

Code: Select all

# start playing background music
play { channel 0 volume 1.0 loop 1 filename "/home/victor/background.wav" }

# do some stuff
wait { duration 5.0 }

# lower the volume of channel 0, so you can hear the narration
play { channel 0 volume 0.4 }

# say something
play { channel 1 volume 1.0 filename "narration1.wav" }

# wait the narration to end
wait { duration 6.0 }

# increases the background volume
play { channel 0 volume 1.0 }

#  some other stuff
wait { duration 3.0 }

# stop the background playback
play { channel 0 filename "" }


On the new script files (.celx)

It's pretty much the same as above...
The command name is celestia:play

It accepts 2 to 4 arguments, that are:

celestia:play(channel,volume,loop,filename)

Their meanings are the same from before. But in .celx you MUST pass always, at least, the first two arguments (channel and volume), or else the script will fail, and the celestia will crash...

The two last arguments are optional... If you need to pass the filename argument, but don't want to change the volume neither the loop you can use the -1 value,

Some examples:


Code: Select all

celestia:play(0,0.8,1,"sample1.wav")

celestia:play(1,1)

celestia:play(1,0.5,-1,"sample2.wav")

celestia:play(2,-1,-1,"sample3.wav")


Well, I guess it's all...

Hope this helps someone out there...

Any doubt, just scream...

Victor

P.S. - Forgive me for my bad english and the very long post...

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #2by Vincent » 04.01.2006, 12:50

Hi Victor,

I'm trying to compile on windows with MS SDK and MS Visual C++ Toolkit 2003. I have already integrated your patch. By the way, I found a typo at the end, in the last 2 lines :

Code: Select all

     lua_pop(l, 1);
 }
script", celestia_createcelscript);
     RegisterMethod(l,
So I didn't consider these 2 lines...

I have also installed the OpenAL library on my system, using the OpenAL 1.1 Core PC SDK.exe file. While compliling, I got an error : celestiacore.h was looking for AL/al.h. So I copied the 'Al' directory in the "Mycelestia/src" folder. Compilation went further, but now I'm getting another error :

Code: Select all

        link.exe @C:\DOCUME~1\user\LOCALS~1\Temp\nm24.tmp
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alSourceStop
 referenced in function "private: void __thiscall CelestiaCore::stopSounds(void)
" (?stopSounds@CelestiaCore@@AAEXXZ)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alSourcePlay
 referenced in function "public: void __thiscall CelestiaCore::playSoundFile(int
,float,int,class std::basic_string<char,struct std::char_traits<char>,class std:
:allocator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_str
ing@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alBufferData
 referenced in function "public: void __thiscall CelestiaCore::playSoundFile(int
,float,int,class std::basic_string<char,struct std::char_traits<char>,class std:
:allocator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_str
ing@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol _alutLoadWAVFile re
ferenced in function "public: void __thiscall CelestiaCore::playSoundFile(int,fl
oat,int,class std::basic_string<char,struct std::char_traits<char>,class std::al
locator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alGenSources
 referenced in function "public: void __thiscall CelestiaCore::playSoundFile(int
,float,int,class std::basic_string<char,struct std::char_traits<char>,class std:
:allocator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_str
ing@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alGenBuffers
 referenced in function "public: void __thiscall CelestiaCore::playSoundFile(int
,float,int,class std::basic_string<char,struct std::char_traits<char>,class std:
:allocator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_str
ing@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alDeleteBuff
ers referenced in function "public: void __thiscall CelestiaCore::playSoundFile(
int,float,int,class std::basic_string<char,struct std::char_traits<char>,class s
td::allocator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_
string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alSourcei re
ferenced in function "public: void __thiscall CelestiaCore::playSoundFile(int,fl
oat,int,class std::basic_string<char,struct std::char_traits<char>,class std::al
locator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol __imp__alSourcef re
ferenced in function "public: void __thiscall CelestiaCore::playSoundFile(int,fl
oat,int,class std::basic_string<char,struct std::char_traits<char>,class std::al
locator<char> > const &)" (?playSoundFile@CelestiaCore@@QAEXHMHABV?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
celestiacore.obj : error LNK2019: unresolved external symbol _alutExit reference
d in function "public: __thiscall CelestiaCore::~CelestiaCore(void)" (??1Celesti
aCore@@QAE@XZ)
celestiacore.obj : error LNK2019: unresolved external symbol _alutInit reference
d in function "public: __thiscall CelestiaCore::CelestiaCore(void)" (??0Celestia
Core@@QAE@XZ)
.\Release\celestia.exe : fatal error LNK1120: 11 unresolved externals
NMAKE : fatal error U1077: 'link.exe' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\
bin\nmake.exe"' : return code '0x2'
Stop.


I'm quite sure this comes from a bad installation of the OpenAL library... So here's my scream : "HELP !"
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #3by vhpgomes » 04.01.2006, 13:41

Hi Vincent,

Your Visual Studio is complaining that he can't find the OpenAL libraries. You'll have to tell him where they are located...

To do that, open your solution and right click on the Celestia project, then click on Properties.

A new dialog will open. On the left, find the Configuration Properties->Linker->General, and click on it. Now on the right will appear, among other properties, Additional Library Directories. You'll have to add here the location of your OpenAL libraries. The default location of them is C:\Program Files\OpenAL 1.1 SDK\libs\Win32. Alternativelly, you can do the same you did with the headers, and copy the contents of this directory to somewhere inside the source tree, like the lib directory.

Now that your compiler know where to look, you'll have to tell him what to look for... still in the properties dialog, go now to Configuration Properties->Linker->Input, and look for the Additional Dependencies on the right. You'll have to add there the two OpenAL libraries: OpenAL32.lib and ALut.lib

That'll probably solve you compilation problem :D

Hope this helps!!!

If anything goes wrong, keep screaming :o

Victor

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #4by Vincent » 04.01.2006, 13:57

Victor,

First of all thanks for your fast reply.
Then, unfortunately, I don't have Visual Studio installed on my system. I managed to compile until now without it... So I can't open any solution... Isn't there another way to do it ?
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #5by vhpgomes » 04.01.2006, 18:51

Ooops, my mistake...

Surely there's another way!!! And it's even easier!!!

Copy both OpenAL libraries (OpenAL32.lib and Alut.lib) to the lib/ directory in your celestia source tree...

Then open the file celestia.mak, it's in the src/celestia directory... and add both libraries to the option LINK32_FLAGS... it should become sometinhg like this:

LINK32_FLAGS=OpenAL32.lib Alut.lib kernel32.lib user32.lib gdi32.lib ...

Then compile...

Hope now it helps

Victor

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #6by Vincent » 04.01.2006, 19:48

Victor,

I had already copied the libraries into the lib folder. So I only added them in the celestia.mak file - that was what I was looking for - and Celestia compiled perfectly ! :D

Unfortunately, no sound is played during my test.cel script. I know that Celestia tries to load my test.wav file because first I put it in the wrong folder, and Celestia displayed a Fatal error message "Failed to open sounds/test.wav". Then I created a "sounds" folder and put my test.wav file in it, and there were no more Fatal error message.
So I can conclude that Celestia managed to load the file.

I tried with 16bits, 8 bits, 44kHz, 22kHz .wav files but I got no sound...

I'm gonna look at it more precisely as I know a bit more things about sound editing than about compiling... :wink: But if you have any clue...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #7by vhpgomes » 05.01.2006, 00:49

I think I found the problem...

I finally managed to compile cvs Celestia on Windows... the .dsw and .dsp files are a little outdated... apparently nobody keeps them up... specially celengine.dsp and celestia.dsp...

But back to the sound patch... when I compiled, I had the same problem: no sound (nice Sound patch huh?). But that's not my fault!!!

The Alut functions in the OpenAL 1.1 SDK for Windows, that you probably downloaded, do nothing... apparently they become only stub functions on version 1.x, since they work fine in my Linux version 0.8... In this new version, you have to download a separate file: freealut Binary ZIP on the same site (http://www.openal.org)... sorry if I didn't realize that earlier...

You'll need three files that are compressed within this new file: alut.h alut.lib and alut.dll (you should have no problem finding them)

You'll have to overwrite the old ones (alut.[h/lib]) with the new ones, and put the new file (alut.dll) somewhere along the path (if you'll use alut only in celestia, leave it on the same directory of the executable, otherwise, put it in windows/system32)

That should fix your no-sound problem (of course, you'll have to recompile your code). One warning though, the previous alut.h includes

Code: Select all

#include <al.h>

and the new one includes:

Code: Select all

#include <AL/al.h>


maybe you'll have to move your files, or edit the new alut.h to make celestia compile...

Finally, looking around the documentation of this new version of Alut, I found some new functions that open diferent formats of files, the docs don't say wich types, but looking in it's code, it opens, at least, .wav,.au and .raw files... if you want to open .au files in your scripts, do the following change in the file celestiacore.cpp

Code: Select all

Function CelestiaCore::playSoundFile

/*  COMMENT THIS
 
    ALenum fmt;
    ALsizei size,freq;
    ALboolean lp;
    void* data = NULL;

   alutLoadWAVFile((ALbyte*)fullname.c_str(),&fmt,&data,&size,&freq,&lp);

    if (!data)
    {
        if (alerter != NULL)
            alerter->fatalError(("Failed to open " + fullname));
        else
            flash(("Failed to open " + fullname));

        return;
    }

    alBufferData(soundBuffers[channel],fmt,data,size,freq);
    free(data); // alBufferData makes a local copy
*/

// AND ADD THIS
    ALuint newbuffer = alutCreateBufferFromFile(fullname.c_str());
    if(newbuffer != AL_NONE)
        soundBuffers[channel] = newbuffer ;
    else
    {
        if (alerter != NULL)
            alerter->fatalError(("Failed to open " + fullname));
        else
            flash(("Failed to open " + fullname));

        return;
    }


Regards,

Victor

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #8by selden » 05.01.2006, 01:15

the .dsw and .dsp files are a little outdated... apparently nobody keeps them up


That's because the "official" developers use the script MAKERELEASE.BAT to build Celestia.
Selden

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #9by vhpgomes » 05.01.2006, 01:52

Yeah, in the end I used that script too... but not before I lost a few hours trying to figure out what was wrong...

Maybe the "official" developers could just remove the .dsw and .dsp files from the cvs ? I mean, if these files aren't used by the developers anymore, their presence can only cause confusion to newcomers like myself...

suwalski
Developer
Posts: 62
Joined: 03.12.2003
With us: 20 years 11 months
Contact:

Post #10by suwalski » 05.01.2006, 06:42

vhpgomes wrote:Maybe the "official" developers could just remove the .dsw and .dsp files from the cvs ? I mean, if these files aren't used by the developers anymore, their presence can only cause confusion to newcomers like myself...


Hear, hear!

This is a good idea. If not that, then to update the workspace files to something usable. I can't figure out how to do it myself.

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #11by vhpgomes » 05.01.2006, 11:44

suwalski,

I kind of figure out how to correct those .dsp files (the .dsw turned to be alright)... didn't do it myself yet, cause didn't have the time... probably will do in the weekend...

I think only the .dsp's from src/celengine and src/celestia are outdated... the main problem is that since no official developer touch them in a while, they refer to source files that shouldn't be compiled anymore, and don't refer to files that should...

For instance, open both engine.mak and celengine.dsp in a file editor, wordpad will do... if you look around these files, you'll notice that the .dsp file refers to the file octree.cpp:

Code: Select all

SOURCE=.\octree.cpp
# End Source File
# Begin Source File

this file is deprecated (apparently) and shouldn't be compiled, on the other hand, the .mak file refers to new files that don't appear in the .dsp, like the dsoname.cpp

Code: Select all

$(INTDIR)\dsoname.obj \


So, basically, what you'll have to do is compare all .dsp and .mak files, and remove from .dsp's those source files that appear only on .dsp's; and add to the dsp's those source files that appears only on .mak's... got it?

Since I didn't do it myself yet, I can??t guarantee that will work, but looks promising...


Victor

suwalski
Developer
Posts: 62
Joined: 03.12.2003
With us: 20 years 11 months
Contact:

Post #12by suwalski » 05.01.2006, 14:37

Maybe they work, but not with current Microsoft programs. It tells me it needs to convert to the latest format and then craps out while doing so.

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #13by Vincent » 05.01.2006, 18:21

Victor,

I have two news for you : one good, and one bad...

Ok, I start with the good one : I can hear sound IN Celestia ! :D That's a big step forward for educational scripts ! No more need to capture a video file and edit it in Premiere to add music (Sepultura of course :wink: ) and comments... Thanks a lot !

Here's the bad one : I don't have any object displayed on screen anymore... A black screen, except the text comments... 8O I think I'll have to check all the changes I made...


added later :

I've checked all the changes I made to cmdparser.cpp, command.cpp, command.h (/src/celengine folder), and celestiacore.cpp, celestiacore.h, celx.ccp, celestia.mak (/src/celestia folder). Everything is OK according to your patch file...

So as usual, if you have any clue...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #14by vhpgomes » 06.01.2006, 11:51

Maybe they work, but not with current Microsoft programs. It tells me it needs to convert to the latest format and then craps out while doing so.


hum... let me guess, you're using the release version of the source code (not the cvs one), and when you open the .dsw file, it asks to converts, then starts complaining about some corrupt files?!?!?!

If so, here's why this is happening:

in the release version of the source code, the .dsw and .dsp files are in UNIX text format, and the Visual Studio will only understand .dsp files in DOS text format (he actually understands the .dsw in UNIX format...).

In UNIX's text files, a new line is represented by a single LF (line feed) byte, while in DOS's text format, it's represented by a pair of CR/LF (carriage return/line feed)... That means that whats a newline to UNIX, isn't to DOS... to see if this is the problem that it's really happening to you, open one of the .dsp file in the notepad (NOT wordpad), if the entire content of the file you opened is in one single line, than bingo, you found your problem, else, you can stop reading this post :?

There's plenty of ways to fix this... there are several tools available that converts it automatically in Windows... I don't have any, since I use the Linux's unix2dos command when I face this problem... google for it and you should find some freeware and shareware...

One quicker way, since there aren't many files to convert in this case, is open the files in wordpad (now yes), since this program converts the file automatically... so all you have to do is open every .dsp file in wordpad and save it back...

Now your Visual Studio will be able to convert the solution/project...

Regards,

Victor

P.S. - For me it works fine... and for me this happened just with the release version, the cvs version is alright...

Topic author
vhpgomes
Posts: 15
Joined: 08.12.2005
With us: 18 years 11 months
Location: Brazil

Post #15by vhpgomes » 06.01.2006, 11:55

Vincent,

Here's the bad one : I don't have any object displayed on screen anymore... A black screen, except the text comments...


I don't know why this is happening :? ... everything is working fine here...

I will try to figure something out on weekend...

Victor

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #16by Vincent » 06.01.2006, 11:58

Victor,

I got it ! The dialog boxes in the render menu were not working. They were all unchecked at Celestia start and when I tried to check them, nothing happened. So I recompiled Celestia. After that, the dialog boxes in the Render menu were still unchecked at first start. But I could check them and then, Celestia displayed the different class of objects on screen.

Now, when I close Celestia a re-open it, my rendering option are kept and my start.cel file works correctly. So I don't need to reactivate all the dialog boxes every time I start Celestia.

So everything is perfect now :D

I'm gonna try several scripts and compare the FPS with and without soundtrack... I'll let you know the results...

Once again, thank you very much Victor for this feature ! And keep up the excellent work ! :wink:
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #17by Vincent » 06.01.2006, 18:13

Hi all,

I did some tests to see the effect of a soundtrack playback on the FPS rate.
I used a 37.4 Mo 16 bits 44kHz wav file, which corresponds to a 3mn 43s high definition soundtrack.
I turned on the following rendering options : Atmospheres, Clouds, Comet Tails, Eclipse Shadows, Galaxies, Nebulae, Night Side Lights, Planets, Ring Shadows, Stars.
My configuration is : current Celestia CVS (1.4.1), Nvidia GeForce 4 MX 440SE with AGP 8X, AMD 2400+, 768 Mo Ram, Win Xp SP1.

Here are the results :

- with the hires default CVS texture of the Earth filling my 1024x768 pixels screen :
> without soundtrack : 39 FPS
> with soundtrack : 39 FPS

- with the Milky Way default CVS .pts filling my screen :
> without soundtrack : 59 FPS
> with soundtrack : 59 FPS

- with the Friendship 7 default CVS model filling my screen :
> without soundtrack : 29 FPS
> with soundtrack : 29 FPS

Everytime I opended the sound.cel script file, the FPS rate decreased by 15 frames for 3 seconds, and then came back to its initial value. So I decided to make a test with a "Placebo.cel" script file with no sound command. I noticed the same 15 frames decreasing of FPS rate for 3 seconds. I concluded that this loss was not due to the soundtrack playback, but to the opening of the .cel file.

In conclusion, Victor's sound feature doesn't seem to lower - in my case - the display performances.
Of course, tell me if I missed something important in my test, or if I made wrong/anticipated conclusions....
I'm going to make more tests with bigger texture files...

@+
Vincent
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Post #18by fsgregs » 07.01.2006, 14:29

vhpgomes and vincent:

EDITED:

THANK YOU :) for this great new feature. As you know, I use Celestia in a high school to bring 160 teenagers into space to learn Astronomy. They are most interested in the program when they can envision actually being in space, cruising in their Celestia spaceship to the destinations I bring them to.

Lots of teachers are downloading my Activities now, and I'd guess they are in use in dozens of classrooms around the world, perhaps hundreds.

The addition of a cockpit overlay (see other thread) has been a wonderful feature for my purposes, and brings the realism a bit closer. The addition of SOUND ... well ... what can I say? :D :D :D

I can now use scripts to load sound effects that will make the concept of cruising in a ship much more real. I can use scripts to order background music to play. Eventually, I can envision major additions to our educational offerings on the Motherlode, with narrated scripts available for download.

I know the code was difficult to implement, and you guys have worked through the bugs wonderfully. That said, I have a request. Would it be possible to install a "pause" keyboard command for sound in the code? Press some keystroke, and the sound simply pauses? Press it again and the wav file resumes. Would that be possible?

If so, could you make that keystroke a flag that a cel:url will read? For example, I use a cel:url to take students inside of the Celestia 1, where the sounds of a spacecraft would be great (hums, radar blips, etc.). In the next scene, I use a cel:url to take them outside of the ship into the silence of space, where no sound exists. It would be great if I could assign a bookmark or cel:url to that place in Celestia, so that it reads the sound flags and either turns on or turns off the background sound.

This could be done by launching and closing several scripts, but they take time to load. A pause keystroke that a cel:url or bookmark could read, would be more convenient and realistic. Of course, this could get complicated (perhaps too complicated) if the script is playing several sounds at once (background music, two sound effect files, etc).

Is it possible? What are your thoughts?

Frank

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Post #19by fsgregs » 11.01.2006, 01:01

Dear Victor and vincent:

I've tested out the new sound feature in Celestia.patched, and it is GREAT!! I am using the Windows build that Vincent assembled. I have a few simple questions.

I would like to include this version of Celestia with my educational activities, along with some sound files which I would like to use. Regarding that:

1. I have no clue what an AL library is. Do I need to "install" an AL library onto my computer before I can hear any sound from a sound script in Celestia?

2. If so, where do I install it?

3. Once it is installed, can I include those library files in my education distribution so that a user does not have to install anything special. Just unzip my Celestia folder onto his computer and any "library files" he needs are already in my folder.

4. Is there any keyboard control over the sound? (mute, increase volume, etc.), or are those commands solely within the script?

5. Since the script can be celx, can I assume I could build into the script a code to give users the option to mute the sound with some keystroke if they wish, from within Celestia?

Thanks guys for this great new feature, and I look forward to your reply. :D

Frank

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Some feedback

Post #20by Chuft-Captain » 12.01.2006, 20:49

Victor,

I have downloaded and installed Vincent's windows version of your sound patch. It's GREAT! I've written a pretty cool demo, but I struck a few problems in the process:

1. It works OK with .WAV files but not with .MP3's -- Are MP3's supposed to be supported? A sound as a WAV file is a lot larger than the same sound as an MP3, which means I can't share my demo with you at the moment because I'm not on broadband (it's 12-30MB with WAV's; with MP3's this would only be a couple of megs). I think it would be good if smaller sound formats could be used as that would reduce the size of addons on the motherlode.

2. Had some problems with starting several short soundbites (from 1 sec to 19 secs long) one after another (on different channels). This kept crashing Celestia.

3. It wouldn't open WAV files with low bit-rates (20kps). I had to convert these ones to 352kps (sample rate=11025, 16bit) for it to work.

4. I think it would be good if your patch also searched for sound files installed in any sub-directory of the Extras folder, in the same way addon models are installed. eg. Celestia\extras\<addon-name>\sounds (There's bound to be an existing method call for this)
This I think would be tidier in the long run than having all the sounds from multiple add-ons being dumped in the Celestia\sounds folder, which is the only place your patch looks at the moment. (I think lots of people will want to add sound to Celestia once they have your patch, so it will get very messy in the sound folder!)

5. When you pause time and scripts in Celestia (space bar), the sound should also be paused, because it's usually going to be synchronised to whatever else is going on in the script. Is this possible?

Cheers
This has got great potential. Keep up the great work!
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS


Return to “Development”