Back to the Vavoom Forum Archives


Forum

[Fixed] Can't compile with SDL.

Mon, 19 Apr 2004 10:42:17

GregLee

When I try to compile with "USE_SDL = 1" (on Linux) I get compile errors<br><br>source/s_sdl.cpp:430: `Mix_LoadRAW_RW' undeclared<br>source/s_sdl.cpp:433: `Mix_LoadChannel' undeclared<br>source/s_sdl.cpp:452: `Mix_Play' undeclared<br><br>which is understandable, because SDL_mixer-1.2.5 doesn't have those functions.  Neither does the SDL_mixer head from the sdl cvs, and neither does version 1.2.0.  So, I wonder where I can find them. The Allegro sound does work for me, but it's a little washed-out sounding.<br><br>Two other questions I'll just tack on here -- not about bugs.  After a good deal of searching around, I found on  the net a strife1.wad and a voices.wad, however Vavoom tells me "Wad file voices.wad doesn't have IWAD or PWAD id".  Is there anything I can do except just keep looking for wad files?  (I don't have a DOS or Windows system -- just Linux.)<br><br>And, finally, is there a way to get more brightness or contrast in the pictures?  My screen is rather dim, despite having the video options brightness control cranked up all the way.<br><br>Greg<br>
Mon, 19 Apr 2004 17:05:52

Janis Legzdinsh

The SDL port was done by another guy, and he had to add those functions to SDL mixer to make it work. There's a forum topic on this. He said that he sent info about these new functions to th authors of SDL, but I don't know if they have implemented anything.<br><br>It seams that voices.wad that you dot is corrupted. Maybe try to download it again.<br><br>Currently there's no way to get more brightness than that.
Mon, 19 Apr 2004 23:19:27

GregLee

Thanks for the info.  The forum search function doesn't seem to work very well, but I found the post from Carston Schmidt about the functions he added to SDL_mixer.  It's <!-- m --><a class="postlink" href="http://forums.vavoom-engine.com/YaBB.cgi?board=Troubleshooting;message=3;thread=1013537849">http://forums.vavoom-engine.com/YaBB.cg ... 1013537849</a><!-- m --><br><br>But I don't see anything relevant at the reference he gives:<br>http://www.tu-bs.de/~y0011145/<br><br>I'll try downloading again from Home of the Underdogs to get a fresh voices.wad out of strife.zip.<br><br>In looking around here, I see several mentions of problems playing midi files on Linux.  I can play midi files ok with other programs based on Allegro or SDL, but I don't know about Vavoom, yet, because I don't know when in a game a midi file is supposed to be playing.  But I do hear music (pretty cheesy though), using both Allegro and OpenAl.<br><br>
Sun, 02 May 2004 22:12:19

GregLee

I fixed some SDL problems, and I can compile and run the SDL version, now.  I sent patches.  The code for MIDI/MUS files is stubbed, and I'd like to try to fix that, too, but I don't know how to exercise the code.  How can I play a MIDI or MUS file?
Mon, 03 May 2004 17:20:15

Janis Legzdinsh

Ok, I got the Diffs. As of MIDI, if SDL has support for midi then there should no problems in implementing support for them. OpenAL can't play midis so there's no music with that.
Mon, 03 May 2004 23:26:07

GregLee

SDL will play midis ok, or mp3, ogg, etc., but the problem is that it needs a real midi file.  The Allegro midi structures created by the present s_allegm.cpp code, it turns out, are somewhat different from real midi files.<br><br>There is a problem with some sound effects, using the patch to s_sdl.cpp I sent.  They're inaudible.  I tried doubling the frequency passed to the SDL conversion routine, and that helps.  But I don't understand what's going wrong.<br>
Tue, 04 May 2004 18:28:24

Janis Legzdinsh

In Allegro driver I had to do my own loading of midi file into Allegro structure, and mus to midi converted has been correspondingly modified to convert directly into Allegro's midi structure. OTOH Windows driver needs midi file and that's why there a in-memory copy of midi file is generated, so if SDL needs a midi file, take a look at the Windows midi driver.
Tue, 04 May 2004 22:54:41

GregLee

[quote author=Janis Legzdinsh link=board=news;num=1082335340;start=0#6 date=05/04/04 at 11:28:24]...  if SDL needs a midi file, take a look at the Windows midi driver.<br>I will look at it.  But it turned out to be pretty easy to adapt the Allegro midi code.  I thought it was going to be hard because I had made some dumb mistakes in my first effort.  (Second effort has some, too.)<br><br>Should the midi files be archived, once created?  If so, where should they be put?  And how should they be named?  I see some stuff in the code about archiving and scripts, but I havedn't figured out how it works.<br>
Wed, 05 May 2004 00:34:56

Janis Legzdinsh

You should create an in-memory midi file and not store it to the disk.
Wed, 05 May 2004 00:58:29

GregLee

[quote author=Janis Legzdinsh link=board=news;num=1082335340;start=0#8 date=05/04/04 at 17:34:56]You should create an in-memory midi file and not store it to the disk.<br><br>I don't know how to do that.  SDL provides only for playing a midi file, because (I guess) it relies on Timidity to read midi files as well as to play them.  Is there a way to set things up so one can pass the name of a file to be opened and have the "file" in memory?.  Seems to me the Timidity code inside the SDL_mixer library would have to be rewritten.<br>
Wed, 05 May 2004 16:11:52

Janis Legzdinsh

If it's really needed, you can save midi file to a temporary file, open it with SDL and delete it when it's no longer needed.
Thu, 06 May 2004 05:08:40

GregLee

I think it would be better to archive the midi files, and later to look for them first in the archive.  Then, since the SDL Mix_LoadMUS function reads mp3, ogg, mod, or wav files, as well as midi files, it's easy to substitute alternate music.  I got that idea from looking at the w32 code.  So that's what I've done, and I sent you a new version of s_sdlm.cpp.
Fri, 07 May 2004 17:13:25

Janis Legzdinsh

It seams that you sent me s_sdl.cpp and not s_sdlm.cpp.
Sun, 16 May 2004 02:17:28

GregLee

[quote author=Janis Legzdinsh link=board=news;num=1082335340;start=0#12 date=05/07/04 at 10:13:25]It seams that you sent me s_sdl.cpp and not s_sdlm.cpp.<br>Sorry.  I sent the right file several days ago.<br><br>What is the significance of "numchannels" in S_sfx?  If it's 2, I thought it might mean that the input format is a sequence of pairs of unsigned bytes, the first of each pair for the left channel and the second for the right.  But that doesn't seem to be right.  Maybe it means output channels, but then I don't know what to do about it, because all the sounds are converted to 2 channel output by SDL_mixer, anyway.<br>
Sun, 16 May 2004 16:59:08

Janis Legzdinsh

It's maximal number of instances of this sound that is allowed to be played at the same time. If you want to play a sounf and there are already playing numchannels sounds then, depending on priorities, one of them must be killed or new one not to be played at all.
Mon, 17 May 2004 00:37:57

GregLee

I see.  Then here's another question.  What's the "velocity" argument of the Playsound() routine supposed to do?
Mon, 17 May 2004 02:45:22

Janis Legzdinsh

It's velocity of the object who emits the sound and describes in what direction and how fast the sound source is moving. Currently it's not passed to the function and is allways an empty vector, but it may be enabled in later versions to move sound together with the object.
Mon, 17 May 2004 22:07:31

GregLee

I don't see what use the speed information would be.  Doppler effect?<br><br>I've worked some more on the code in s_sdl.cpp -- I emailed a copy.  SDL_mixer has a SetPosition() function, which takes angle and distance as arguments.  The angle is in degrees clockwise from straight ahead.  Is the following a reasonable way to derive the angle?  (Negative angles are ok.)<br><br>
<br>      dir = origin - cl.vieworg;<br>      dot = DotProduct(dir, listener_forward);<br>      angle = -(int)((dot * 360) / MAX_SND_DIST);<br>
<br>
Tue, 18 May 2004 03:39:08

Janis Legzdinsh

The velocity should be used to update sound's position every frame.<br><br>As of angle - it's wrong. This will give you a distance value in forward/backward direction. The angle should be calculated like this:<br><br>[pre]dir = origin - cl.vieworg; <br>fwd = DotProduct(dir, listener_forward);<br>right = DotProduct(dir, listener_right); <br>angle = matan(right, fwd);<br>[/pre]
Thu, 20 May 2004 09:49:27

GregLee

Thank you.  That makes it sound better.<br><br>My current version of s_sdl.cpp achives files and keeps a cache of effects data, so it doesn't have to keep rereading files from disk.  Because of the random frequency variations, the sound data still has to be sent through the SDL_mixer converter, but at least it's only the frequency that has to be changed.<br><br>I'm hoping that with the .wav files to work on off game time, I can process them and make them sound better.<br><br>Is there an appropriate copyright notice accessible from the code for me to stamp the .wav files that were extracted from the wad files?
Thu, 20 May 2004 16:45:02

Janis Legzdinsh

No there isn't. But basicly sounds from Doom wad files are copyrighted by Id Software, from Heretic and Hexen by Raven Software and from Strife by Rogue/Velocity.
Mon, 11 Oct 2004 07:30:19

Janis Legzdinsh

Aplied patches, with some minor modifications.

Back to the Vavoom Forum Archives