Changeset 141
- Timestamp:
- 05/14/07 19:27:04 (2 years ago)
- Files:
-
- trunk/configure.ac (modified) (2 diffs)
- trunk/src/Makefile.src (modified) (2 diffs)
- trunk/src/Makefile.std (modified) (4 diffs)
- trunk/src/defines.h (modified) (2 diffs)
- trunk/src/externs.h (modified) (2 diffs)
- trunk/src/main-crb.c (modified) (6 diffs)
- trunk/src/main-ros.c (modified) (5 diffs)
- trunk/src/main-win.c (modified) (2 diffs)
- trunk/src/main-xxx.c (modified) (3 diffs)
- trunk/src/main.c (modified) (3 diffs)
- trunk/src/main.h (modified) (1 diff)
- trunk/src/snd-sdl.c (added)
- trunk/src/tables.c (modified) (5 diffs)
- trunk/src/util.c (modified) (2 diffs)
- trunk/src/variable.c (modified) (2 diffs)
- trunk/src/z-term.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/configure.ac
r127 r141 86 86 [enable_sdl=$enableval], 87 87 [enable_sdl=no]) 88 89 dnl Sound modules 90 AC_ARG_ENABLE(sdl_mixer, 91 [ --disable-sdl-mixer Disables SDL mixer sound support], 92 [disable_sdl_mixer=$disable_sdl_mixer], 93 [disable_sdl_mixer=no]) 94 88 95 89 96 dnl curses checking … … 169 176 fi 170 177 178 dnl SDL mixer checking 179 180 if test "$disable_sdl_mixer" != "yes"; then 181 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, found_sdl_mixer=yes, found_sdl_mixer=no) 182 183 if test "$found_sdl_mixer" = "yes"; then 184 AC_DEFINE(SDL_SOUND, 1, [Enabled SDL_mixer sound support]) 185 LDFLAGS="${LDFLAGS} -lSDL_mixer" 186 else 187 AC_DEFINE(SDL_SOUND, 0, [Disabled SDL_mixer sound support]) 188 fi 189 fi 190 191 171 192 dnl Check for headers. 172 193 dnl AC_HEADER_STDBOOL -- not yet trunk/src/Makefile.src
r134 r141 13 13 14 14 ZFILES = z-file z-form z-rand z-term z-type z-util z-virt 15 MAINFILES = main maid-x11 \16 $(addprefix main-,crb gcu gtk ros sdl win x11 xaw) 15 MAINFILES = main maid-x11 main-crb main-gcu main-gtk main-ros main-sdl \ 16 main-win main-x11 main-xaw snd-sdl 17 17 18 18 ANGFILES = \ … … 58 58 xtra2 59 59 60 trunk/src/Makefile.std
r128 r141 46 46 47 47 48 ## Support SDL_mixer for sound 49 #SOUND_sdl = -DSOUND_SDL $(shell sdl-config --cflags) $(shell sdl-config --libs) -lSDL_mixer 50 51 52 48 53 # Basic compiler stuff 49 54 CC = gcc … … 73 78 74 79 # Extract CFLAGS and LIBS from the system definitions 75 MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_xaw) $(SYS_gtk) $(SYS_sdl) 80 MODULES = $(SYS_x11) $(SYS_gcu) $(SYS_xaw) $(SYS_gtk) $(SYS_sdl) $(SOUND_sdl) 76 81 CFLAGS += $(patsubst -l%,,$(MODULES)) $(INCLUDES) 77 82 LIBS += $(patsubst -D%,,$(patsubst -I%,, $(MODULES))) … … 89 94 # Object definitions 90 95 X11OBJS = maid-x11.o main-x11.o main-xaw.o main-gtk.o 91 MAINOBJS = main.o main-gcu.o main-sdl.o $(X11OBJS)96 MAINOBJS = main.o main-gcu.o main-sdl.o snd-sdl.o $(X11OBJS) 92 97 OBJS = $(BASEOBJS) $(MAINOBJS) 93 98 … … 171 176 $(MAINOBJS) : main.h $(INCS) 172 177 178 trunk/src/defines.h
r137 r141 2426 2426 #define OPT_rogue_like_commands 0 2427 2427 #define OPT_quick_messages 1 2428 2428 #define OPT_use_sound 2 2429 2429 #define OPT_query_floor 3 2430 2430 #define OPT_use_old_target 4 … … 2528 2528 #define rogue_like_commands op_ptr->opt[OPT_rogue_like_commands] 2529 2529 #define quick_messages op_ptr->opt[OPT_quick_messages] 2530 #define use_sound op_ptr->opt[OPT_use_sound] 2530 2531 #define query_floor op_ptr->opt[OPT_query_floor] 2531 2532 #define use_old_target op_ptr->opt[OPT_use_old_target] trunk/src/externs.h
r136 r141 111 111 extern s32b turn; 112 112 extern s32b old_turn; 113 extern bool use_sound;114 113 extern int use_graphics; 115 114 extern bool use_bigtile; … … 248 247 extern int text_out_indent; 249 248 extern bool use_transparency; 249 extern void (*sound_hook)(int); 250 250 extern autoinscription *inscriptions; 251 251 extern u16b inscriptions_count; trunk/src/main-crb.c
r136 r141 1302 1302 static SInt16 sound_volume = SOUND_VOLUME_MAX; 1303 1303 1304 1305 1304 1306 /* 1305 1307 * QuickTime sound, by Ron Anderson … … 1409 1411 /* Stop QuickTime */ 1410 1412 ExitMovies(); 1413 1414 /* Register the sound hook */ 1415 sound_hook = play_sound; 1411 1416 } 1412 1417 … … 1490 1495 * 1491 1496 * Globals referenced: channel_initialised, channels[], samples[], 1492 * sample_refs[] .1497 * sample_refs[], sound_volume. 1493 1498 * Globals updated: channel_initialised, channels[], sample_refs[]. 1494 1499 */ 1495 1500 1496 static void play_sound(int num , SInt16 vol)1501 static void play_sound(int num) 1497 1502 { 1498 1503 OSErr err; … … 1505 1510 static SInt16 channel_occupants[MAX_CHANNELS]; 1506 1511 static SndCommand volume_cmd, quiet_cmd; 1512 1513 SInt16 vol = sound_volume; 1507 1514 1508 1515 /* Initialise sound channels */ … … 1595 1602 } 1596 1603 1604 1605 1597 1606 /*** Support for the "z-term.c" package ***/ 1598 1607 … … 1711 1720 /* Make a noise */ 1712 1721 SysBeep(1); 1713 1714 /* Success */1715 return (0);1716 }1717 1718 /* Make a sound */1719 case TERM_XTRA_SOUND:1720 {1721 /* Play sound */1722 play_sound(v, sound_volume);1723 1722 1724 1723 /* Success */ trunk/src/main-ros.c
r136 r141 3510 3510 while ((Time_Monotonic() - start) < v); 3511 3511 } 3512 return 0;3513 }3514 3515 /* Play a sound :) */3516 case TERM_XTRA_SOUND:3517 {3518 if (enable_sound) play_sound(v);3519 3520 3512 return 0; 3521 3513 } … … 7078 7070 7079 7071 7080 7081 7072 static void initialise_sound(void) 7082 7073 { … … 7085 7076 read_sound_config(); 7086 7077 check_playit(); 7078 7079 /* Set the sound hook */ 7080 sound_hook = play_sound; 7081 7087 7082 Hourglass_Off(); 7088 7083 } … … 7111 7106 { 7112 7107 /* Paranoia */ 7113 if (!sound_initd) 7114 { 7108 if (!sound_initd || !enable_sound) 7115 7109 return; 7116 }7117 7110 7118 7111 /* Paranoia */ … … 8826 8819 8827 8820 8821 trunk/src/main-win.c
r136 r141 2112 2112 } 2113 2113 2114 /* Make a special sound */2115 case TERM_XTRA_SOUND:2116 {2117 return (Term_xtra_win_sound(v));2118 }2119 2120 2114 /* Process random events */ 2121 2115 case TERM_XTRA_BORED: … … 5101 5095 #endif /* USE_SAVER */ 5102 5096 5097 #if USE_SOUND 5098 5099 /* Set the sound hook */ 5100 sound_hook = Term_xtra_win_sound(v); 5101 5102 #endif /* USE_SOUND */ 5103 5103 5104 /* Did the user double click on a save file? */ 5104 5105 check_for_save_file(lpCmdLine); trunk/src/main-xxx.c
r136 r141 327 327 } 328 328 329 case TERM_XTRA_SOUND:330 {331 /*332 * Make a sound XXX XXX XXX333 *334 * This action should produce sound number "v", where the335 * "name" of that sound is "sound_names[v]". This method336 * is still under construction.337 *338 * This action is optional, and not very important.339 */340 341 return (0);342 }343 344 329 case TERM_XTRA_BORED: 345 330 { … … 709 694 710 695 696 697 /* 698 * Make a sound. 699 * 700 * This action should produce sound number "v", where the 701 * "name" of that sound is "sound_names[v]". 702 * 703 * This action is optional, and not very important. 704 */ 705 static void xxx_sound(int v) 706 { 707 return; 708 } 709 710 711 711 /* 712 712 * Init some stuff … … 726 726 /* Prepare the filepaths */ 727 727 init_file_paths(path); 728 729 730 #ifdef USE_SOUND 731 732 /* Set up sound hook */ 733 sound_hook = xxx_sound; 734 735 #endif /* USE_SOUND */ 728 736 } 729 737 trunk/src/main.c
r128 r141 52 52 53 53 54 #ifdef USE_SOUND 55 56 /* 57 * List of sound modules in the order they should be tried. 58 */ 59 static const struct module sound_modules[] = 60 { 61 #ifdef SOUND_SDL 62 { "sdl", "SDL_mixer sound module", init_sound_sdl }, 63 #endif /* SOUND_SDL */ 64 65 { "dummy", "Dummy module", NULL }, 66 }; 67 68 #endif 69 70 54 71 /* 55 72 * A hook for "quit()". … … 437 454 puts("Usage: angband [options] [-- subopts]"); 438 455 puts(" -n Start a new character"); 456 puts(" -w Resurrect dead character"); 439 457 puts(" -f Request fiddle (verbose) mode"); 440 puts(" -w Request wizard mode");441 458 puts(" -v Request sound mode"); 442 459 puts(" -g Request graphics mode"); … … 495 512 if (!done) quit("Unable to prepare any 'display module'!"); 496 513 514 515 #ifdef USE_SOUND 516 517 /* Try the modules in the order specified by sound_modules[] */ 518 for (i = 0; i < (int)N_ELEMENTS(sound_modules) - 1; i++) 519 { 520 if (0 == sound_modules[i].init(argc, argv)) 521 break; 522 } 523 524 #endif 525 526 497 527 /* Catch nasty signals */ 498 528 signals_init(); trunk/src/main.h
r85 r141 13 13 14 14 #include "angband.h" 15 16 extern errr init_sound_sdl(int argc, char **argv); 17 15 18 16 19 extern errr init_lfb(int argc, char **argv); trunk/src/tables.c
r123 r141 1399 1399 "rogue_like_commands", /* OPT_rogue_like_commands */ 1400 1400 "quick_messages", /* OPT_quick_messages */ 1401 NULL, /* xxx floor_query_flag*/1401 "use_sound", /* OPT_use_sound */ 1402 1402 "query_floor", /* OPT_query_floor */ 1403 1403 "use_old_target", /* OPT_use_old_target */ … … 1663 1663 "Rogue-like commands", /* OPT_rogue_like_commands */ 1664 1664 "Activate quick messages", /* OPT_quick_messages */ 1665 NULL, /* xxx floor_query_flag*/1665 "Use sound", /* OPT_use_sound */ 1666 1666 "Display things before picking them up", /* OPT_query_floor */ 1667 1667 "Use old target by default", /* OPT_use_old_target */ … … 1927 1927 FALSE, /* OPT_rogue_like_commands */ 1928 1928 TRUE, /* OPT_quick_messages */ 1929 FALSE, /* xxx floor_query_flag*/1929 FALSE, /* OPT_use_sound */ 1930 1930 TRUE, /* OPT_query_floor */ 1931 1931 FALSE, /* OPT_use_old_target */ … … 2192 2192 2193 2193 { 2194 OPT_use_sound, 2194 2195 OPT_rogue_like_commands, 2195 2196 OPT_easy_alter, … … 2209 2210 OPT_quick_messages, 2210 2211 OPT_hilite_player, 2211 OPT_NONE,2212 2212 OPT_NONE, 2213 2213 OPT_NONE trunk/src/util.c
r136 r141 1358 1358 1359 1359 1360 1360 1361 /* 1361 1362 * Hack -- Make a (relevant?) sound … … 1366 1367 if (!use_sound) return; 1367 1368 1368 /* Make a sound (if allowed) */ 1369 Term_xtra(TERM_XTRA_SOUND, val); 1369 /* Make a noise */ 1370 if (sound_hook) 1371 sound_hook(val); 1370 1372 } 1371 1373 trunk/src/variable.c
r136 r141 83 83 s32b old_turn; /* Hack -- Level feeling counter */ 84 84 85 bool use_sound; /* The "sound" mode is enabled */ 85 86 86 int use_graphics; /* The "graphics" mode is enabled */ 87 87 bool use_bigtile = FALSE; … … 849 849 850 850 /* 851 * Sound hook (for playing FX). 852 */ 853 void (*sound_hook)(int sound); 854 855 856 /* 851 857 * For autoinscriptions. 852 858 */ trunk/src/z-term.h
r120 r141 286 286 * The "TERM_XTRA_SHAPE" action uses "v" to "show" the cursor 287 287 * The "TERM_XTRA_FROSH" action uses "v" for the index of the row 288 * The "TERM_XTRA_SOUND" action uses "v" for the index of a sound289 288 * The "TERM_XTRA_ALIVE" action uses "v" to "activate" (or "close") 290 289 * The "TERM_XTRA_LEVEL" action uses "v" to "resume" (or "suspend") … … 300 299 #define TERM_XTRA_FRESH 6 /* Flush all rows (optional) */ 301 300 #define TERM_XTRA_NOISE 7 /* Make a noise (optional) */ 302 #define TERM_XTRA_SOUND 8 /* Make a sound (optional) */303 301 #define TERM_XTRA_BORED 9 /* Handle stuff when bored (optional) */ 304 302 #define TERM_XTRA_REACT 10 /* React to global changes (optional) */ … … 391 389 392 390 391
