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
  #76    
Old August 21st, 2017 (7:02 PM). Edited August 22nd, 2017 by yonicstudios.
yonicstudios's Avatar
yonicstudios yonicstudios is offline
Game Developer
     
    Join Date: Oct 2015
    Location: Spain
    Nature: Timid
    Posts: 48
    The parameter position seems to be missing from FmodEx.bgm_play(), but there is such parameter on the FmodEx::Sound initializer. It kind of buzzes me off because I don't want to have a new FmodEx::Sound that runs independently from the BGM channel just to mess around with the playing position.

    I have two almost identical BGMs, and I'd like to play the next BGM at the position the previous BGM was when it stopped, so that it can create a smooth transition between both tracks.


    This won't produce any effect:

    Code:
    position = FmodEx.bgm_sound.get_position # Get previous bgm play position
    newBGM = FmodEx.bgm_play("Audio/BGM/ambient02.ogg") # Load new bgm
    newBGM.set_position(position) # The new bgm will start from the same position
    Is there a way to place the new FmodEx::Sound in the BGM channel so that it behaves exactly like a BGM sound would?
    __________________
    WORKING GAMES
    Pokémon related:
    - Pokécurse BloodRed Version (Q3-Q4 2018)


    Not Pokémon related:
    - My Dog's Tale (July 11th 2018)

    Reply With Quote

    Relevant Advertising!

      #77    
    Old August 22nd, 2017 (8:24 AM).
    塗 ゆり's Avatar
    塗 ゆり 塗 ゆり is offline
    Scripter / RGSS Modder
       
      Join Date: Apr 2011
      Location: France
      Age: 24
      Gender: Other
      Posts: 80
      I tested this :
      Code:
      FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
      FmodEx.bgm_sound.pause(true)
      position = FmodEx.bgm_sound.get_position
      bgm = FmodEx.bgm_play("Audio/BGM/24 Pokemon Center.flac")
      bgm.set_position(position)
      There's a short time with no music due to the slowness of Ruby but the music starts at the right point.

      If you want to make a FmodEx::Sound "acting" like a BGM you should do this :
      Code:
      FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
      old_bgm = FmodEx.bgm_sound
      old_bgm.pause(true)
      position = old_bgm.get_position
      new_bgm = FmodEx::Sound.new(filename = "Audio/BGM/24 Pokemon Center.flac", 100, 100, position, true, true)
      new_bgm.instance_variable_set(:@name, filename)
      FmodEx.bgm_stop
      FmodEx.instance_variable_set(:@bgm_sound, new_bgm)
      The problem here is that the ME wont affect the new BGM because I used a C++ variable in the code for the ME Thread (to prevent Ruby Thread Violation).

      There's something you can probably do otherwise :
      Play the two bgm a the same time and set the volume to 0 for the one you don't want to be hear. (The best thing is also to prevent ME to affect the Main BGM so you should use FmodEx::Sound ^^)
      __________________
      Nuri Yuri
      Pokémon Workshop | Facebook Page
      Reply With Quote
        #78    
      Old August 22nd, 2017 (8:43 AM).
      yonicstudios's Avatar
      yonicstudios yonicstudios is offline
      Game Developer
         
        Join Date: Oct 2015
        Location: Spain
        Nature: Timid
        Posts: 48
        Quote:
        Originally Posted by 塗 ゆり View Post
        I tested this :
        Code:
        FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
        FmodEx.bgm_sound.pause(true)
        position = FmodEx.bgm_sound.get_position
        bgm = FmodEx.bgm_play("Audio/BGM/24 Pokemon Center.flac")
        bgm.set_position(position)
        There's a short time with no music due to the slowness of Ruby but the music starts at the right point.
        When trying this out, an error points out that neither FmodEx::TIMEUNIT_PCM nor FmodEx.set_unit are defined. Taking a wild guess, it might be that I'm using an old version of the dll?
        __________________
        WORKING GAMES
        Pokémon related:
        - Pokécurse BloodRed Version (Q3-Q4 2018)


        Not Pokémon related:
        - My Dog's Tale (July 11th 2018)

        Reply With Quote
          #79    
        Old August 22nd, 2017 (8:44 AM).
        塗 ゆり's Avatar
        塗 ゆり 塗 ゆり is offline
        Scripter / RGSS Modder
           
          Join Date: Apr 2011
          Location: France
          Age: 24
          Gender: Other
          Posts: 80
          Yes you have an old version. Since I upgraded to RGSS3 I didn't updated the RGSS1 FmodEx plugin :/
          Does it works without the line that bug ?
          __________________
          Nuri Yuri
          Pokémon Workshop | Facebook Page
          Reply With Quote
            #80    
          Old August 22nd, 2017 (9:01 AM).
          yonicstudios's Avatar
          yonicstudios yonicstudios is offline
          Game Developer
             
            Join Date: Oct 2015
            Location: Spain
            Nature: Timid
            Posts: 48
            No, it produces the same result as I was having.

            I'd try out the FmodEx::Sound solution, but I need to play a couple or two MEs.

            As for playing two BGMs at the same time, do you mean having one as FmodEx::Sound and the other one being the BGM?
            __________________
            WORKING GAMES
            Pokémon related:
            - Pokécurse BloodRed Version (Q3-Q4 2018)


            Not Pokémon related:
            - My Dog's Tale (July 11th 2018)

            Reply With Quote
              #81    
            Old August 22nd, 2017 (9:24 AM).
            塗 ゆり's Avatar
            塗 ゆり 塗 ゆり is offline
            Scripter / RGSS Modder
               
              Join Date: Apr 2011
              Location: France
              Age: 24
              Gender: Other
              Posts: 80
              Ok, I rebuilt the DLL (I hope with the good settings) : http://www.mediafire.com/file/knt7ran4nhbw0sq/RGSS_FmodEx.dll
              Try my test with this one.

              For the two BGM at the same time I was meaning both should be FmodEx::Sound an not a regular BGM because the ME would dephase the main BGM from the other FmodEx::Sound ^^'
              __________________
              Nuri Yuri
              Pokémon Workshop | Facebook Page
              Reply With Quote
                #82    
              Old August 22nd, 2017 (9:59 AM).
              yonicstudios's Avatar
              yonicstudios yonicstudios is offline
              Game Developer
                 
                Join Date: Oct 2015
                Location: Spain
                Nature: Timid
                Posts: 48
                Ouch, I need to update fmodex.dll as well. The link you provided for version 4.68.97 is down, can you upload it again?
                __________________
                WORKING GAMES
                Pokémon related:
                - Pokécurse BloodRed Version (Q3-Q4 2018)


                Not Pokémon related:
                - My Dog's Tale (July 11th 2018)

                Reply With Quote
                  #83    
                Old August 22nd, 2017 (10:10 AM).
                塗 ゆり's Avatar
                塗 ゆり 塗 ゆり is offline
                Scripter / RGSS Modder
                   
                  Join Date: Apr 2011
                  Location: France
                  Age: 24
                  Gender: Other
                  Posts: 80
                  http://www.mediafire.com/file/vj64d7cuwj2ct27/fmodex.dll
                  __________________
                  Nuri Yuri
                  Pokémon Workshop | Facebook Page
                  Reply With Quote
                    #84    
                  Old August 22nd, 2017 (10:36 AM).
                  yonicstudios's Avatar
                  yonicstudios yonicstudios is offline
                  Game Developer
                     
                    Join Date: Oct 2015
                    Location: Spain
                    Nature: Timid
                    Posts: 48
                    The new BGM doesn't play, and bgm remains undefined, so I'm guessing that it's failing to produce any playback?
                    Reply With Quote
                      #85    
                    Old August 22nd, 2017 (10:42 AM).
                    塗 ゆり's Avatar
                    塗 ゆり 塗 ゆり is offline
                    Scripter / RGSS Modder
                       
                      Join Date: Apr 2011
                      Location: France
                      Age: 24
                      Gender: Other
                      Posts: 80
                      What code did you write ?
                      __________________
                      Nuri Yuri
                      Pokémon Workshop | Facebook Page
                      Reply With Quote
                        #86    
                      Old August 22nd, 2017 (11:02 AM).
                      yonicstudios's Avatar
                      yonicstudios yonicstudios is offline
                      Game Developer
                         
                        Join Date: Oct 2015
                        Location: Spain
                        Nature: Timid
                        Posts: 48
                        I've placed this code on an event.

                        Code:
                        Script: FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
                                   : FmodEx.bgm_sound.pause(true)
                                   : position = FmodEx.bgm_sound.get_position
                        Conditional branch: bgm = FmodEx.bgm_play("Audio/BGM/celadon_show.ogg",100,100)
                            bgm.set_position(position)
                        End
                        __________________
                        WORKING GAMES
                        Pokémon related:
                        - Pokécurse BloodRed Version (Q3-Q4 2018)


                        Not Pokémon related:
                        - My Dog's Tale (July 11th 2018)

                        Reply With Quote
                          #87    
                        Old August 22nd, 2017 (11:11 AM).
                        塗 ゆり's Avatar
                        塗 ゆり 塗 ゆり is offline
                        Scripter / RGSS Modder
                           
                          Join Date: Apr 2011
                          Location: France
                          Age: 24
                          Gender: Other
                          Posts: 80
                          Why a conditional branch ?
                          Btw RMXP has a misconception with Conditional branch, they only work if the return value is true (which is not how ruby works).

                          You should put the whole code in only one Script command.
                          __________________
                          Nuri Yuri
                          Pokémon Workshop | Facebook Page
                          Reply With Quote
                            #88    
                          Old August 22nd, 2017 (11:27 AM). Edited August 22nd, 2017 by yonicstudios.
                          yonicstudios's Avatar
                          yonicstudios yonicstudios is offline
                          Game Developer
                             
                            Join Date: Oct 2015
                            Location: Spain
                            Nature: Timid
                            Posts: 48
                            I used a conditional branch because of how RMXP handles word wrapping on script commands. Either way, I managed to put the code in a single script command, but the effect remains the same.

                            Code:
                            FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
                            FmodEx.bgm_sound.pause(true)
                            position = FmodEx.bgm_sound.get_position
                            file = "Audio/BGM/celadon_show.ogg"
                            bgm = FmodEx.bgm_play(file,100,100)
                            __________________
                            WORKING GAMES
                            Pokémon related:
                            - Pokécurse BloodRed Version (Q3-Q4 2018)


                            Not Pokémon related:
                            - My Dog's Tale (July 11th 2018)

                            Reply With Quote
                              #89    
                            Old August 22nd, 2017 (11:34 AM).
                            塗 ゆり's Avatar
                            塗 ゆり 塗 ゆり is offline
                            Scripter / RGSS Modder
                               
                              Join Date: Apr 2011
                              Location: France
                              Age: 24
                              Gender: Other
                              Posts: 80
                              There's no bgm.set_position(position) in your script command
                              __________________
                              Nuri Yuri
                              Pokémon Workshop | Facebook Page
                              Reply With Quote
                                #90    
                              Old August 22nd, 2017 (11:49 AM). Edited August 22nd, 2017 by yonicstudios.
                              yonicstudios's Avatar
                              yonicstudios yonicstudios is offline
                              Game Developer
                                 
                                Join Date: Oct 2015
                                Location: Spain
                                Nature: Timid
                                Posts: 48
                                Oops. Even with that line, the new BGM won't play.
                                __________________
                                WORKING GAMES
                                Pokémon related:
                                - Pokécurse BloodRed Version (Q3-Q4 2018)


                                Not Pokémon related:
                                - My Dog's Tale (July 11th 2018)

                                Reply With Quote
                                  #91    
                                Old August 22nd, 2017 (12:00 PM).
                                塗 ゆり's Avatar
                                塗 ゆり 塗 ゆり is offline
                                Scripter / RGSS Modder
                                   
                                  Join Date: Apr 2011
                                  Location: France
                                  Age: 24
                                  Gender: Other
                                  Posts: 80
                                  Weird :/
                                  Does the old bgm play ?
                                  __________________
                                  Nuri Yuri
                                  Pokémon Workshop | Facebook Page
                                  Reply With Quote
                                    #92    
                                  Old August 22nd, 2017 (12:16 PM). Edited August 22nd, 2017 by yonicstudios.
                                  yonicstudios's Avatar
                                  yonicstudios yonicstudios is offline
                                  Game Developer
                                     
                                    Join Date: Oct 2015
                                    Location: Spain
                                    Nature: Timid
                                    Posts: 48
                                    When the new bgm is supposed to be playing, the music is silent, but upon commanding the game to play the old bgm, the old one plays normally.
                                    __________________
                                    WORKING GAMES
                                    Pokémon related:
                                    - Pokécurse BloodRed Version (Q3-Q4 2018)


                                    Not Pokémon related:
                                    - My Dog's Tale (July 11th 2018)

                                    Reply With Quote
                                      #93    
                                    Old August 22nd, 2017 (12:53 PM).
                                    塗 ゆり's Avatar
                                    塗 ゆり 塗 ゆり is offline
                                    Scripter / RGSS Modder
                                       
                                      Join Date: Apr 2011
                                      Location: France
                                      Age: 24
                                      Gender: Other
                                      Posts: 80
                                      Hum... Does the file in question plays with a normal command like BGM change ? (or as a Map BGM)
                                      __________________
                                      Nuri Yuri
                                      Pokémon Workshop | Facebook Page
                                      Reply With Quote
                                        #94    
                                      Old August 22nd, 2017 (1:02 PM). Edited August 22nd, 2017 by yonicstudios.
                                      yonicstudios's Avatar
                                      yonicstudios yonicstudios is offline
                                      Game Developer
                                         
                                        Join Date: Oct 2015
                                        Location: Spain
                                        Nature: Timid
                                        Posts: 48
                                        It does play as a Map BGM. Making it to play like the new BGM seems to work as intended. The change is instant, although probably with a PCM sample or two of silence, so a pop efect appears. I can work with this, though, since it's most likely me having a fairly powerful CPU. Merci beaucoup!

                                        EDIT: It seems like FmodEx.set_unit(FmodEx::TIMEUNIT_PCM) is not necessary.
                                        __________________
                                        WORKING GAMES
                                        Pokémon related:
                                        - Pokécurse BloodRed Version (Q3-Q4 2018)


                                        Not Pokémon related:
                                        - My Dog's Tale (July 11th 2018)

                                        Reply With Quote
                                          #95    
                                        Old August 22nd, 2017 (1:19 PM).
                                        塗 ゆり's Avatar
                                        塗 ゆり 塗 ゆり is offline
                                        Scripter / RGSS Modder
                                           
                                          Join Date: Apr 2011
                                          Location: France
                                          Age: 24
                                          Gender: Other
                                          Posts: 80
                                          De rien :p

                                          Yes, this line was just in case the current unit was MS and not PCM ^^ (I don't know what happen before the command ^^)
                                          __________________
                                          Nuri Yuri
                                          Pokémon Workshop | Facebook Page
                                          Reply With Quote
                                            #96    
                                          Old August 22nd, 2017 (5:00 PM). Edited August 22nd, 2017 by yonicstudios.
                                          yonicstudios's Avatar
                                          yonicstudios yonicstudios is offline
                                          Game Developer
                                             
                                            Join Date: Oct 2015
                                            Location: Spain
                                            Nature: Timid
                                            Posts: 48
                                            I noticed a strange bug: Sometimes switching between BGMs causes the music to be played in a position earlier than intended.
                                            If the music happens to be close to the end, it will try to play the music in an invalid position and crashes. I've only been able to get this error once, but if I manage to reproduce it, I'll include the value of the position to check if it's valid or not. That way it may be possible to have a rescue value in case this occurs again.

                                            Here's the error in question:


                                            Code:
                                            Message: Script error within map 80 (Underground Show):
                                            Exception: FmodEx::Error
                                            Message: Section198:7:in `set_position'FMOD error! (38) An invalid seek position was passed to this function. 
                                            
                                            ***Full script:
                                            file="Audio/BGM/celadon_show.ogg"
                                            bgmPlayPlus(file,90)
                                            
                                            Interpreter:243:in `pbExecuteScript'
                                            Audio utils:7:in `bgmPlayPlus'
                                            (eval):2:in `pbExecuteScript'
                                            Interpreter:1606:in `eval'
                                            Interpreter:243:in `pbExecuteScript'
                                            Interpreter:1606:in `command_355'
                                            Interpreter:494:in `execute_command'
                                            Interpreter:193:in `update'
                                            Interpreter:106:in `loop'
                                            Interpreter:198:in `update'
                                            
                                            Interpreter:281:in `pbExecuteScript'
                                            Interpreter:1606:in `command_355'
                                            Interpreter:494:in `execute_command'
                                            Interpreter:193:in `update'
                                            Interpreter:106:in `loop'
                                            Interpreter:198:in `update'
                                            Scene_Map:103:in `update'
                                            Scene_Map:101:in `loop'
                                            Scene_Map:114:in `update'
                                            Scene_Map:68:in `main'
                                            And the method bgmPlayPlus:

                                            Code:
                                            def bgmPlayPlus(file,volume=100,pitch=100)
                                              if FmodEx.bgm_sound!=nil
                                                FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
                                                FmodEx.bgm_sound.pause(true)
                                                position = FmodEx.bgm_sound.get_position
                                                bgm = FmodEx.bgm_play(file,volume,pitch)
                                                bgm.set_position(position)
                                              else
                                                bgm = FmodEx.bgm_play(file,volume,pitch)
                                              end
                                            end
                                            __________________
                                            WORKING GAMES
                                            Pokémon related:
                                            - Pokécurse BloodRed Version (Q3-Q4 2018)


                                            Not Pokémon related:
                                            - My Dog's Tale (July 11th 2018)

                                            Reply With Quote
                                              #97    
                                            Old August 23rd, 2017 (1:00 AM).
                                            塗 ゆり's Avatar
                                            塗 ゆり 塗 ゆり is offline
                                            Scripter / RGSS Modder
                                               
                                              Join Date: Apr 2011
                                              Location: France
                                              Age: 24
                                              Gender: Other
                                              Posts: 80
                                              I heard the offset on the position yesterday but today I didn't :/ I think that Fmod gives the position a little earlier because it thinks the process is too slow I don't know.

                                              For the "end of music" issue I suggest this :
                                              Code:
                                              def bgmPlayPlus(file,volume=100,pitch=100)
                                                if FmodEx.bgm_sound!=nil
                                                  FmodEx.set_unit(FmodEx::TIMEUNIT_PCM)
                                              	position = FmodEx.bgm_sound.get_position
                                                  #FmodEx.bgm_sound.pause(true) #If the BGM sound is the same, it just pause the BGM because the script doesn't create new instance when the music is the same
                                                  bgm = FmodEx.bgm_play(file,volume,pitch)
                                                  bgm.set_position(position % bgm.length)
                                                else
                                                  bgm = FmodEx.bgm_play(file,volume,pitch)
                                                end
                                              end
                                              __________________
                                              Nuri Yuri
                                              Pokémon Workshop | Facebook Page
                                              Reply With Quote
                                                #98    
                                              Old August 26th, 2017 (9:05 PM).
                                              Woah Woah is offline
                                                 
                                                Join Date: Aug 2014
                                                Location: New Brunswick
                                                Gender: Male
                                                Nature: Mild
                                                Posts: 85
                                                I know this issue has been brought up and resolved over and over, but I'm still having problems with the RGSS104E.dll. I am getting the error "This isn't the RGSS104 library!" despite changing the FILE NAME in the root FROM "RGSS102E.dll" TO "RGSS104E.dll," and doing the same thing in game.ini



                                                Highlighted in the image are the three files I've downloaded for FMOD, plus RGSS104E.dll. Do I have everything? Am I missing something?
                                                Thank you.
                                                __________________

                                                Reply With Quote
                                                  #99    
                                                Old August 27th, 2017 (1:40 AM). Edited August 27th, 2017 by 塗 ゆり.
                                                塗 ゆり's Avatar
                                                塗 ゆり 塗 ゆり is offline
                                                Scripter / RGSS Modder
                                                   
                                                  Join Date: Apr 2011
                                                  Location: France
                                                  Age: 24
                                                  Gender: Other
                                                  Posts: 80
                                                  The RGSS Linker is able to detect if your RGSS DLL is the right one (because otherwise you would get a SEGFAULT).

                                                  There's one thing to know : RPG Maker XP has the bad habit to change your RGSS DLL in your Game Folder and that's a huge issue. If you use an illegal version of RPG Maker XP (if your DLL is RGSS100J or RGSS102E/J it's a illegal one) you'll have some issues. It's recommanded to use the steam version of RPG Maker or RPG Maker XP 1.03 (in French).

                                                  The only way to fix the problem with an illegal version of RPG Maker is to rewrite the "Game.exe" in order to load a RGSS DLL named an other way than in Game.ini. (I use this trick on Pokémon SDK because RPG Maker XP replace the RGSS3 dll with the RGSS1 one :v )

                                                  PS : The dll file you have to use is this one : http://www.mediafire.com/file/49t6lre8r93mir3/RGSS104E.dll You can rename it RGSS102E if you want.
                                                  __________________
                                                  Nuri Yuri
                                                  Pokémon Workshop | Facebook Page
                                                  Reply With Quote
                                                    #100    
                                                  Old August 27th, 2017 (7:30 AM).
                                                  Woah Woah is offline
                                                     
                                                    Join Date: Aug 2014
                                                    Location: New Brunswick
                                                    Gender: Male
                                                    Nature: Mild
                                                    Posts: 85
                                                    Quote:
                                                    Originally Posted by 塗 ゆり View Post
                                                    The only way to fix the problem with an illegal version of RPG Maker is to rewrite the "Game.exe" in order to load a RGSS DLL named an other way than in Game.ini. (I use this trick on Pokémon SDK because RPG Maker XP replace the RGSS3 dll with the RGSS1 one :v )
                                                    Thanks for the reply! But, how would I "rewrite" game.exe exactly? Also, why do you keep recommending we change RGSS104E back to 102E if fmod only works with 104? Is there a way to make fmod compatible with 102E?

                                                    Sorry for all the questions. I've realized game.ini resetting itself has been the problem this whole time, but getting a legal version is out of the question (long story).
                                                    __________________

                                                    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 11:31 PM.