RFC: Reworking sound sub-system

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9647

    #91
    Originally posted by calris
    register_sound_pref_parser() is only defined in sound.h if SOUND is NOT defined
    Yes, but twice, once inline.
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • calris
      Adept
      • Mar 2016
      • 194

      #92
      Originally posted by Nick
      Yes, but twice, once inline.
      The first is only a declaration. I've compiled it without sound support and it works fine. Here is what I get:

      Code:
      [gruss@ws1 ~]$ cd Angband_devel/angband/
      [gruss@ws1 angband]$ make distclean
      Entering directory src.
      Deleted cave.o.
      Deleted cave-map.o.
      Deleted cave-square.o.
      Deleted cave-view.o.
      Deleted cmd-cave.o.
      Deleted cmd-core.o.
      Deleted cmd-misc.o.
      Deleted cmd-obj.o.
      Deleted cmd-pickup.o.
      Deleted debug.o.
      Deleted effects.o.
      Deleted game-event.o.
      Deleted game-input.o.
      Deleted game-world.o.
      Deleted generate.o.
      Deleted gen-cave.o.
      Deleted gen-chunk.o.
      Deleted gen-monster.o.
      Deleted gen-room.o.
      Deleted gen-util.o.
      Deleted grafmode.o.
      Deleted guid.o.
      Deleted init.o.
      Deleted load.o.
      Deleted message.o.
      Deleted mon-attack.o.
      Deleted mon-blow-effects.o.
      Deleted mon-blow-methods.o.
      Deleted mon-desc.o.
      Deleted mon-init.o.
      Deleted mon-list.o.
      Deleted mon-lore.o.
      Deleted mon-make.o.
      Deleted mon-move.o.
      Deleted mon-msg.o.
      Deleted mon-power.o.
      Deleted mon-spell.o.
      Deleted mon-summon.o.
      Deleted mon-timed.o.
      Deleted mon-util.o.
      Deleted obj-chest.o.
      Deleted obj-desc.o.
      Deleted obj-gear.o.
      Deleted obj-ignore.o.
      Deleted obj-info.o.
      Deleted obj-knowledge.o.
      Deleted obj-list.o.
      Deleted obj-make.o.
      Deleted obj-pile.o.
      Deleted obj-power.o.
      Deleted obj-properties.o.
      Deleted obj-randart.o.
      Deleted obj-slays.o.
      Deleted obj-tval.o.
      Deleted obj-util.o.
      Deleted option.o.
      Deleted parser.o.
      Deleted randname.o.
      Deleted player-attack.o.
      Deleted player-birth.o.
      Deleted player-calcs.o.
      Deleted player-class.o.
      Deleted player-history.o.
      Deleted player-path.o.
      Deleted player-quest.o.
      Deleted player-race.o.
      Deleted player-spell.o.
      Deleted player-timed.o.
      Deleted player-util.o.
      Deleted player.o.
      Deleted project.o.
      Deleted project-feat.o.
      Deleted project-mon.o.
      Deleted project-obj.o.
      Deleted project-player.o.
      Deleted score.o.
      Deleted save.o.
      Deleted savefile.o.
      Deleted store.o.
      Deleted target.o.
      Deleted trap.o.
      Deleted ui-birth.o.
      Deleted ui-command.o.
      Deleted ui-context.o.
      Deleted ui-death.o.
      Deleted ui-display.o.
      Deleted ui-event.o.
      Deleted ui-game.o.
      Deleted ui-help.o.
      Deleted ui-history.o.
      Deleted ui-init.o.
      Deleted ui-input.o.
      Deleted ui-keymap.o.
      Deleted ui-knowledge.o.
      Deleted ui-map.o.
      Deleted ui-menu.o.
      Deleted ui-mon-list.o.
      Deleted ui-mon-lore.o.
      Deleted ui-obj-list.o.
      Deleted ui-object.o.
      Deleted ui-options.o.
      Deleted ui-output.o.
      Deleted ui-player.o.
      Deleted ui-prefs.o.
      Deleted ui-score.o.
      Deleted ui-signals.o.
      Deleted ui-spell.o.
      Deleted ui-store.o.
      Deleted ui-target.o.
      Deleted ui-term.o.
      Deleted wiz-debug.o.
      Deleted wiz-spoil.o.
      Deleted wiz-stats.o.
      Deleted buildid.o.
      Deleted z-bitflag.o.
      Deleted z-color.o.
      Deleted z-dice.o.
      Deleted z-expression.o.
      Deleted z-file.o.
      Deleted z-form.o.
      Deleted z-quark.o.
      Deleted z-queue.o.
      Deleted z-rand.o.
      Deleted z-set.o.
      Deleted z-textblock.o.
      Deleted z-type.o.
      Deleted z-util.o.
      Deleted z-virt.o.
      Deleted main.o.
      Deleted main-gcu.o.
      Deleted main-x11.o.
      Deleted snd-sdl.o.
      Deleted sound-core.o.
      Deleted main-test.o.
      Deleted main-stats.o.
      Deleted stats/db.o.
      Deleted angband.
      Deleted angband.o.
      Leaving directory src.
      Entering directory lib.
      Entering directory gamedata.
      Leaving directory gamedata.
      Entering directory customize.
      Leaving directory customize.
      Entering directory help.
      Leaving directory help.
      Entering directory screens.
      Leaving directory screens.
      Entering directory fonts.
      Leaving directory fonts.
      Entering directory tiles.
      Entering directory adam-bolt.
      Leaving directory adam-bolt.
      Entering directory gervais.
      Leaving directory gervais.
      Entering directory nomad.
      Leaving directory nomad.
      Entering directory old.
      Leaving directory old.
      Entering directory shockbolt.
      Leaving directory shockbolt.
      Leaving directory tiles.
      Entering directory sounds.
      Leaving directory sounds.
      Entering directory icons.
      Leaving directory icons.
      Entering directory user.
      Entering directory save.
      Leaving directory save.
      Entering directory scores.
      Leaving directory scores.
      Entering directory info.
      Leaving directory info.
      Leaving directory user.
      Leaving directory lib.
      Entering directory doc.
      Leaving directory doc.
      Deleted config.status.
      Deleted config.log.
      Entering directory src.
      Deleted autoconf.h.
      Deleted .deps.
      Deleted autoconf.h.in~.
      Leaving directory src.
      Entering directory lib.
      Entering directory gamedata.
      Leaving directory gamedata.
      Entering directory customize.
      Leaving directory customize.
      Entering directory help.
      Leaving directory help.
      Entering directory screens.
      Leaving directory screens.
      Entering directory fonts.
      Leaving directory fonts.
      Entering directory tiles.
      Entering directory adam-bolt.
      Leaving directory adam-bolt.
      Entering directory gervais.
      Leaving directory gervais.
      Entering directory nomad.
      Leaving directory nomad.
      Entering directory old.
      Leaving directory old.
      Entering directory shockbolt.
      Leaving directory shockbolt.
      Leaving directory tiles.
      Entering directory sounds.
      Leaving directory sounds.
      Entering directory icons.
      Leaving directory icons.
      Entering directory user.
      Entering directory save.
      Leaving directory save.
      Entering directory scores.
      Leaving directory scores.
      Entering directory info.
      Leaving directory info.
      Leaving directory user.
      Entering directory gamedata.
      Deleted .deps.
      Leaving directory gamedata.
      Entering directory customize.
      Deleted .deps.
      Leaving directory customize.
      Entering directory help.
      Deleted .deps.
      Leaving directory help.
      Entering directory screens.
      Deleted .deps.
      Leaving directory screens.
      Entering directory fonts.
      Deleted .deps.
      Leaving directory fonts.
      Entering directory tiles.
      Entering directory adam-bolt.
      Leaving directory adam-bolt.
      Entering directory gervais.
      Leaving directory gervais.
      Entering directory nomad.
      Leaving directory nomad.
      Entering directory old.
      Leaving directory old.
      Entering directory shockbolt.
      Leaving directory shockbolt.
      Entering directory adam-bolt.
      Deleted .deps.
      Leaving directory adam-bolt.
      Entering directory gervais.
      Deleted .deps.
      Leaving directory gervais.
      Entering directory nomad.
      Deleted .deps.
      Leaving directory nomad.
      Entering directory old.
      Deleted .deps.
      Leaving directory old.
      Entering directory shockbolt.
      Deleted .deps.
      Leaving directory shockbolt.
      Deleted .deps.
      Leaving directory tiles.
      Entering directory sounds.
      Deleted .deps.
      Leaving directory sounds.
      Entering directory icons.
      Deleted .deps.
      Leaving directory icons.
      Entering directory user.
      Entering directory save.
      Leaving directory save.
      Entering directory scores.
      Leaving directory scores.
      Entering directory info.
      Leaving directory info.
      Entering directory save.
      Deleted .deps.
      Leaving directory save.
      Entering directory scores.
      Deleted .deps.
      Leaving directory scores.
      Entering directory info.
      Deleted .deps.
      Leaving directory info.
      Deleted .deps.
      Leaving directory user.
      Deleted .deps.
      Leaving directory lib.
      Entering directory doc.
      Deleted .deps.
      Leaving directory doc.
      Deleted .deps.
      [gruss@ws1 angband]$ ./autogen.sh 
      *info* running aclocal (-I m4)
      *info* running autoheader
      *info* running autoconf
      [gruss@ws1 angband]$ ./configure 
      checking build system type... x86_64-unknown-linux-gnu
      checking host system type... x86_64-unknown-linux-gnu
      checking target system type... x86_64-unknown-linux-gnu
      checking for tput... /usr/bin/tput
      configure: touching .deps files
      Note: You have chosen to compile for installation, with data files
          in standard locations. For development, you may wish to consider using
          --with-no-install which will leave the game to run from the directory
          into which it was extracted and compiled.
      
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables... 
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to accept ISO C89... none needed
      checking whether make sets $(MAKE)... yes
      checking whether ln -s works... yes
      checking for a BSD-compatible install... /usr/bin/install -c
      checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
      checking for windres... no
      checking for rst2html.py... no
      checking for rst2html... no
      checking for rst2latex.py... no
      checking for rst2latex... no
      checking for pdflatex... pdflatex
      checking for rm... /usr/bin/rm
      checking for mv... /usr/bin/mv
      checking for cp... /usr/bin/cp
      checking for dirent.h that defines DIR... yes
      checking for library containing opendir... none required
      checking how to run the C preprocessor... gcc -E
      checking for grep that handles long lines and -e... /usr/bin/grep
      checking for egrep... /usr/bin/grep -E
      checking for ANSI C header files... yes
      checking for sys/types.h... yes
      checking for sys/stat.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for memory.h... yes
      checking for strings.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for unistd.h... yes
      checking fcntl.h usability... yes
      checking fcntl.h presence... yes
      checking for fcntl.h... yes
      checking for stdint.h... (cached) yes
      checking for stdbool.h that conforms to C99... yes
      checking for _Bool... yes
      checking for an ANSI C-conforming const... yes
      checking return type of signal handlers... void
      checking for mkdir... yes
      checking for setresgid... yes
      checking for setegid... yes
      checking for stat... yes
      checking if gcc supports -Wno-missing-field-initializers... yes
      checking if make supports SysV-style inclusion... yes
      checking for make silent include syntax... gnu
      checking for ncursesw5-config... /usr/bin/ncursesw5-config
      checking for ncurses - wide char support... yes
      checking for mvwaddnwstr... yes
      checking for use_default_colors... yes
      checking for can_change_color... yes
      checking for X... libraries , headers 
      checking for gethostbyname... yes
      checking for connect... yes
      checking for remove... yes
      checking for shmat... yes
      checking for IceConnectionNumber in -lICE... yes
      configure: creating ./config.status
      config.status: creating mk/buildsys.mk
      config.status: creating mk/extra.mk
      config.status: creating mk/sinclude.mk
      config.status: creating src/autoconf.h
      
      Configuration:
      
        Install path:                           /usr/local
        binary path:                            /usr/local/games
        config path:                            /usr/local/etc/angband/
        lib path:                               /usr/local/share/angband/
        doc path:                               /usr/local/share/doc/angband/
        var path:                               (not used)
        (with private save and score files in ~/.angband/Angband/)
      
      -- Frontends --
      - Curses                                  Yes
      - X11                                     Yes
      - SDL                                     Disabled
      - Windows                                 Disabled
      - Test                                    No
      - Stats                                   No
      
      - SDL sound                               Disabled
      [gruss@ws1 angband]$ make
      Entering directory src.
      Successfully generated dependencies.
      Successfully compiled cave.c.
      Successfully compiled cave-map.c.
      Successfully compiled cave-square.c.
      Successfully compiled cave-view.c.
      Successfully compiled cmd-cave.c.
      Successfully compiled cmd-core.c.
      Successfully compiled cmd-misc.c.
      Successfully compiled cmd-obj.c.
      Successfully compiled cmd-pickup.c.
      Successfully compiled debug.c.
      Successfully compiled effects.c.
      Successfully compiled game-event.c.
      Successfully compiled game-input.c.
      Successfully compiled game-world.c.
      Successfully compiled generate.c.
      Successfully compiled gen-cave.c.
      Successfully compiled gen-chunk.c.
      Successfully compiled gen-monster.c.
      Successfully compiled gen-room.c.
      Successfully compiled gen-util.c.
      Successfully compiled grafmode.c.
      Successfully compiled guid.c.
      Successfully compiled init.c.
      Successfully compiled load.c.
      Successfully compiled message.c.
      Successfully compiled mon-attack.c.
      Successfully compiled mon-blow-effects.c.
      Successfully compiled mon-blow-methods.c.
      Successfully compiled mon-desc.c.
      Successfully compiled mon-init.c.
      Successfully compiled mon-list.c.
      Successfully compiled mon-lore.c.
      Successfully compiled mon-make.c.
      Successfully compiled mon-move.c.
      Successfully compiled mon-msg.c.
      Successfully compiled mon-power.c.
      Successfully compiled mon-spell.c.
      Successfully compiled mon-summon.c.
      Successfully compiled mon-timed.c.
      Successfully compiled mon-util.c.
      Successfully compiled obj-chest.c.
      Successfully compiled obj-desc.c.
      Successfully compiled obj-gear.c.
      Successfully compiled obj-ignore.c.
      Successfully compiled obj-info.c.
      Successfully compiled obj-knowledge.c.
      Successfully compiled obj-list.c.
      Successfully compiled obj-make.c.
      Successfully compiled obj-pile.c.
      Successfully compiled obj-power.c.
      Successfully compiled obj-properties.c.
      Successfully compiled obj-randart.c.
      Successfully compiled obj-slays.c.
      Successfully compiled obj-tval.c.
      Successfully compiled obj-util.c.
      Successfully compiled option.c.
      Successfully compiled parser.c.
      Successfully compiled randname.c.
      Successfully compiled player-attack.c.
      Successfully compiled player-birth.c.
      Successfully compiled player-calcs.c.
      Successfully compiled player-class.c.
      Successfully compiled player-history.c.
      Successfully compiled player-path.c.
      Successfully compiled player-quest.c.
      Successfully compiled player-race.c.
      Successfully compiled player-spell.c.
      Successfully compiled player-timed.c.
      Successfully compiled player-util.c.
      Successfully compiled player.c.
      Successfully compiled project.c.
      Successfully compiled project-feat.c.
      Successfully compiled project-mon.c.
      Successfully compiled project-obj.c.
      Successfully compiled project-player.c.
      Successfully compiled score.c.
      Successfully compiled save.c.
      Successfully compiled savefile.c.
      Successfully compiled store.c.
      Successfully compiled target.c.
      Successfully compiled trap.c.
      Successfully compiled ui-birth.c.
      Successfully compiled ui-command.c.
      Successfully compiled ui-context.c.
      Successfully compiled ui-death.c.
      Successfully compiled ui-display.c.
      Successfully compiled ui-event.c.
      Successfully compiled ui-game.c.
      Successfully compiled ui-help.c.
      Successfully compiled ui-history.c.
      Successfully compiled ui-init.c.
      Successfully compiled ui-input.c.
      Successfully compiled ui-keymap.c.
      Successfully compiled ui-knowledge.c.
      Successfully compiled ui-map.c.
      Successfully compiled ui-menu.c.
      Successfully compiled ui-mon-list.c.
      Successfully compiled ui-mon-lore.c.
      Successfully compiled ui-obj-list.c.
      Successfully compiled ui-object.c.
      Successfully compiled ui-options.c.
      Successfully compiled ui-output.c.
      Successfully compiled ui-player.c.
      Successfully compiled ui-prefs.c.
      Successfully compiled ui-score.c.
      Successfully compiled ui-signals.c.
      Successfully compiled ui-spell.c.
      Successfully compiled ui-store.c.
      Successfully compiled ui-target.c.
      Successfully compiled ui-term.c.
      Successfully compiled wiz-debug.c.
      Successfully compiled wiz-spoil.c.
      Successfully compiled wiz-stats.c.
      Successfully compiled buildid.c.
      Successfully compiled z-bitflag.c.
      Successfully compiled z-color.c.
      Successfully compiled z-dice.c.
      Successfully compiled z-expression.c.
      Successfully compiled z-file.c.
      Successfully compiled z-form.c.
      Successfully compiled z-quark.c.
      Successfully compiled z-queue.c.
      Successfully compiled z-rand.c.
      Successfully compiled z-set.c.
      Successfully compiled z-textblock.c.
      Successfully compiled z-type.c.
      Successfully compiled z-util.c.
      Successfully compiled z-virt.c.
            LINK angband.o           
      Successfully compiled main.c.
      Successfully compiled main-gcu.c.
      Successfully compiled main-x11.c.
            LINK angband             
      Leaving directory src.
      Entering directory lib.
      Entering directory gamedata.
      Leaving directory gamedata.
      Entering directory customize.
      Leaving directory customize.
      Entering directory help.
      Leaving directory help.
      Entering directory screens.
      Leaving directory screens.
      Entering directory fonts.
      Leaving directory fonts.
      Entering directory tiles.
      Entering directory adam-bolt.
      Leaving directory adam-bolt.
      Entering directory gervais.
      Leaving directory gervais.
      Entering directory nomad.
      Leaving directory nomad.
      Entering directory old.
      Leaving directory old.
      Entering directory shockbolt.
      Leaving directory shockbolt.
      Leaving directory tiles.
      Entering directory sounds.
      Leaving directory sounds.
      Entering directory icons.
      Leaving directory icons.
      Entering directory user.
      Entering directory save.
      Leaving directory save.
      Entering directory scores.
      Leaving directory scores.
      Entering directory info.
      Leaving directory info.
      Leaving directory user.
      Leaving directory lib.
      Entering directory doc.
      Leaving directory doc.
      [gruss@ws1 angband]$

      Comment

      • calris
        Adept
        • Mar 2016
        • 194

        #93
        Hi Nick,

        This has been sitting idle for a little while now. I know you are busy with Rune ID and the new Trap code, but where are we sitting with this? It would be a pity to let this go because of a pesky compiler quibble that I can't reproduce

        Comment

        • Nick
          Vanilla maintainer
          • Apr 2007
          • 9647

          #94
          Originally posted by calris
          Hi Nick,

          This has been sitting idle for a little while now. I know you are busy with Rune ID and the new Trap code, but where are we sitting with this? It would be a pity to let this go because of a pesky compiler quibble that I can't reproduce
          I was always planning to get back to it, but thanks for the reminder.

          I'm not sure what I was doing before - probably just needed to make clean - but now it's compiling fine for me with or without sdl and/or sdl-mixer enabled. So it looks like we're all good to go, and I'll pull it in to master some time when it's convenient (no need to do a pull request, I'll do it directly).

          I still need to get a better solution with the sound files - submodules or whatever - but that can wait.
          One for the Dark Lord on his dark throne
          In the Land of Mordor where the Shadows lie.

          Comment

          • calris
            Adept
            • Mar 2016
            • 194

            #95
            Originally posted by Nick
            I still need to get a better solution with the sound files - submodules or whatever - but that can wait.
            What do you mean?

            Comment

            • Nick
              Vanilla maintainer
              • Apr 2007
              • 9647

              #96
              Originally posted by calris
              What do you mean?
              There was some discussion waaay upthread about using a git submodule to contain sound files; I just mentioned it here because there's this thing that happens sometimes where I mention a problem I'm having and someone provides a solution to it
              One for the Dark Lord on his dark throne
              In the Land of Mordor where the Shadows lie.

              Comment

              • Nick
                Vanilla maintainer
                • Apr 2007
                • 9647

                #97
                OK, I pulled that in (after plentiful Linux testing), and we still seem to have an error in ld when compiling for Windows:
                Code:
                main-win.o:main-win.c:(.text+0x4870): multiple definition of `register_sound_pref_parser'
                ui-prefs.o:ui-prefs.c:(.text+0x1e90): first defined here
                main-win.o:main-win.c:(.text+0x618b): undefined reference to `init_sound'
                I'm guessing you'll see the fix faster than I will.

                EDIT: I'm also seeing problems in testing - the autobuilder is failing the birth tests again, and I'm getting a link error in make tests:
                Code:
                ../angband.o: In function `init_parse_prefs':
                /home/nick/angband/src/ui-prefs.c:1069: undefined reference to `register_sound_pref_parser'
                My guess here is that it's something to do with the way SOUNDFILES is being handled - because sound-core.c is not compiled into angband.o, maybe? And I don't know if it's at all related to the Windows issue.
                Last edited by Nick; April 9, 2016, 00:27. Reason: Moar errors
                One for the Dark Lord on his dark throne
                In the Land of Mordor where the Shadows lie.

                Comment

                • calris
                  Adept
                  • Mar 2016
                  • 194

                  #98
                  Originally posted by Nick
                  OK, I pulled that in (after plentiful Linux testing), and we still seem to have an error in ld when compiling for Windows:
                  Code:
                  main-win.o:main-win.c:(.text+0x4870): multiple definition of `register_sound_pref_parser'
                  ui-prefs.o:ui-prefs.c:(.text+0x1e90): first defined here
                  main-win.o:main-win.c:(.text+0x618b): undefined reference to `init_sound'
                  I'm guessing you'll see the fix faster than I will.
                  Well that is bizarre - register_sound_pref_parser is used in ui-prefs.c, but never defined there. It is only declared in two locations:
                  • sound.h as an inline which registers the dummy parser if SOUND is not defined
                  • sound-core.c which registers the real parser if SOUND is defined


                  There should be no way whatsoever for register_sound_pref_parser to get this function declared twice.

                  As for the init_sound reference - looks like sound-core.c is not getting compiled for the Windows build. Ah, I just noticed I forgot to put a #ifdef SOUND around that in the case that you compile for Windows without sound.

                  I have an idea - in sound.h, can you try changing:

                  Code:
                  inline errr register_sound_pref_parser(struct parser *p)
                  to

                  Code:
                  static inline errr register_sound_pref_parser(struct parser *p)
                  Maybe your Windows compiler is a bit braindead about inline functions only having local scope - gcc does not have an issue given that we can compile the Linux builds with or without sound

                  EDIT: I'm also seeing problems in testing - the autobuilder is failing the birth tests again, and I'm getting a link error in make tests:
                  Do these tests fail without my patches? I looked at these tests, and they simply auto-enter a series of keystrokes to generate a new character.

                  Code:
                  ../angband.o: In function `init_parse_prefs':
                  /home/nick/angband/src/ui-prefs.c:1069: undefined reference to `register_sound_pref_parser'
                  My guess here is that it's something to do with the way SOUNDFILES is being handled - because sound-core.c is not compiled into angband.o, maybe? And I don't know if it's at all related to the Windows issue.
                  ui-prefs.c is where the call is made, and if SOUND is not defined, we pull the function in as an inline from sound.h. If SOUND is defined, we pull it in from sound-core.c - my guess is I haven't managed to get the Windows build scripts to build sound-core.c if SOUND is defined

                  Comment

                  • Nick
                    Vanilla maintainer
                    • Apr 2007
                    • 9647

                    #99
                    OK, I have fixed the Windows problems. The issue was that the Windows build doesn't use configure, it has its own handmade makefile, Makefile.win. So I had to make sure SOUND was defined and sound-core.c was being compiled, and it's all good.

                    The Linux situation is a bit more puzzling. Currently the autobuilder is fine with unit tests, but fails birth tests. My dev environment is the opposite - birth tests are fine, but for some reason I cannot fathom unit tests continue to complain that register_sound_pref_parser isn't defined.

                    I feel like there's some subtle dependency issue here, but it's relatively low priority.
                    One for the Dark Lord on his dark throne
                    In the Land of Mordor where the Shadows lie.

                    Comment

                    • calris
                      Adept
                      • Mar 2016
                      • 194

                      Glad you got the Windows build issue fixed - Does sound work properly in Windows using the new sound module? I can't test it at all, so if it works first go I'll be pretty stoked.

                      As for the Linux situation, can you tell me what the ./configure options are that result in register_sound_pref_parser not being defined?

                      Comment

                      • Nick
                        Vanilla maintainer
                        • Apr 2007
                        • 9647

                        Originally posted by calris
                        As for the Linux situation, can you tell me what the ./configure options are that result in register_sound_pref_parser not being defined?
                        I think I understand it better now, and it's not really related to the configure options, it's to do with where sound-core.c is linked.

                        Currently the build system compiles most of the files, links them to form angband.o, then compiles the main files and links them to form the final binary angband. You have set it up so that sound-core is compiled and linked in that second step, but the unit testing suite only uses angband.o. So when the linker looks at angband.o preparatory to compiling the test suite and linking them, it can't find register_sound_parser_pref(), because it isn't in angband.o.

                        The obvious quick fix I attempted was to compile sound-core into angband.o, but that results in tests having problems with init_sound_sdl not being defined...

                        I'm not sure what the best solution is, but I'll give it some more thought - if you have a good answer, I'd be delighted to hear it
                        One for the Dark Lord on his dark throne
                        In the Land of Mordor where the Shadows lie.

                        Comment

                        • calris
                          Adept
                          • Mar 2016
                          • 194

                          If SOUND is not defined and sound.h is included (which it is via ui-prefs.h), then the stub version of register_sound_pref_parser() will be included in angband.o

                          If SOUND is defined, then the platform specific code needs to define register_sound_pref_parser()

                          The obvious solution is to make sure SOUND is not defined when unit tests are build (since, as you say, no platform specific code is compiled for the unit tests)

                          I'm assuming the 'unit tests' define a special 'platform specific main' (the platform being the unit test suite). So of course, we could always define some kind of dummy sound module for the unit tests (which would be rather useful for testing the parsing of the sound preferences file)

                          Comment

                          • takkaria
                            Veteran
                            • Apr 2007
                            • 1951

                            Originally posted by calris
                            If SOUND is not defined and sound.h is included (which it is via ui-prefs.h), then the stub version of register_sound_pref_parser() will be included in angband.o

                            If SOUND is defined, then the platform specific code needs to define register_sound_pref_parser()

                            The obvious solution is to make sure SOUND is not defined when unit tests are build (since, as you say, no platform specific code is compiled for the unit tests)

                            I'm assuming the 'unit tests' define a special 'platform specific main' (the platform being the unit test suite). So of course, we could always define some kind of dummy sound module for the unit tests (which would be rather useful for testing the parsing of the sound preferences file)
                            This would require building two separate 'angband.o's, one for unit tests and one for the main frontends, which the build system doesn't support - it would require a reconfigure, make clean, and build again.

                            There is a simple solution to this, which is to treat the sound config separately to pref files, and then you don't need all this conditional compilation and inline function stuff.
                            takkaria whispers something about options. -more-

                            Comment

                            • calris
                              Adept
                              • Mar 2016
                              • 194

                              Originally posted by takkaria
                              There is a simple solution to this, which is to treat the sound config separately to pref files, and then you don't need all this conditional compilation and inline function stuff.
                              Which is kind of how we got into the mess we're in to begin with The whole point of this rework is to guarantee that all platforms process the sound configuration exactly the same way, using the standard parser we already have.

                              Part of the reason I put register_sound_pref_parser() as an inline stub in sound.h was to prevent breakage of builds which haven't been converted to the new sound module. They can proceed to initialise sound and parse the old sound config file as they see fit (for the time being).

                              sound-core.c needs to be outside angband.o to avoid symbol clashes with init_sound() - Maybe I could just rename init_sound() to say init_sound_standard() and move the whole box and dice into angband.o and then all that needs to be worried about at the platform level is to add the platform's sound module to sound_modules[] in sound-core.c and the platform specific sound code (which is neatly outside angband.o)

                              This will mean that the code for parsing the sound config will be in the binary whether sound is enabled or not, but a) it's a fairly trivial amount of code; and b) it makes life easier for the automated building of the unit tests

                              Comment

                              • takkaria
                                Veteran
                                • Apr 2007
                                • 1951

                                Originally posted by calris
                                Which is kind of how we got into the mess we're in to begin with The whole point of this rework is to guarantee that all platforms process the sound configuration exactly the same way, using the standard parser we already have.
                                You misunderstand. I think the standardisation is great, but I just think there's no reason to link the sound parsing to the pref file system. But I know we disagree on this.

                                sound-core.c needs to be outside angband.o to avoid symbol clashes with init_sound() - Maybe I could just rename init_sound() to say init_sound_standard() and move the whole box and dice into angband.o and then all that needs to be worried about at the platform level is to add the platform's sound module to sound_modules[] in sound-core.c and the platform specific sound code (which is neatly outside angband.o)

                                This will mean that the code for parsing the sound config will be in the binary whether sound is enabled or not, but a) it's a fairly trivial amount of code; and b) it makes life easier for the automated building of the unit tests
                                I think it makes the most sense to do that. However there's no reason to rename init_sound() - there's no frontends that use a function with that name, so there's no clashes.
                                takkaria whispers something about options. -more-

                                Comment

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