Module: Audio

Defined in:
docs/0_Dependencies.rb

Overview

Module responsive of handling audio in game

Defined Under Namespace

Classes: DriverBase, FMODDriver, SFMLAudioDriver

Constant Summary collapse

FADE_IN_BY_DEFAULT =

Constant allowing maker to define if music must fade in by default

true

Class Method Summary collapse

Class Method Details

.__init__

Globally initialize the audio module (after all driver has been chosen and the game was loaded)



2629
2630
# File 'docs/0_Dependencies.rb', line 2629

def __init__
end

.__release__

Globally release the audio module (after the game is done or if you need to swap drivers)



2632
2633
# File 'docs/0_Dependencies.rb', line 2632

def __release__
end

.__reset__

Globally reset the audio (when soft resetting the game or for other reasons)



2635
2636
# File 'docs/0_Dependencies.rb', line 2635

def __reset__
end

.bgm_fade(time)

Fades the BGM

Parameters:

  • time (Integer)

    fade time in ms



2698
2699
# File 'docs/0_Dependencies.rb', line 2698

def bgm_fade(time)
end

.bgm_play(filename, volume = 100, pitch = 100, fade_in = FADE_IN_BY_DEFAULT)

plays a BGM and stop the current one

Parameters:

  • filename (String)

    name of the audio file

  • volume (Integer) (defaults to: 100)

    volume of the BGM between 0 and 100

  • pitch (Integer) (defaults to: 100)

    speed of the BGM in percent

  • fade_in (Boolean, Integer) (defaults to: FADE_IN_BY_DEFAULT)

    if the BGM fades in when different (or time in ms)



2686
2687
# File 'docs/0_Dependencies.rb', line 2686

def bgm_play(filename, volume = 100, pitch = 100, fade_in = FADE_IN_BY_DEFAULT)
end

.bgm_positionInteger

Returns the BGM position

Returns:

  • (Integer)


2690
2691
# File 'docs/0_Dependencies.rb', line 2690

def bgm_position
end

.bgm_position=(position)

Set the BGM position

Parameters:

  • position (Integer)


2694
2695
# File 'docs/0_Dependencies.rb', line 2694

def bgm_position=(position)
end

.bgm_stop

Stop the BGM



2701
2702
# File 'docs/0_Dependencies.rb', line 2701

def bgm_stop
end

.bgs_fade(time)

Fades the BGS

Parameters:

  • time (Integer)

    fade time in ms



2720
2721
# File 'docs/0_Dependencies.rb', line 2720

def bgs_fade(time)
end

.bgs_play(filename, volume = 100, pitch = 100, fade_in = FADE_IN_BY_DEFAULT)

plays a BGS and stop the current one

Parameters:

  • filename (String)

    name of the audio file

  • volume (Integer) (defaults to: 100)

    volume of the BGS between 0 and 100

  • pitch (Integer) (defaults to: 100)

    speed of the BGS in percent

  • fade_in (Boolean, Integer) (defaults to: FADE_IN_BY_DEFAULT)

    if the BGS fades in when different (or time in ms)



2708
2709
# File 'docs/0_Dependencies.rb', line 2708

def bgs_play(filename, volume = 100, pitch = 100, fade_in = FADE_IN_BY_DEFAULT)
end

.bgs_positionInteger

Returns the BGS position

Returns:

  • (Integer)


2712
2713
# File 'docs/0_Dependencies.rb', line 2712

def bgs_position
end

.bgs_position=(position)

Set the BGS position

Parameters:

  • position (Integer)


2716
2717
# File 'docs/0_Dependencies.rb', line 2716

def bgs_position=(position)
end

.bgs_stop

Stop the BGS



2723
2724
# File 'docs/0_Dependencies.rb', line 2723

def bgs_stop
end

.cry_play(filename, volume = 100, pitch = 100)

plays a cry

Parameters:

  • filename (String)

    name of the audio file

  • volume (Integer) (defaults to: 100)

    volume of the SE between 0 and 100

  • pitch (Integer) (defaults to: 100)

    speed of the SE in percent



