Hey all,
I've been trying to change the audio in RPGXP over to my own module, but I'm having trouble getting my calls to the Win32API to work. So far I'm just trying to get it to play a single .mp3 file using in RMXP, but my code does not play the file - but it doesn't throw any errors either. Here is the code:
I've also tried doing the same thing just in Ruby alone, but it produced the same result - no music, and no errors. Here's the code for that:
Does anyone know why this code does not work? I'm sure it's something simple that I'm not seeing.
I'd appreciate any help, thanks!
I've been trying to change the audio in RPGXP over to my own module, but I'm having trouble getting my calls to the Win32API to work. So far I'm just trying to get it to play a single .mp3 file using in RMXP, but my code does not play the file - but it doesn't throw any errors either. Here is the code:
Code:
def Audio.bgm_play( fileName, volume, pitch )
mciSendString = Win32API.new("winmm", "mciSendString", ['P','P','L','L'], 'L')
mciSendString.call('open C:\Documents and Settings\FROST\Desktop\Game\Audio\BGM\Game_Theme.mp3 type waveaudio alias voice1', nil, 0, 0)
mciSendString.call('play voice1', nil, 0, 0)
end
I've also tried doing the same thing just in Ruby alone, but it produced the same result - no music, and no errors. Here's the code for that:
Code:
require 'Win32API'
mciSendString = Win32API.new("winmm", "mciSendString", ['P','P','L','L'], 'L')
mciSendString.call('open C:\Documents and Settings\FROST\Desktop\Game\Audio\BGM\Game_Theme.mp3 type waveaudio alias voice1', nil, 0, 0)
mciSendString.call('play voice1', nil, 0, 0)
loop do
#...
end
Does anyone know why this code does not work? I'm sure it's something simple that I'm not seeing.
I'd appreciate any help, thanks!