The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Script RGSS FmodEx extension

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Reply
 
Thread Tools
  #101    
Old August 27th, 2017 (11:14 AM).
塗 ゆり's Avatar
塗 ゆり 塗 ゆり is offline
Scripter / RGSS Modder
     
    Join Date: Apr 2011
    Location: France
    Age: 24
    Gender: Other
    Posts: 80
    You need to write a C/C++ program that loads the functions of the RGSS.
    I recommand to rename the RGSS104E.dll I give to RGSS102E.dll because your illegal version of RMXP use RGSS102E.dll (which is buggy as hell btw). It's not the name that is important, that's the content of the whole thing. You can rename any dll you want to RGSS104E.dll the RGSS Linker will say the same "It's not RGSS104E.dll", btw the RGSS Linker doesn't care of the name of the dll since you give him the name you gave to RGSS104E.dll.
    __________________
    Nuri Yuri
    Pokémon Workshop | Facebook Page
    Reply With Quote

    Relevant Advertising!

      #102    
    Old November 5th, 2017 (2:29 PM).
    z_orochii's Avatar
    z_orochii z_orochii is offline
    PKMN Trainer
       
      Join Date: Nov 2008
      Location: Costa Rica
      Gender:
      Nature: Quirky
      Posts: 3
      Hi Nuri Yuri. I was looking at your script and I got interested in the part that says that you can use DLS for MIDI, since that sounds pretty cool. I've found some free DLS to try it out but I can't get it to work.

      I changed a little of code in order to add the DLS name directly to the bgm_play function when it is called but haven't been able to use the DLS, it seems to ignore whatever I pass it as a string.

      Here is the code I have, just in case.
      Code:
      #===
      #Audio (FmodEx)
      #  A rewrite of Audio module to integrate FmodEx
      #---
      #© 2015 - Nuri Yuri (塗 ゆり)
      #© 2015 - GiraPrimal : Concept of LOOP_TABLE
      #---
      #Script written by the members of the Community Script Project
      #===
      module Audio
        LOOP_TABLE = [
        # [ "Audio/xxx/File_name", begin, end ]
        # Add here
      
        
        # Note : Renember to add a comma after each ]
        #       (except for the last line and the below ]).
        ]
        #---
        #>Puts the file names in lowercase to improve the search
        #---
        LOOP_TABLE.each do |i| i[0].downcase! end
        DLS_FILENAME = "Fury.dls"
        @asdf = ""
        unless @bgm_play #>To avoid the RGSSReset problem
        #===
        #>Load and initialize FmodEx
        #===
        Kernel.load_module("RGSS FmodEx.dll","Init_FmodEx")
        ::FmodEx.init(32)
        #---
        #>Indication of the default lib'
        #---
        @library = ::FmodEx
        #---
        #>Saving the RGSS functions
        #---
        @bgm_play = method(:bgm_play)
        @bgm_fade = method(:bgm_fade)
        @bgm_stop = method(:bgm_stop)
        @bgs_play = method(:bgs_play)
        @bgs_fade = method(:bgs_fade)
        @bgs_stop = method(:bgs_stop)
        @me_play = method(:me_play)
        @me_fade = method(:me_fade)
        @me_stop = method(:me_stop)
        @se_play = method(:se_play)
        @se_stop = method(:se_stop)
        #---
        #>Volumes definition
        #---
        @master_volume = 100
        @sfx_volume = 100
        #===
        #>Extensions supported by FmodEx
        #===
        EXT = ['.ogg', '.mp3', '.wav', '.mid', '.aac', '.wma', '.it', '.xm', '.mod', '.s3m', '.midi']
        #===
        #>Creation/definition of the functions
        #===
        module_function
        def bgm_play(file_name, volume = 100, pitch = 100)
          volume = volume * @master_volume / 100
          return @bgm_play.call(file_name, volume, pitch) if(@library != ::FmodEx)
          filename = check_file(file_name)
          
          ext = check_extension(filename)
          print ext
          case ext
          when 'mid'
            bgm = ::FmodEx.bgm_play(filename, volume, pitch, false, nil, DLS_FILENAME)
          else
            bgm = ::FmodEx.bgm_play(filename, volume, pitch)
          end
          
          
          loop_audio(bgm, file_name)
        end
        def bgm_fade(time)
          return @bgm_fade.call(time) if(@library != ::FmodEx)
          ::FmodEx.bgm_fade(time)
        end
        def bgm_stop
          return @bgm_stop.call if(@library != ::FmodEx)
          ::FmodEx.bgm_stop
        end
        def bgs_play(file_name, volume = 100, pitch = 100)
          volume = volume * @sfx_volume / 100
          return @bgs_play.call(file_name, volume, pitch) if(@library != ::FmodEx)
          filename = check_file(file_name)
          bgs = ::FmodEx.bgs_play(filename, volume, pitch)
          loop_audio(bgs, file_name)
        end
        def bgs_fade(time)
          return @bgs_fade.call(time) if(@library != ::FmodEx)
          ::FmodEx.bgs_fade(time)
        end
        def bgs_stop
          return @bgs_stop.call if(@library != ::FmodEx)
          ::FmodEx.bgs_stop
        end
        def me_play(file_name, volume = 100, pitch = 100)
          volume = volume * @master_volume / 100
          return @me_play.call(file_name, volume, pitch) if(@library != ::FmodEx)
          file_name = check_file(file_name)
          ::FmodEx.me_play(file_name, volume, pitch)
        end
        def me_fade(time)
          return @me_fade.call(time) if(@library != ::FmodEx)
          ::FmodEx.me_fade(time)
        end
        def me_stop
          return @me_stop.call if(@library != ::FmodEx)
          ::FmodEx.me_stop
        end
        def se_play(file_name, volume = 100, pitch = 100)
          volume = volume * @sfx_volume / 100
          return @se_play.call(file_name, volume, pitch) if(@library != ::FmodEx)
          file_name = check_file(file_name)
          ::FmodEx.se_play(file_name, volume, pitch)
        end
        def se_stop
          return @se_stop.call if(@library != ::FmodEx)
          ::FmodEx.se_stop
        end
        #===
        #>check_file
        #  Check the presence of the file and return the filename
        #  /!\ Doesn't correct the mistake
        #====
        def check_file(file_name)
          return file_name if File.exist?(file_name)
          EXT.each do |ext|
            filename = file_name+ext
            return filename if File.exist?(filename)
          end
          return file_name
        end
        #===
        #>check extension
        # '\_(¨,)/'
        #====
        def check_extension(file_name)
          return file_name.split(".")[-1]
        end
        #===
        #>loop_audio
        # Function that automatically call the set_loop_points
        #===
        def loop_audio(sound, file_name)
          filename = file_name.downcase
          LOOP_TABLE.each do |i|
            if(i[0] == filename)
              return sound.set_loop_points(i[1], i[2])
            end
          end
        end
        end
      end
      I'm also interested in the play from position thing. I'll see if I can make that work too later, since it's a cool feature only seen in RMVXAce (the RPG Maker with the best default audio module so far).

      Thanks for this by the way, it's pretty cool :^).
      __________________

      Name: Mana
      Adopt one yourself! @Pokémon Orphanage
      Reply With Quote
        #103    
      Old June 15th, 2018 (3:52 PM). Edited June 15th, 2018 by SilverioRB.
      SilverioRB SilverioRB is offline
         
        Join Date: Oct 2015
        Gender: Male
        Posts: 1
        Hello there, guys.

        It's my first time posting something here, and I came with some questions about this FmodEx.
        Since I'm kinda noob in programing in Ruby, I'm struggling to understand it properly. So, let's go:

        1-Where exactly do I need to put these scripts? I created two new classes under Audio sections, which ones is "RGSS Linker" and "FmodEx Audio". Is it right?

        2-How I set the especifc audio files that I want to loop? I did the following set only, but it didn't work:

        LOOP_TABLE = ["Audio/BGM/217 Route 4 (Summer)",346273,1465664]

        Where the first set is the audio file, (folder, subfolder, file name, LOOPSTART and LOOPLENGTH. I believe it's wrong... Is there something more I need to add? And can I add more than just one file?

        3-This works for map BGM too, or just Battle BGM? If it works on maps, do I need to add some event on the map calling some kind of script?

        4- Do I need to tag the LOOPSTART and the LOOPLENGTH on the audio file on some kind of audio editing program (like Audacity) before I set the music on the game?

        I believe that's all for now.

        Thanks in advance!! ^^


        EDIT: I did it to work in maps. It's working fine on maps, but it doesn't work in battle themes... Why? :/
        Can someone help me?
        Reply With Quote
        Reply

        Quick Reply

        Join the conversation!

        Create an account to post a reply in this thread, participate in other discussions, and more!

        Create a PokéCommunity Account

        Sponsored Links
        Thread Tools

        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


        All times are GMT -8. The time now is 6:33 PM.