XP 스크립트

아래는 rmxp.net의 squall님이 작성한 psf(PS게임에서 덤프한 내장음원 사운드파일) 재생 스크립트입니다(WinAMP dll 사용 스크립트는 http://www.rpgfantasy.de 의 Andread21님이 작성):

#==============================================================================
# ■ Audio
#------------------------------------------------------------------------------
# Credits for Winamp class and Winamp.dll to Andreas21 (C) 2004
#
# Credits to Squall for Audio module and Game_system functions.
# squall@loeher.zzn.com
#
#==============================================================================
module Audio
 #==========================================================================
 # ■ Winamp
 #==========================================================================
 class Winamp
  #------------------------------------------------------------------------
  # ● initialize
  #------------------------------------------------------------------------
  def initialize
    in_dll = 'DLLin_psf.dll'
    out_dll = 'DLLout_wave.dll'
    winamp_dll = 'DLLWinamp.dll'
    @ReadIni = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
    @FindWindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
    @Init_Winamp = Win32API.new(winamp_dll, 'Init_Winamp', %w(p p l), 'l')
    @Winamp_Play = Win32API.new(winamp_dll, 'Winamp_Play', 'p', 'l')
    @Winamp_Pause = Win32API.new(winamp_dll, 'Winamp_Pause', '', '')
    @Winamp_Stop = Win32API.new(winamp_dll, 'Winamp_Stop', '', 'l')
    @Winamp_IsPlaying = Win32API.new(winamp_dll, 'Winamp_IsPlaying', '', 'l')
    @Winamp_GetFileInfo = Win32API.new(winamp_dll, 'Winamp_GetFileInfo', %w(p l), 'p')
    @Winamp_SetVolume = Win32API.new(winamp_dll, 'Winamp_SetVolume', 'l', '')
    @Winamp_IsPaused = Win32API.new(winamp_dll, 'Winamp_IsPaused', '', 'l')
    @Init_Winamp.call(in_dll, out_dll, setup)
  end
  def play(file)
    return @Winamp_Play.call(file)
  end
  def pause
    @Winamp_Pause.call()
  end
  def stop
    return @Winamp_Stop.call()
  end
  def is_playing?
    return @Winamp_IsPlaying.call()
  end
  def get_file_info(playfile, length_adr)
    return @Winamp_GetFileInfo.call(playfile, length_adr)
  end
  def set_volume(volume)
    @Winamp_SetVolume.call(volume)
  end
  def is_paused?
    return @Winamp_IsPaused.call()
  end
  def setup
    game_name = 0.chr * 255
    zeichen = @ReadIni.call('Game', 'Title', '', game_name, 255, ".\Game.ini")
    return @FindWindow.call('RGSS Player', game_name.slice!(0, zeichen))
  end
 end
 #--------------------------------------------------------------------------
 # ● define constant
 #--------------------------------------------------------------------------
 WINAMP = Winamp.new
 #--------------------------------------------------------------------------
 # ● Audio.psf_play(filename, [volume])
 #--------------------------------------------------------------------------
 def self.psf_play(filename, volume = 255)
  for extension in ['.psf', '.minipsf', '.psf2', '.minipsf2']
    if FileTest.exist?(filename + extension)
      filename = filename + extension
      break
    end
  end
  WINAMP.play(filename)
  WINAMP.set_volume(volume)
 end
 #--------------------------------------------------------------------------
 # ● Audio.psf_playing?
 #--------------------------------------------------------------------------
 def self.psf_playing?
  if WINAMP.is_playing? == 0
    return false
  else
    return true
  end
 end
 #--------------------------------------------------------------------------
 # ● Audio.psf_pause
 #--------------------------------------------------------------------------
 def self.psf_pause
  WINAMP.pause
 end
 #--------------------------------------------------------------------------
 # ● Audio.psf_paused?
 #--------------------------------------------------------------------------
 def self.psf_paused?
  if WINAMP.is_paused? == 0
    return false
  else
    return true
  end
 end
 #--------------------------------------------------------------------------
 # ● Audio.psf_stop
 #--------------------------------------------------------------------------
 def self.psf_stop
  WINAMP.stop
 end
end

#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# Changes added to the bgm_play and bgm_stop functions.
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 # ● Play Back Ground Music
 #--------------------------------------------------------------------------
 def bgm_play(bgm)
  @playing_bgm = bgm
  if bgm != nil and bgm.name != ""
    Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
    Audio.psf_play("Audio/BGM/" + bgm.name, bgm.volume)
  else
    Audio.bgm_stop
    Audio.psf_stop
  end
  Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 # ● Stop playing BGM
 #--------------------------------------------------------------------------
 def bgm_stop
  Audio.bgm_stop
  Audio.psf_stop
 end
end

**사용법:
  프로젝트 디렉토리 아래에 dll 디렉토리를 만들고 첨부한 winamp.dll과 WinAMP용 psf재생 플러그인인 Highly Experimental(http://www.neillcorlett.com/he/ ), WinAMP 출력플러그인인 out_wave.dll(WinAMP있는 분은 WinAMP 플러그인 디렉토리에서 바로 복사하세요)을 넣어주고 원하는 psf/psf2/minipsf/minipsf2를 프로젝트 아래 AudioBGM에 복사해 넣습니다(RMXP에서는 이들 파일의 import를 지원하지 않습니다). 
  여기서 입력플러그인을 다른 것으로 지정하고 불러올 파일의 확장자를 바꾸면 다른 형식의 음악파일 재생도 가능합니다.
  그리고 플러그인 관련 설정은 WinAMP에서 한 뒤에 플러그인 디렉토리에 있는 plugin.ini나 플러그인별 ini등에서 내용을 복사해 dll 디렉토리에 역시 plugin.ini란 파일명으로 넣어주면 됩니다.(무한재생을 위해서 필요)

**주의:
- RMXP에서 지원하지 않는 파일형식을 스크립트를 통해 지원하도록 한 것이기 때문에 툴에서 가져오거나 미리듣기를 할 수 없습니다.(게임 중에서는 재생됩니다)
- minipsf, minigsf 확장자의 파일은 psflib, gsflib확장자의 파일이 함께 있어야 정상적으로 재생됩니다.
- 해당음악파일의 피치 조정은 불가능합니다.
- 플러그인에 따라서는 플러그인뿐만 아니라 그 플러그인이 사용하는 별도의 dll도 필요합니다.(가령 SPC재생 플러그인은 SNESAPU.dll을 요구)
- 이 스크립트를 정상적으로 작동시키려면 손상되지 않은 RGSS100J.dll이 필요합니다.  1.02에서는 정상적으로 실행될 수도 있고 안될수도 있습니다.(스크립트가 꼬이거나 하지 않으면 됩니다)
- 게임중 이벤트에 의해 배경음악이 느려지거나 반복에 문제가 생길 수 있습니다(특히 병렬처리되는 이벤트가 있을 때)
- 콘솔게임에서 덤프한 사운드파일의 경우 재생을 위해 음원 에뮬레이션 과정이 추가되기 때문에(맞나?) 일반적으로 사용하는 wav나 mp3등보다 CPU점유율이 더 높아집니다.(즉, 배경음악이 미디나 mp3일때는 음악이 끊기지 않더라도 psf나 spc등을 사용할 때는 음악이 끊기는 일이 생길 수 있습니다)

**psf파일은
http://www.zophar.net/psf/
http://oddigy.com/
http://www.tzone.org/~llin/psf/
http://www.caitsith2.com/psf/
등에서 구할 수 있습니다.  그리고
http://www.vorc.org
를 체크하면 그 외 콘솔게임 사운드파일 업데이트 소식을 볼 수 있습니다.

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
441 기타 ID띄우기 스크립트(新) 3 백호 2009.02.22 1280
440 기타 제작한 게임의 파일을 모두 exe파일 하나에 쓸어담기 by sheefo@Creation Asylum 1 file 백호 2009.02.22 1239
439 HUD 맵 이름 표시 by Slipknot@rmxp.net (SDK호환) 2 백호 2009.02.22 1463
438 기타 파노라마 스크롤 스크립트 개량판 by Guillaume777 1 백호 2009.02.22 896
437 맵/타일 Map Event Large Make 2 백호 2009.02.22 1132
436 기타 ABS 몬스터 HP 게이지 바 11 백호 2009.02.22 2483
435 그래픽 Bitmap update 2.0 by Linkin_T 1 백호 2009.02.22 985
434 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
433 스킬 Skill Shop by SephirothSpawn file 백호 2009.02.22 813
432 메시지 Animated Window Skin by Tana 1 백호 2009.02.22 1338
431 기타 Weather Script 1.02 by ccoa 1 file 백호 2009.02.22 809
430 아이템 아이템 인벤토리 2 file 백호 2009.02.22 3354
429 기타 일시정지 스크립트 2 file 백호 2009.02.22 1796
428 장비 Multi-equip script ver.6 by Guillaume777 4 file 백호 2009.02.22 1210
427 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
426 메뉴 KGC 메뉴화면 개조 스크립트 번역 3 file 백호 2009.02.22 1940
425 메뉴 자작 커스텀 메뉴(데모 첨부) 3 백호 2009.02.22 2347
424 아이템 아이템을 얻으면 자동으로 아이템 입수 메세지윈도우 띄우기 4 백호 2009.02.22 2279
423 기타 아래 스크립트에 대한 Guillaume777님의 개량판입니다. 백호 2009.02.22 880
» 오디오 WinAMP 플러그인을 이용하여 RMXP에서 다른 형식의 음악파일 재생하기 file 백호 2009.02.22 1259
Board Pagination Prev 1 ... 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... 52 Next
/ 52