2760
2761
# File 'docs/0_Dependencies.rb', line 2760

def cry_play(filename, volume = 100, pitch = 100)
end

.driverDriverBase

Get the current driver

Returns:



2642
2643
# File 'docs/0_Dependencies.rb', line 2642

def driver
end

.me_fade(time)

Fades the ME

Parameters:

  • time (Integer)

    fade time in ms



2742
2743
# File 'docs/0_Dependencies.rb', line 2742

def me_fade(time)
end

.me_play(filename, volume = 100, pitch = 100, preserve_bgm = false)

plays a ME and stop the current one

Parameters:

  • filename (String)

    name of the audio file

  • volume (Integer) (defaults to: 100)

    volume of the ME between 0 and 100

  • pitch (Integer) (defaults to: 100)

    speed of the ME in percent

  • preserve_bgm (Boolean) (defaults to: false)

    if the bgm should not be paused



2730
2731
# File 'docs/0_Dependencies.rb', line 2730

def me_play(filename, volume = 100, pitch = 100, preserve_bgm = false)
end

.me_positionInteger

Returns the ME position

Returns:

  • (Integer)


2734
2735
# File 'docs/0_Dependencies.rb', line 2734

def me_position
end

.me_position=(position)

Set the ME position

Parameters:

  • position (Integer)


2738
2739
# File 'docs/0_Dependencies.rb', line 2738

def me_position=(position)
end

.me_stop

Stop the ME



2745
2746
# File 'docs/0_Dependencies.rb', line 2745

def me_stop
end

.music_channelsArray<Symbol>

Get all the music channels (to patch if you want to include more)

Returns:

  • (Array<Symbol>)


2663
2664
# File 'docs/0_Dependencies.rb', line 2663

def music_channels
end

.music_volumeInteger

Get volume of bgm and me

Returns:

  • (Integer)

    a value between 0 and 100



2655
2656
# File 'docs/0_Dependencies.rb', line 2655

def music_volume
end

.music_volume=(value)

Set the volume of bgm and me

Parameters:

  • value (Integer)

    a value between 0 and 100



2659
2660
# File 'docs/0_Dependencies.rb', line 2659

def music_volume=(value)
end

.register_driver(driver_name, driver_class)

Register an audio driver

Parameters:

  • driver_name (Symbol)

    name of the driver

  • driver_class (Class<DriverBase>)

    driver class (to instanciate when chosen)



2647
2648
# File 'docs/0_Dependencies.rb', line 2647

def register_driver(driver_name, driver_class)
end

.se_play(filename, volume = 100, pitch = 100)

plays a SE if possible

Parameters:

  • filename (String)

    name of the audio file

  • volume (Integer) (defaults to: 100)

    volume of the SE between 0 and 100

  • pitch (Integer) (defaults to: 100)

    speed of the SE in percent



2751
2752
# File 'docs/0_Dependencies.rb', line 2751

def se_play(filename, volume = 100, pitch = 100)
end

.se_stop

Stop SE



2754
2755
# File 'docs/0_Dependencies.rb', line 2754

def se_stop
end

.sfx_channelsArray<Symbol>

Get all the sfx channels (to patch if you want to include more)

Returns:

  • (Array<Symbol>)


2675
2676
# File 'docs/0_Dependencies.rb', line 2675

def sfx_channels
end

.sfx_volumeInteger

Get volume of sfx

Returns:

  • (Integer)

    a value between 0 and 100



2667
2668
# File 'docs/0_Dependencies.rb', line 2667

def sfx_volume
end

.sfx_volume=(value)

Set the volume of sfx

Parameters:

  • value (Integer)

    a value between 0 and 100



2671
2672
# File 'docs/0_Dependencies.rb', line 2671

def sfx_volume=(value)
end

.update

Update the audio (must be called every meaningful frames)



2638
2639
# File 'docs/0_Dependencies.rb', line 2638

def update
end