RPG Maker Forums

Hey! I was wondering if anyone could help me with an issue I've been having.

I've been using the MCI Audio Player to be able to play more than one BGM/BGS simultaneously (I've been using it alongside the RPG Maker audio engine rather than as a replacement). I've also been using Dynamic Sound Emitting Events so that the volume for BGM or BGS is adjusted depending on how far away the player is from an event. Now I'd like to be able to do this with audio channels I create with the MCI Audio Player as well, not just with the standard audio engine.

I don't know Ruby too well, so I've only managed to make this change so far:

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Frame Update #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def update return unless audiofile && $game_map.events[event_id] case @sound_type when :SE, :ME return unless update_se_me? audiofile.volume = calc_volume if recalc_vol? audiofile.pitch = calc_pitch reset_timer when :BGM, :BGS return unless recalc_vol? new_vol = calc_volume # Distance calculation # If variation < 3 and not transitioning to limit return if Audio['distance'].volume == new_vol || (Audio['distance'].volume.between?(new_vol - 2, new_vol + 2) && (Audio['distance'].volume != 0 && new_vol != 0) && (Audio['distance'].volume != max_volume && new_vol != max_volume)) Audio['distance'].volume = new_vol end if Audio['distance'].volume == 0 Audio['distance'].play('Audio/BGS/river_flowing.wav', 0, 100, true) else Audio['distance'].fade(1, new_vol) end endIt works beautifully with 'Audio/BGS/river_flowing.wav' - it becomes quieter or louder depending on how far the player is, completely bypassing the regular audio engine, but obviously it breaks the feature that allows you to determine which file to play via an event comment. Basically, I'd like a comment like this to work properly:

\emit_BGM { name = "Audio/BGS/cricket_chirping.wav" min_volume = 15max_volume = 100 radius = 15 }In this case, "Audio/BGS/cricket_chirping.wav"  would replace 'Audio/BGS/river_flowing.wav'.

It'd also be great to have an extra "channel" argument in the event comment to replace Audio['distance']. This would allow me to create several sound emitting events. I'm not sure how to go about doing this, though.

I'd be really grateful if anyone could help me out.

***

EDIT: I've just answered one of my questions. The line I was looking for was Audio['distance'].play(@filename, 0, 100, true) - now I need to figure out the second.

EDIT 2: I think I've found an acceptable solution:

def update return unless audiofile && $game_map.events[event_id] case @sound_type when :SE, :ME return unless update_se_me? audiofile.volume = calc_volume if recalc_vol? audiofile.pitch = calc_pitch reset_timer when :BGM, :BGS return unless recalc_vol? new_vol = calc_volume # Distance calculation # If variation < 3 and not transitioning to limit return if Audio[@filename].volume == new_vol || (Audio[@filename].volume.between?(new_vol - 2, new_vol + 2) && (Audio[@filename].volume != 0 && new_vol != 0) && (Audio[@filename].volume != max_volume && new_vol != max_volume)) Audio[@filename].volume = new_vol end Audio[@filename].fade(1, new_vol) endIt's a workaround, but I actually prefer it this way - now "name =" determines the name of the audio channel, not the file to be played.. For the audio to start playing, we need to trigger it externally, giving us better control over it. The event comment only adjusts the volume now.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top