Frogcomposband: sound?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • backwardsEric
    Knight
    • Aug 2019
    • 526

    #16
    The GCU and X11 front ends aren't using sound.cfg; I didn't check the other front ends. They use the name associated with the sound ("hit" for instance) with ".wav" appended as the name of the file to load. Modifying the source code - probably something shared that each front end can call to do the initialization (parsing of sound.cfg) and to query for the sound file to play on a specific event - is the cleanest solution.

    An alternative would be to hack it so for instance, hit.wav, is a placeholder (either a symbolic link to one of other "hit" sound files or a copy) and the script to play the sound randomly swaps in one of the other files (by changing the link or copying over) based on what's in sound.cfg before playing the sound. That would avoid having to change the .c files. It wouldn't work well in a multi-user environment (more than one game running using the same shared game configuration directory) without extra care taken when doing the file swaps.

    Comment

    • anselmus
      Rookie
      • Apr 2020
      • 14

      #17
      Originally posted by backwardsEric
      The GCU and X11 front ends aren't using sound.cfg; I didn't check the other front ends. They use the name associated with the sound ("hit" for instance) with ".wav" appended as the name of the file to load. Modifying the source code - probably something shared that each front end can call to do the initialization (parsing of sound.cfg) and to query for the sound file to play on a specific event - is the cleanest solution.

      An alternative would be to hack it so for instance, hit.wav, is a placeholder (either a symbolic link to one of other "hit" sound files or a copy) and the script to play the sound randomly swaps in one of the other files (by changing the link or copying over) based on what's in sound.cfg before playing the sound. That would avoid having to change the .c files. It wouldn't work well in a multi-user environment (more than one game running using the same shared game configuration directory) without extra care taken when doing the file swaps.
      Thanks!

      I have found "a solution" (more or less of the second type you have proposed, I think). I don't know how good (very "clean" of course not), but it seems to work. The script would be the following:

      #!/bin/sh

      if [ "$1" != "" ]; then
      RANDOM=$$
      for i in 'seq 1'
      do
      R=$(($RANDOM%5))
      done
      aplay -q $1.repo/$R.wav
      fi

      Then, what I have done is create a series of folders in './lib/xtra/sound/' called 'shutdown.wav.repo', 'opendoor.wav.repo', 'hit.wav.repo' etc., and within those folders, the audio files, renamed: '1.wav', '2.wav', '3.wav' etc. It works well. Surely from there you can improve the method, but, for now, there it is! XD

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