44 if (audio_config ==
this)
116 return -50 * (100 - audio_config->
gui_volume);
144 if (audio_config->
training && vol < -750)
170 else if (v > 100) v = 100;
179 else if (v > 100) v = 100;
188 else if (v > 100) v = 100;
197 else if (v > 100) v = 100;
207 else if (v > 100) v = 100;
217 else if (v > 100) v = 100;
234 const char* filename =
"audio.cfg";
237 ::fopen_s(&f, filename,
"rb");
240 ::fseek(f, 0, SEEK_END);
242 ::fseek(f, 0, SEEK_SET);
244 block =
new(__FILE__,__LINE__) BYTE[blocklen+1];
247 ::fread(block, blocklen, 1, f);
254 Parser parser(
new(__FILE__,__LINE__)
BlockReader((
const char*) block, blocklen));
258 Print(
"ERROR: could not parse '%s'.\n", filename);
263 if (!file_type || file_type->
value() !=
"AUDIO") {
264 Print(
"WARNING: invalid %s file. Using defaults\n", filename);
279 if (def->
name()->
value() ==
"menu_music") {
282 if (v < 0 || v > 100) {
283 Print(
"WARNING: Invalid menu_music (%d) in '%s'\n", v, filename);
290 else if (def->
name()->
value() ==
"game_music") {
293 if (v < 0 || v > 100) {
294 Print(
"WARNING: Invalid game_music (%d) in '%s'\n", v, filename);
301 else if (def->
name()->
value() ==
"efx_volume") {
304 if (v < 0 || v > 100) {
305 Print(
"WARNING: Invalid efx_volume (%d) in '%s'\n", v, filename);
312 else if (def->
name()->
value() ==
"gui_volume") {
315 if (v < 0 || v > 100) {
316 Print(
"WARNING: Invalid gui_volume (%d) in '%s'\n", v, filename);
325 else if (def->
name()->
value() ==
"wrn_volume") {
328 if (v < 0 || v > 100) {
329 Print(
"WARNING: Invalid wrn_volume (%d) in '%s'\n", v, filename);
336 else if (def->
name()->
value() ==
"vox_volume") {
339 if (v < 0 || v > 100) {
340 Print(
"WARNING: Invalid vox_volume (%d) in '%s'\n", v, filename);
348 Print(
"WARNING: unknown label '%s' in '%s'\n",
352 Print(
"WARNING: term ignored in '%s'\n", filename);
368 fopen_s(&f,
"audio.cfg",
"w");
370 fprintf(f,
"AUDIO\n\n");
372 fprintf(f,
"game_music: %3d\n\n",
game_music);