03-31-2007, 06:51 AM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
Notice that in the desired format it shows a frequency and bits per sample values of 0. This is why it said it's not in the desired format. It probably got 0 because I haven't gotten my sound card on my new machine set up yet, and so there's no sound card to get info from. I got around this by writing a default constructor for the SOUNDINFO class that initializes frequency and bytespersample data members to reasonable values (44100 and 2 respectively).
Despite this being fixed, I still get crashes when I try to start a game and record a replay:
Code: include/bipointer.h,63: Asked for NULL pointer
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47299085896560 (LWP 4457)]
0x0000000000466bd5 in SOUNDSOURCE::SetPitchSmooth (this=0x0, newpitch=0.143025964, dt=0.00400000019) at src/sound.cpp:1042
1042 pitch = pitch*(coeff)+newpitch*(1.0-coeff);
(gdb) bt
#0 0x0000000000466bd5 in SOUNDSOURCE::SetPitchSmooth (this=0x0, newpitch=0.143025964, dt=0.00400000019) at src/sound.cpp:1042
#1 0x000000000048a11d in VAMOSWORLD::Update (this=0xbe04e0, timefactor=1, fps=250, js=0x68dac0) at src/vamosworld.cc:933
#2 0x000000000040d892 in Update () at src/main.cpp:437
#3 0x0000000000410c27 in main (argc=1, argv=0x7fff0017e918) at src/main.cpp:1990
|
|
03-31-2007, 11:54 AM,
|
|
joevenzon
Administrator
|
Posts: 2,679
Threads: 52
Joined: Jun 2005
|
|
Ohhh, you don't have a sound card? Then run "vdrift -nosound"
I'm going to remove the changes to the constructor you made, because they'll let you get around the checking and load things without successfully initializing first, which, as you found, is bad. By the way, the copy constructor and operator= members you wrote are not needed because the defaults will work fine and will automatically update whenever the class members change....
Did you get an "Error opening audio device" or "Sound interface did not create...etc" when you started the game? If so, I can make it just disable sound automatically when that happens.
|
|
03-31-2007, 02:30 PM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
Ah yes, I forgot about the -nosound option...but really there should be some way VDrift figures this out on its own, instead of crashing.
edit: anyway it still doesn't work.
Code: SOUND FORMAT:
Samples: 37516
Frequency: 44100
Channels: 2
Bits per sample: 16
DESIRED FORMAT:
Samples: 37516
Frequency: 0
Channels: 2
Bits per sample: 0
src/sound.cpp,589: Sound file isn't in desired format: /home/thelusiv/code/vdrift/data/cars/NS/engine.wav
SOUND FORMAT:
Samples: 52332
Frequency: 44100
Channels: 2
Bits per sample: 16
DESIRED FORMAT:
Samples: 52332
Frequency: 0
Channels: 2
Bits per sample: 0
src/sound.cpp,589: Sound file isn't in desired format: /home/thelusiv/code/vdrift/data/cars/M8/engine.wav
Unable to find the file: /home/thelusiv/code/vdrift/data/cars/M8/glass.joe!
Unable to find the file: /home/thelusiv/code/vdrift/data/cars/M8/interior.joe!
Error when loading car definition file: /home/thelusiv/code/vdrift/data/cars/M8/M8.car
Unable to find the file: /home/thelusiv/code/vdrift/data/cars/RS2/interior.joe!
Error when loading car definition file: /home/thelusiv/code/vdrift/data/cars/RS2/RS2.car
Unable to find the file: /home/thelusiv/code/vdrift/data/cars/M8/glass.joe!
Unable to find the file: /home/thelusiv/code/vdrift/data/cars/M8/interior.joe!
Error when loading car definition file: /home/thelusiv/code/vdrift/data/cars/M8/M8.car
include/bipointer.h,63: Asked for NULL pointer
Segmentation fault (core dumped)
Pretty sure this is related to replays though, not sound.
|
|
03-31-2007, 06:31 PM,
|
|
joevenzon
Administrator
|
Posts: 2,679
Threads: 52
Joined: Jun 2005
|
|
I don't think it's due to replays. The last line is my bipointer class (a poorly named smart-ish pointer class) telling us that someone asked for a pointer that's NULL. If something's asking for a pointer that's NULL, it's probably because it's about to use it (and create a SEGFAULT). The only class using bipointers is the sound class, and it's used by the gl_car class to get a reference to newly created sources. Like I said, normally when you get a "src/sound.cpp,589: Sound file isn't in desired format" message, I'd throw an exception and have the game quit, because you're going to get a crash later. To say that another way, the game will crash if you get this message. So, don't be surprised. :-)
|
|
04-01-2007, 12:43 PM,
|
|
abs1nth
Senior Member
|
Posts: 358
Threads: 5
Joined: Sep 2005
|
|
trunk wasn't compiling anymore since about 1654, this fixes it but i don't know if it is correct:
Code: Index: include/sound.h
===================================================================
--- include/sound.h (Revision 1667)
+++ include/sound.h (Arbeitskopie)
@@ -41,7 +41,7 @@
void Load(const string & filename, const SOUNDINFO & sound_device_info);
void Unload() {if (loaded && sound_buffer != NULL) delete [] sound_buffer;sound_buffer = NULL;}
- const SOUNDINFO & GetSoundInfo() const;
+ const SOUNDINFO & GetSoundInfo() const {return info;}
//const SOUNDINFO & GetOriginalInfo() {return original_info;}
//const unsigned int GetSize() {return size;}
//void ConvertTo(const SOUNDINFO & to_info);
Index: src/sound.cpp
===================================================================
--- src/sound.cpp (Revision 1667)
+++ src/sound.cpp (Arbeitskopie)
@@ -946,11 +946,6 @@
sample_pos = (sample_pos + offset*playing) % buffer->GetSoundInfo().GetSamples();
}
-inline const SOUNDINFO & SOUNDBUFFER::GetSoundInfo() const
-{
- return info;
-}
-
SOUNDSOURCE & SOUND::NewSource(const string & buffername)
{
if (disable)
|
|
|