Playing Music without the Play Key?

Help with using HLDJ
Post Reply
Cyrian
Game DJ
Posts: 1
Joined: Sat Dec 26, 2009 5:12 pm

Playing Music without the Play Key?

Post by Cyrian »

Is it possible to play a complete audio file without the use of the play key to start and stop it?

I recently set up custom radial menus in L4D2 and I'd like the .wavs to play on their own when I select them from the menu, rather than selecting them and then using the play key.

Perhaps there is a command to start playing the audio file, then I could use a variable length wait command depending on the length of the .wav, then use another command to stop the audio playback?

Thanks!
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: Playing Music without the Play Key?

Post by Renegade »

"hldj_playaudio" is the command to toggle playback, which is comprised of:
"hldj_playaudio_on"
"hldj_playaudio_off"

You're probably looking to do something like

Code: Select all

"bind = >$\some*file; wait; wait; wait; wait; ...; wait; hldj_playaudio_on; wait; wait; wait; hldj_playaudio_off"
Just note that in different versions of the Source engine, waits are handled differently (and this has caused me no shortage of headaches). I recall Source2007 (which is used for L4D) executes wait aliases in a separate thread, so using an aliased wait such as "hldj_playaudio_on; my_long_wait; hldj_playaudio_off" will not work, you have to explicitly type out every wait as in the previous example.

If you're using the Radial menu tutorial from the Tips & Tricks forum, I seem to remember it not liking spaces in arguments. Unless they fixed that, you should replace any spaces in your filenames with HLDJ space substitution character "*".

Also, with the new version of HLDJ (1.5.0) the load times for audio files should be negligible, so you can get away with using shorter wait times before loading and starting playback.
Post Reply