Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

MP3 Support Goto page Previous 1, 2

| Inside3d Forums Forum Index -> Programming Tutorials

View previous topic :: View next topic
Author | Message
--- | ---
Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Nov 19, 2009 12:47 pm Post subject: |

Spike wrote:
the down side of actual CD tracks is that quake's sound system is single threaded, that is, start playing a CD track and your rendering thread stalls for a second or two while the CD drive spins up and starts the relevent track.

Super annoying. End of map, a second of lag and sometimes you didn't have time to give your parting "comments" to the other players. ("gg", "that guy sucks", "I entered the game late!")

Quote:
quakeworld engines default to CD audio disabled.

Hehe, ProQuake 4 you can turn the CD music off or no. No, not the volume ... like actually turn the CD off or from off to on. Real-time -nocdaudio command line param.
Not hard, but it was in the interests of eliminating the need for command line parameters which I view as archaic.

Back to top |

mh Joined: 12 Jan 2008 Posts: 910 |

Posted: Thu Nov 19, 2009 3:42 pm Post subject: |

Baker wrote:
eliminating the need for command line parameters which I view as archaic.

I'll drink to that!
From reading the QuakeOne forums, I'd guess that maybe 95% of the problems people have with Quake are command-line related. I mean real people who actually just play the game, as opposed to modders, mappers and coders (we can all be guilty of just seeing things from our own perspectives sometimes).
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines

Back to top |

Spirit Joined: 20 Nov 2004 Posts: 476 |

Posted: Thu Nov 19, 2009 4:18 pm Post subject: |

Quoth's "*_command" works well with "cd play x". If you have an engine that supports "cd" for vorbis tracks, it is great fun. _________________ Quake Maps

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Thu Nov 19, 2009 5:17 pm Post subject: |

mh wrote:
From reading QuakeOne forums, I'd guess that maybe 95% of the problems people have with Quake are command-line related.

Hmmm ... neither ProQuake 4 or Qrack need any command line parameters generally speaking. DarkPlaces hasn't needed command line parameters in quite a while (for the most part). FitzQuake barely does. On the Quakeworld side of things, ezQuake doesn't and FTEQW for a long time hasn't needed them.
Within the last year or 2, Rook and I added video mode switching and the ability to switch dinput on or off. Both have gamedir changing, although your engine takes it a step further with being able to toggle the "-hipnotic" type stuff.
In fact, there is quite the general lack of ProQuake questions because it just runs and, in my opinion, has a well designed menu.
QuakeOne has a ton of legacy stuff from 2006 when command line parameters were a severe headache.
Today, if someone asks a command line question, generally they are Steam-purchased GLQuake using player or want to use, say, ProQuake 3.50 because they have always used it or want to use, say, a software renderer but want as many fps as possible so they need the -directdraw command line (or whatever it is).

Back to top |

mh Joined: 12 Jan 2008 Posts: 910 |

Posted: Thu Nov 19, 2009 5:27 pm Post subject: |

Improvement #1: this will modify the code to support both /music and /sound/cdtracks. The fallback is fully automatic; if the track isn't found in one location it will just try the other. Replace your TouchMP3 function with this one:

Code:
char *TouchMP3 (char *MP3Name, int verbose) { static char MP3File[1024]; char *musicdirs[] = {
"music",
"sound/cdtracks",
NULL
};
int i;
// slap on a ".mp3" extension if it doesn't have one
COM_DefaultExtension (MP3Name, ".mp3", sizeof(MP3Name));
for (i = 0; ; i++)
{
// didn't find it at all
if (!musicdirs[i])
{
if (verbose > 0)
{
Con_Printf ("couldn't find %s!!!\n", MP3Name);
}
return NULL;
}
// try the current game directory first
va_snprintf ("TouchMP3", MP3File, sizeof(MP3File), "%s/%s/%s", com_gamedir, musicdirs[i], MP3Name);
FILE *f = fopen (MP3File, "rb");
if (!f)
{
// no music in the current game directory so lets try ID1
va_snprintf ("TouchMP3", MP3File, sizeof(MP3File), "id1/%s/%s", musicdirs[i], MP3Name);
f = fopen (MP3File, "rb");
// no music in ID1 either
if (!f) continue;
}
// found it
fclose (f);
break;
}
if (verbose)
{
Con_Printf ("playing %s\n", MP3Name);
}
return MP3File;
}

All we do here is provide a list of locations we're going to check and loop through that list, checking them all until we either find it or run out of options.
Note that which this provides compatibility with the DarkPlaces directory convention, it doesn't provide compatibility with the DarkPlaces name convention. To get that you have a number of options, but probably the easiest is to find the PlayMP3DShow function and replace this line:

Code:
UserMP3DShow (va ("track%02i", mp3num), -1);

with this one:

Code:
UserMP3DShow (va ("track%03i", mp3num), -1);

Darkplaces provides for up to 3 digits for the track number, which is a bit silly as - as I've previously noted - the Red Book CD audio spec only allows for up to 99 tracks on a CD (i.e. 2 digits).
If you're interested in a more general solution that's capable of checking both directores as well as an optional user-specified directory, that genuinely doesn't care about what the file is called, and that doesn't remove CD audio functionality, have a look at the DirectQ source code.
I'll hopefully post a semi-port of the relevant parts of that to the interface used by this tutorial sometime over the next few days, which will also hopefully enable loading from PAK files.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Programming Tutorials | All times are GMT Goto page Previous 1, 2
Page 2 of 2

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group