Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Variants

Reply
 
Thread Tools Display Modes
Old April 16, 2020, 00:17   #11
anselmus
Rookie
 
Join Date: Apr 2020
Location: south spain
Posts: 13
anselmus is on a distinguished road
Quote:
Originally Posted by backwardsEric View Post
Sideways' script looks pretty good. I'd use

Code:
#!/bin/sh

if text X"$1" != X ; then
    exec aplay "$1"
fi
exit 1
Put that in playwave.sh in the same directory as the frogcomposband executable and run

Code:
chmod a+x playwave.sh
on it to make it executable.
Thanks backwardsEric. I just read now your message. With this script I get an error:

./playwave.sh: 3: ./playwave.sh: text: not found
anselmus is offline   Reply With Quote
Old April 16, 2020, 01:59   #12
anselmus
Rookie
 
Join Date: Apr 2020
Location: south spain
Posts: 13
anselmus is on a distinguished road
I discovered something. Trying to compile again the game, suddenly the sound doesn't work again, even with the script, but there is no error calling to playwave.sh.

The problem seems to be with the 'Makefile' file, in "./lib/xtra/sound/". It seems that last time I've overwrite by mistake with other 'Makefile'. The script works (and the error 'sh: 1: ./playwave.sh: not found' happens again) with this 'Makefile':
Quote:
MKPATH=../../../mk/
include $(MKPATH)buildsys.mk

LIBDATA = sound.cfg breath.wav clunk.wav death.wav destroy.wav \
drop.wav eat.wav flee.wav hallu.wav hit.wav hit1.wav kill.wav \
kill1.wav level.wav miss.wav miss1.wav money.wav opendoor.wav \
shutdoor.wav thump.wav vomit.wav \

PACKAGE = xtra/sound
but doesn't work with the "original" 'Makefile' from Frogcomposband 7.1.liquorice, that is:

Quote:
MKPATH=../../../mk/
include $(MKPATH)buildsys.mk

DATA = sound.cfg
PACKAGE = xtra/sound
anselmus is offline   Reply With Quote
Old April 16, 2020, 02:09   #13
backwardsEric
Apprentice
 
Join Date: Aug 2019
Posts: 76
backwardsEric is on a distinguished road
Quote:
Originally Posted by anselmus View Post
Thanks backwardsEric. I just read now your message. With this script I get an error:

./playwave.sh: 3: ./playwave.sh: text: not found
There was a typo in my reply; replace "text" with "test" and that script should work.

For your question about why the modified Makefile worked and the original did not, the answer is likely that the original did not install the sound files (*.wav). If the game checks if the sound file exists before trying to run the playwave.sh script, then you wouldn't see the message about the script. The modified version installs the sound files.
backwardsEric is offline   Reply With Quote
Old April 16, 2020, 07:16   #14
Sideways
Knight
 
Join Date: Nov 2008
Posts: 637
Sideways is on a distinguished road
Thanks to backwardsEric for bringing actual knowledge to the table

Unfortunately, fixing all the problems with the sound system (for every platform no less) would likely require rewriting it from scratch with proper code.
__________________
The Complainer worries about the lack of activity here these days.
Sideways is offline   Reply With Quote
Old April 20, 2020, 16:28   #15
anselmus
Rookie
 
Join Date: Apr 2020
Location: south spain
Posts: 13
anselmus is on a distinguished road
I'm making an "easy to install" sound-pack for Frogcomposband. The sound scripts (thanks to Sideways and backwardsEric) works pretty well. By the way: running the game with gcu the 'aplay' command needs to be executed with '-q' option, otherwise you get the 'aplay' output messages on the game mainscreen, so, my gcusound.sh (in ./src) looks like this:

Quote:
#!/bin/sh

if test X"$1" != X ; then
exec aplay "$1" -q
fi
exit 1

The "sound engine" of the game seems to be very limited, but I'm trying to get the most out of it. The delay problem is not, in fact, such a problem: when you attack monsters, for example, each blow result (e.g.: You miss. You miss. You hit.) is printed synchronously (in ordinal/chronological order) with the sound, which is, for my taste at least, interesting, because this way you know at all times, by ear, when your character has impacted and when failed, and it is more difficult to miss relevant information.

Now, according to sound.cfg and readme file, it's possible to assign more than one sound sample for each sound event (e.g.: hit = hit.wav hit1.wav hit2.wav), so I understand that the game triggers randomly one sound sample from the avaibles/defined samples when any of the defined events happens, but I'm not getting the expected result. I have assign different sounds for the same event, but the game plays only the first one defined for each event. That is to say: I've, for example, five different sounds for 'hit' event (hit.wav, hit1.wav, hit2.wav, hit3.wav, hit4.wav) defined on Makefile and sound.cfg files, I compile the game with no errors, but in game, when my character hits, only sounds hit.wav.

Any clue about this?

Thanks you very much in advance
anselmus is offline   Reply With Quote
Old April 20, 2020, 18:04   #16
backwardsEric
Apprentice
 
Join Date: Aug 2019
Posts: 76
backwardsEric is on a distinguished road
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.
backwardsEric is offline   Reply With Quote
Old April 20, 2020, 18:33   #17
anselmus
Rookie
 
Join Date: Apr 2020
Location: south spain
Posts: 13
anselmus is on a distinguished road
Quote:
Originally Posted by backwardsEric View Post
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
anselmus is offline   Reply With Quote
Reply

Tags
frogcomposband, sound


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FrogComposband 7.0.peppermint Sideways Variants 151 June 29, 2020 01:06
Regarding Devicemasters (Frogcomposband) Nonary Variants 2 March 16, 2020 08:29
Frogcomposband Help Needed. Nonary Variants 11 October 29, 2019 18:40
frogcomposband frogcomposband: Angband needs an 80x24 'curses' scre poschengbandplayer Variants 2 August 19, 2019 15:13
FrogComposband 7.0.strawberry Sideways Variants 40 April 18, 2018 07:27


All times are GMT +1. The time now is 00:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.