- 23
- Posts
- 10
- Years
- Seen Dec 18, 2018
Ok, so for the past 5+ weeks i've been stuck in development hell, this is the ONLY thing i need to do to release my pokemon game ive been working on for shy of 2 years.
I've included F mod into my pokemon essentials game (That dose have the ELITE BATTLE add on) to loop new music I add to the game. The audio track will sync from the end of the track to the middle and sound like one seamless loop.
What ends up happening is that it works fine for all music that I imported and set up like this. But all other tracks have been messed up because of this.All audio tracks that come with pokemon essentials repeats instead of looping. They are playing from start to end, then no sound plays for a second or two, then the track plays from the beginning.
When i remove the f MOD script the problem with the old pre packaged tracks disappear but now my new tracks that i wanted to set up to loop will now just repeat.
What i think is going on that the Fmod script is reading all the pre packaged tracks, and since there is no audio tag for it ( a start loop and loop length tag) it treats it like a normal track, ignores or overwright the original audio tags on that song and makes it repeat instead of loop.
What i think might be able to solve it is if there is a way for the f mod script to ignore all audio tracks that i don't specify in it's script (if it dosent already do that.)
I've left my f MOD scripts below, i have no idea what is going on, i do have a small demo map that i can hand out if anybody thinks they can solve it from there end.
Any ideas on how i can solve this? :(
I've included F mod into my pokemon essentials game (That dose have the ELITE BATTLE add on) to loop new music I add to the game. The audio track will sync from the end of the track to the middle and sound like one seamless loop.
What ends up happening is that it works fine for all music that I imported and set up like this. But all other tracks have been messed up because of this.All audio tracks that come with pokemon essentials repeats instead of looping. They are playing from start to end, then no sound plays for a second or two, then the track plays from the beginning.
When i remove the f MOD script the problem with the old pre packaged tracks disappear but now my new tracks that i wanted to set up to loop will now just repeat.
What i think is going on that the Fmod script is reading all the pre packaged tracks, and since there is no audio tag for it ( a start loop and loop length tag) it treats it like a normal track, ignores or overwright the original audio tags on that song and makes it repeat instead of loop.
What i think might be able to solve it is if there is a way for the f mod script to ignore all audio tracks that i don't specify in it's script (if it dosent already do that.)
I've left my f MOD scripts below, i have no idea what is going on, i do have a small demo map that i can hand out if anybody thinks they can solve it from there end.
Any ideas on how i can solve this? :(
Code:
#===
#RGSS Linker (Kernel)
# Function that helps the load of extentions using RGSS Linker.
#---
#© 2015 - Nuri Yuri (塗 ゆり)
#===
module Kernel
unless @RGSS_Linker #>To avoid the RGSS Reset problem
@RGSS_Linker = {:core => Win32API.new("RGSS Linker.dll","RGSSLinker_Initialize","p","i")}
Win32API.new("kernel32","GetPrivateProfileString","ppppip","i").call("Game","Library",0,lib_name = "\x00"*32,32,".//Game.ini")
raise LoadError, "Failed to load RGSS Linker." unless(@RGSS_Linker[:core].call(lib_name)==1)
lib_name = nil
module_function
#===
#>Kernel.load_module
# Helps to load a RGSS extension
#---
#I : module_filename : String : Name of the file which contains the extension
# module_function : String : Name of the function that will load the extension
#===
def load_module(module_filename, module_function)
return if @RGSS_Linker[module_filename]
mod = @RGSS_Linker[module_filename] = Win32API.new(module_filename, module_function, "", "")
mod.call
end
end #>unless @RGSS_Linker
end
#===
#Audio (FmodEx)
# A rewrite of Audio module to integrate FmodEx
#---
#© 2015 - Nuri Yuri (塗 ゆり)
#© 2015 - GiraPrimal : Concept of LOOP_TABLE
#---
#Script written by the menbers of the Community Script Project
#===
module Audio
LOOP_TABLE = [
# [ "Audio/xxx/File_name", begin, end ]
# Add here
[ "Audio/BGM/champ2", 48567,89624 ],
[ "Audio/BGM/Zinnia2.ogg", 13806,174578],
[ "Audio/BGM/Youaremyhope", 42324,233692]
# 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
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)
bgm = ::FmodEx.bgm_play(filename, volume, pitch)
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
#===
#>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
Last edited by a moderator: