Contenu | Rechercher | Menus

Annonce

Ubuntu-fr vend de superbes t-shirts et de belles clés USB 32Go
Rendez-vous sur la boutique En Vente Libre

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 09/08/2013, à 00:49

Striffly

MPlayer et le looping (loopstart/looplength, start_cue,..)

Bonjour bonjour !!

Je suis actuellement en train de créer un jeu vidéo sous un logiciel nommé RPG Maker VX (sous Windows, shame on me tongue). Pour résoudre divers problèmes au niveau du son dans le jeu, un logiciel alternatif à utiliser directement dans le jeu m'a été proposé : mplayer (et ça c'est Linux o/).
Cependant, un attribut très intéressant des musiques se voit supprimer avec ce logiciel : le looping. On a par exemple les attributs LOOPSTART et LOOPLENGTH pour le format .ogg (que le logiciel lit à merveille), ou encore pour le format .wav les attributs start_cue et end_cue, qui se trouvent ignorés : la musique fait une boucle simple, et non pas la boucle d'une partie de la musique.

Ma question : existe-t-il un moyen que le logiciel lise ces attributs ?


Voici les différents fichiers contenus dans mon "pack" :
Fichiers contenus

Contenu du fichier config de mplayer :

# Default options for Kovensky's MPlayer
# Manual available at http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html
fontconfig=1
embeddedfonts=1
ass=1
font='Sans'
subfont-osd-scale=4

dr=0
vf=screenshot

Et enfin pour les personnes ayant des connaissances en RGSS2, le script utilisé par le logiciel :

=begin
                        Continue BGM After Battle

Author: BulletXt(bulletxt@gmail.com)
Version: 0.3 Beta1
Date: 16/10/2009

Description:
This script will make your map's bgm continue playing after battle ends
instead of restarting.

WARNING: You must have installed Microsoft Visual C++ 2008 Redistributable Package,
         you can get it here:
http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en

WARNING2: you must not set a battle BGM that is MIDI format and/or part of RTP.
         

To install to a new project:
-copy this script and place it as FIRST script in the Material section
-copy all dlls found in root directory of the demo
-copy mplayer folder
-copy Start.exe and Rescue.exe

When starting the game, you can either normally start it from Game.exe
or from Start.exe (clicking on Start.exe avoids loading external gui).
=end
  
#                              CONFIGURATION

#this is the name of the exe to start the game. Do not add file extension.
STARTGAME = "Start"
#this is the name of the Recover Audio engine exe. Do not add file extension.
RESCUE = "Rescue"

#this is a switch ID. When ON, map's BGM will continue playing in battle.
CONTINUE_BGM = 9

#this is a switch ID. When ON, it enables Random Battle BGM.
ENABLE_RANDOM_BATTLE_BGM = 10
=begin
these are the Battle BGMs that you want to play randomly.
example:
BATTLE_BGMS_THAT_PLAY_RANDOMLY = ["Battle1", "Battle2","Battle3"]
You can change this array at any time in game through a script call inside
event. To do this type for example:
$audio_random_battle = ["r_Battle1", "r_Battle2","r_Battle3"]
=end
BATTLE_BGMS_THAT_PLAY_RANDOMLY = ["r_Battle1", "r_Battle2","r_Battle3"]

################################################################################
######################### END CONFIGURATION ####################################
################################################################################


#this holds the random battle array globally
$audio_random_battle = BATTLE_BGMS_THAT_PLAY_RANDOMLY
$audio_battle_bgm_random_tmp_id = "nil"
FORMAT_OF_SONGS = ["mp3","ogg","wav","wma"]
######################### CHECK IF ENGINE IS RUNNING ###########################
#if in test mode, start the recover audio engine
  begin
    #send a string to server. if it exists it means it must not open a new recover gui.  
    open("\\\\.\\pipe\\audio_engine_xt",'w') { |pipe| pipe.write("nil,nil,nil"); } rescue recover = 1    
    #this returns true if there is no recover gui engine running.
    if recover == 1
      Thread.new{system (RESCUE)} 
      recover = 0
    end   
end

############################ Handle F12 Reset key ##############################
unless $f12_cleaner_F3XXEFA1.nil?
    #if in test mode, warn the user he is leaving testing mode
    if $TEST
    p sprintf("You are now leaving testing mode.")
    end
  
#kill recover GUI and mplayer
system "start /MIN /B taskkill /F /IM #{RESCUE+".exe"} "
system "start /MIN /B taskkill /F /IM #{"mplayer.exe"} "

# Opens the game executable in a new thread
Thread.new{system (STARTGAME+".exe")}
# Exits this thread
exit
end
$f12_cleaner_F3XXEFA1 = true


module AudioSuffix
  def suffix_check
    for codec in 0...FORMAT_OF_SONGS.size
    path = "Audio\\BGM\\"
    path.gsub!('\\', "/") 
    song_file_name = $game_system.battle_bgm.name + "." + FORMAT_OF_SONGS[codec]
    
      if FileTest.exist?(path+song_file_name)
        $audio_suffix = "." + FORMAT_OF_SONGS[codec]
        break
      end
    end  
  end
  
  def recover
  # start recover audio engine
    Thread.new{system (RESCUE)}
    #warn the user that the engine has crashed
    $game_message.texts.push("The Audio Engine server has crashed.")
    $game_message.texts.push("A Rescue GUI mode of the engine should have started.") 
    $game_message.texts.push("If it didn't, please manually click on #{RESCUE}.exe .")
    $game_message.texts.push("Remember to close it after closing game.")
    #do a sleep of n seconds to give the time for the engine to start
    sleep(4) #FIX: its not said 6 seconds are enough
  end
  
  
end


class Game_Map
  
  # initialize the Random Battle BGM array
  # the original Random Battle BGM code was made from ERZENGEL
  attr_accessor :rbmfiles
  alias audio_rbm_initialize initialize
  def initialize
    #set @rbmfiles to the Battle BGM array set by user in CONFIGURATION
    @rbmfiles = $audio_random_battle
    audio_rbm_initialize
  end
  
  #this is a real time update. gets executed each frame.
  #this makes the random battle array always be aware of any change
  #set from Player.
  alias bulletxt_random_battle_update update
  def update
    bulletxt_random_battle_update
    @rbmfiles = $audio_random_battle
  end
end


class Scene_Map < Scene_Base
include AudioSuffix
  
  def call_battle
  
    # This handles Random Battle BGM
    rbmoff = $data_system.battle_bgm.name.clone
  # if true, it means Random Battle BGM should happen
  if $game_switches[ENABLE_RANDOM_BATTLE_BGM]
     #debug battle bgm array   
     #p $game_map.rbmfiles  
    # this gets a random element from the array 
    audio = rand($game_map.rbmfiles.size)
    #if < 1, it must not add anything to array
    if $game_map.rbmfiles.size > 1
     #this puts back the previously removed element into array. at first run
     #this doesn't add anything because the variable is set to nil
    $game_map.rbmfiles.push($audio_battle_bgm_random_tmp_id) if $audio_battle_bgm_random_tmp_id != "nil"
    end 
    #this global variable holds the last random Battle BGM. it's needed so at
    #next run we know the element to put back in array (since it gets deleted below)
    $audio_battle_bgm_random_tmp_id = $game_map.rbmfiles[audio]
    #debug the battle bgm that is about to play
    #p $audio_battle_bgm_random_tmp_id
    #this tells VX who is the random Battle BGM to play
    $data_system.battle_bgm.name = $game_map.rbmfiles[audio]
    #if < 1, it must not remove anything from array
    if $game_map.rbmfiles.size > 1
