MP3 Crash

Started by
1 comment, last by johnrudy 22 years, 7 months ago
I''ve been working on a technology demo using the demo version of beta 8. (I''ll be regging once the tech demo is done and I know I can use PR to actually build the game.) In main(), I call PR_InitializeMP3(), then call PR_SetMP3Volume(63). I have a method for getting user input. If the user inputs 1, 2 or 3, a specific MP3 file should play. The code used is: PlayMP3 (char file[]) { sprintf(buf, "base\\music\\%s", file); PR_PlayMP3(buf, TRUE); } Later on, when shutting down the program, I call PR_ShutdownMP3(). I''ve tested that buf actually contains what it should (EG: "base\music\The Dust Brothers - Stealing Fat.MP3"). I know the file exists. I know that the subdirs work correctly, because the map is being loaded out of base\levels as expected. But as soon as PR_PlayMP3 is hit, the screen flickers, the program crashes out, and I''m dumped back out to my desktop. Did I miss something that''s glaringly obvious? (I know it''s got to work, because I know you guys are all using MP3s ... Right?) Oh yeah ... About the filename, before anyone mentions it ... For purposes of the technology demo, I''m stealing just about everything. The map is the same one that came with bspdemo, the models will likely come out of Alice, the music is coming from my own (albeit legal) MP3 collection, the WAVs are going to be whatever I can download, etc. Obviously, none of this totally mismatched stuff will make it into the real game -- it''s just for me to prove to the creative talent that we can actually do this thing. Thanks in advance! John
Advertisement
First, the engine has music built in, if you specify an mp3 filename in the level properties in LStudio. You don''t have to call the mp3 routines yourself if you do this.

You probably need to switch directories before loading your mp3. ie:

PR_GoStartPath ();
chdir ("base\\music");
PR_PlayMP3 (file, TRUE);

You had a relative path but the current working directory is changed while loading in levels.
Author of Power Render (http:/www.powerrender.com)
Thanks for the quick reply! I was just about to post a "disregard" message, actually ...

It turns out that some change I implemented when I went back a few hours later to add in CD music got it working. Which change, damned if I know, but when I ran it with the CD music implemented as well, they both worked perfectly.

I''ll probably find out once I finish the other 15 tasks in the demo, print the code and start organizing/optimizing.

> You don''t have to call the mp3 routines yourself if you do this.

That''s pretty cool. I haven''t worked with LStudio too much yet, because all my maps are going to be BSP-based, and I''m way too lazy to actually build one from scratch for the tech demo. (I know, I know ... but that''s why I have a level designer! )

Thanks again!

John

This topic is closed to new replies.

Advertisement