-
Notifications
You must be signed in to change notification settings - Fork 10
/
pkg_sfx.mk
154 lines (133 loc) · 5.89 KB
/
pkg_sfx.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#******************************************************************************
# Free implementation of Bullfrog's Dungeon Keeper strategy game.
#******************************************************************************
# @file pkg_sfx.mk
# A script used by GNU Make to recompile the project.
# @par Purpose:
# Defines make rules for tools needed to build KeeperFX.
# Most tools can either by compiled from source or downloaded.
# @par Comment:
# None.
# @author Tomasz Lis
# @date 25 Jan 2009 - 02 Jul 2011
# @par Copying and copyrights:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#******************************************************************************
NGSPEECHBANKS = \
speech_chi \
speech_cht \
speech_dut \
speech_eng \
speech_fre \
speech_ger \
speech_ita \
speech_jpn \
speech_lat \
speech_pol \
speech_rus \
speech_spa \
speech_swe
NGSOUNDDATS = $(patsubst %,pkg/sound/%.dat,$(NGSPEECHBANKS) sound)
NGSOUNDLISTS = $(patsubst %,sfx/%/filelist.txt,$(NGSPEECHBANKS) sound)
LANDVIEWSPEECH = \
$(foreach lng,eng,ancntkpr_$(lng)) \
$(foreach lng,eng,burdnimp_$(lng)) \
$(foreach lng,eng,cqarctic_$(lng)) \
$(foreach lng,eng,dstninja_$(lng)) \
$(foreach lng,eng dut,dzjr06lv_$(lng)) \
$(foreach lng,eng,dzjr10lv_$(lng)) \
$(foreach lng,eng,dzjr25lv_$(lng)) \
$(foreach lng,eng fre ger,evilkeep_$(lng)) \
$(foreach lng,eng,grkreign_$(lng)) \
$(foreach lng,eng,jdkmaps8_$(lng)) \
$(foreach lng,eng,kdklvpck_$(lng)) \
$(foreach lng,eng chi cht dut fre ger ita jpn pol rus spa swe,keeporig_$(lng)) \
$(foreach lng,eng dut,lqizgood_$(lng)) \
$(foreach lng,eng,lrdvexer_$(lng)) \
$(foreach lng,eng,ncastles_$(lng)) \
$(foreach lng,eng,postanck_$(lng)) \
$(foreach lng,eng,pstunded_$(lng)) \
$(foreach lng,eng,questfth_$(lng)) \
$(foreach lng,eng dut,twinkprs_$(lng)) \
$(foreach lng,eng,undedkpr_$(lng))
LANDVIEWSPEECHDIRS = $(patsubst %,pkg/campgns/%,$(LANDVIEWSPEECH))
.PHONY: pkg-sfx convert-sfx
pkg-sfx: $(NGSOUNDDATS) $(LANDVIEWSPEECHDIRS)
pkg/sound/sound.dat: sfx/sound/filelist.txt $(WAVTODAT)
pkg/sound/speech_chi.dat: sfx/speech_chi/filelist.txt $(WAVTODAT)
pkg/sound/speech_cht.dat: sfx/speech_cht/filelist.txt $(WAVTODAT)
pkg/sound/speech_dut.dat: sfx/speech_dut/filelist.txt $(WAVTODAT)
pkg/sound/speech_eng.dat: sfx/speech_eng/filelist.txt $(WAVTODAT)
pkg/sound/speech_fre.dat: sfx/speech_fre/filelist.txt $(WAVTODAT)
pkg/sound/speech_ger.dat: sfx/speech_ger/filelist.txt $(WAVTODAT)
pkg/sound/speech_ita.dat: sfx/speech_ita/filelist.txt $(WAVTODAT)
pkg/sound/speech_jpn.dat: sfx/speech_jpn/filelist.txt $(WAVTODAT)
pkg/sound/speech_lat.dat: sfx/speech_lat/filelist.txt $(WAVTODAT)
pkg/sound/speech_pol.dat: sfx/speech_pol/filelist.txt $(WAVTODAT)
pkg/sound/speech_rus.dat: sfx/speech_rus/filelist.txt $(WAVTODAT)
pkg/sound/speech_spa.dat: sfx/speech_spa/filelist.txt $(WAVTODAT)
pkg/sound/speech_swe.dat: sfx/speech_swe/filelist.txt $(WAVTODAT)
pkg/sound/%.dat:
-$(ECHO) 'Building sound bank: $@'
@$(MKDIR) "$(@D)"
$(WAVTODAT) -o "$@" "$<"
-$(ECHO) 'Finished building: $@'
-$(ECHO) ' '
# Creation of land view speeches for campaigns
define define_campaign_speeches_rule
pkg/campgns/$(1)_$(2): sfx/campgns/$(1)_$(2)/filelist.txt
-$(ECHO) 'Copying campaign SFX: $$@'
@$(MKDIR) "$$@"
tail -n +2 "$$<" | cut -f1 | sort -u | xargs -d '\n' -I {} $(CP) "$$(<D)/{}" "$$@/"
-$(ECHO) 'Finished copying: $$@'
-$(ECHO) ' '
endef
$(foreach campaign,$(sort $(CAMPAIGNS)),$(foreach lng,$(sort $(LANGS)),$(eval $(call define_campaign_speeches_rule,$(campaign),$(lng)))))
convert-sfx: convert-ingame-sounds-sfx $(patsubst %,convert-speech-sfx-%,$(NGSPEECHBANKS)) $(patsubst %,convert-campaign-sfx-%,$(LANDVIEWSPEECH))
convert-ingame-sounds-sfx: sfx/sound/filelist.txt
-$(ECHO) 'Converting ingame sound samples in list: $<'
tail -n +2 "$<" | cut -f1 | sort -u | xargs -d '\n' -I {} \
sox "$(<D)_design/{}" -c 1 -b 16 -r 22050 -e signed-integer "$(<D)/{}"
# now special cases - re-convert some files with a bit different settings
echo -ne "keeper_spells/possess.wav\n" | xargs -d '\n' -I {} \
sox "$(<D)_design/{}" -c 2 -b 16 -r 22050 -e signed-integer "$(<D)/{}"
echo -ne "traps/lgtnball.wav\ngui/tabhit.wav\n" | xargs -d '\n' -I {} \
sox "$(<D)_design/{}" -c 1 -b 16 -r 44100 -e signed-integer "$(<D)/{}"
-$(ECHO) 'Finished converting list: $<'
-$(ECHO) ' '
convert-speech-sfx-%: sfx/%/filelist.txt
-$(ECHO) 'Converting speech samples in list: $<'
@$(MKDIR) "$(<D)/heroes" "$(<D)/keepers" "$(<D)/mentor"
tail -n +2 "$<" | cut -f1 | sort -u | xargs -d '\n' -I {} \
sox "$(<D)_design/{}" -c 1 -b 8 -r 22050 -e unsigned-integer "$(<D)/{}" compand 0.02,0.20 5:-40,-40,-35,-20,-10 -6 -90 0.1 gain -n -0.1
# best would be "compand 0.02,0.20 5:-60,-40,-10 -6 -90 0.1", modification is to skip noise
-$(ECHO) 'Finished converting list: $<'
-$(ECHO) ' '
convert-campaign-sfx-%: sfx/campgns/%/filelist.txt
-$(ECHO) 'Converting campaign speeches in list: $<'
tail -n +2 "$<" | cut -f1 | sort -u | xargs -d '\n' -I {} \
sox "$(<D)_design/{}" -c 1 -r 22050 -e ms-adpcm "$(<D)/{}" compand 0.02,0.20 5:-40,-40,-35,-20,-10 -6 -90 0.1 gain -n -0.1
# best would be "compand 0.02,0.20 5:-60,-40,-10 -6 -90 0.1", modification is to skip noise
-$(ECHO) 'Finished converting list: $<'
-$(ECHO) ' '
ifeq ($(ENABLE_EXTRACT), 1)
sfx/%/filelist.txt sfx/campgns/%/filelist.txt: | sfx/$(SFXSRC_PACKAGE)
-$(ECHO) 'Extracting package: $<'
7z x -aoa -y -osfx "$|"
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
endif
# Downloading the sfx sources pack
sfx/$(SFXSRC_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "$@.dl" "$(SFXSRC_DOWNLOAD)"
7z t "$@.dl"
$(MV) "$@.dl" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
#******************************************************************************