=begin  
remove current Battle BGM from array, so at next battle the random won't
play this again. This avoids that a battle BGM plays 2 times consecutively.
The element gets back in to array at next run after getting the new random
battle bgm to play.
=end    
    $game_map.rbmfiles.delete_at(audio) 
    end
  else
  #here the Random Battle BGM code finishes.
  end    
    
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last

    if $game_switches[CONTINUE_BGM]
      continue_bgm
      return
    end
    
    #get values of current plaging bgm
    $audio_name = $game_temp.map_bgm.name
    $audio_volume = $game_temp.map_bgm.volume
    $audio_pitch = $game_temp.map_bgm.pitch
    #start playing the same bgm again but with volume at 0
    Audio.bgm_play("Audio/BGM/" + $audio_name, 0, $audio_pitch) rescue nil
    #make game temp bgm be equal to the new playing BGM, so after battle ends
    #it knows who's the values of the bgm to restore (it actually just continues
    #playing it but with volume restored)
    $game_temp.map_bgm = RPG::BGM.new
    $game_temp.map_bgm.name = $audio_name
    $game_temp.map_bgm.volume = $audio_volume
    $game_temp.map_bgm.pitch = $audio_pitch
    
    RPG::BGS.stop
    Sound.play_battle_start
    
    #call suffix function, it returns the exact suffix of bgm
    suffix_check
    #prepeare bgm volume and name to send to server
    volume = $game_system.battle_bgm.volume
    id = $game_system.battle_bgm.name + $audio_suffix
    battle_song = id + ",play," + volume.to_s()
    open("\\\\.\\pipe\\audio_engine_xt",'w') { |pipe| pipe.write(battle_song); } rescue rec = 1    
    
    if rec == 1
      recover
      rec = 0
      open("\\\\.\\pipe\\audio_engine_xt",'w') { |pipe| pipe.write(battle_song); } rescue nil
    end
    
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end
 
  
  def continue_bgm
    Sound.play_battle_start
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end
  
end

# Forced Victory ME Stop - KGC_ForceStopVictoryME
# http://ytomy.sakura.ne.jp
module KGC
  module ForceStopVictoryME
  #  Fade out time (milli-second)
  #  If set to 0, the ME stops instantly upon scene change to map.
  FADE_TIME = 1000
  end
end
$imported = {} if $imported == nil
$imported["ForceStopVictoryME"] = true
#end code of Forced Victory ME Stop - KGC_ForceStopVictoryME

class Scene_Battle < Scene_Base
include AudioSuffix

  alias bulletxt_continue_bgm_process_victory process_victory
  def process_victory
   
    suffix_check
    stop = $game_system.battle_bgm.name + $audio_suffix + ",stop," + "0"
    open("\\\\.\\pipe\\audio_engine_xt",'w') { |pipe| pipe.write(stop); } rescue nil    
    @info_viewport.visible = false
    @message_window.visible = true
    $game_system.battle_end_me.play  if $game_switches[CONTINUE_BGM] == false
    unless $BTEST
      $game_temp.map_bgm.play
      $game_temp.map_bgs.play
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end
  
  alias bulletxt_continue_bgm_battle_end battle_end
  def battle_end(result)
    suffix_check
    stop = $game_system.battle_bgm.name + $audio_suffix + ",stop," + "0"
    open("\\\\.\\pipe\\audio_engine_xt",'w') { |pipe| pipe.write(stop); } rescue nil    
    bulletxt_continue_bgm_battle_end(result)
 
# Forced Victory ME Stop - KGC_ForceStopVictoryME
# http://ytomy.sakura.ne.jp
    return if result != 0
    @@_victory_me_thread = Thread.new {
      time = KGC::ForceStopVictoryME::FADE_TIME
       RPG::ME.fade(time)                         # Start ME Fade
       sleep(time / 1000.0)                       # Wait until the fade is done.
       RPG::ME.stop                               # Stop ME                      
    }
    #end code of Forced Victory ME Stop - KGC_ForceStopVictoryME
  end  
  
  
end

Si quelqu'un aurait une solution,cela m'arrangerait beaucoup ^^

Merci, et bonne soirée smile

Hors ligne