Class: Seal::EffectSlot

Inherits:
Object
  • Object
show all
Defined in:
src/rubyext.c,
src/rubyext.c

Overview

Interfaces for manipulating effect slots, which are containers for effect objects. Effect slots can attach effect objects (such as reverb objects) and then be fed with a mix of audio from different sources, essentially filtering the rendering of the sound sources and output to the mixer based on the attached effect object. For example, if a reverb object is attached to an effect slot and one source is feeding the slot, the sound of that source will have the reverberation effect defined by the reverb object.

Multiple sources can feed the same effect slot, but conversely there is a limit on the number of effect slots a source can feed concurrently. See the documentation for EffectSlot#feed for more details.

For more infomation about effect slots, check out the OpenAL effect extension guide at: zhang.su/seal/EffectsExtensionGuide.pdf

Instance Method Summary (collapse)

Constructor Details

- (Object) new - (Object) new(effect)

Initializes a new effect slot. If an effect object is specified, initializes the effect slot to have that effect object associated.

There is a limit on the number of allocated effect slots. This method raises an error if it is exceeding the limit.



1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
# File 'src/rubyext.c', line 1613

static
VALUE
init_efs(int argc, VALUE* argv, VALUE rslot)
{
    VALUE reffect;

    rb_scan_args(argc, argv, "01", &reffect);
    check_seal_err(seal_init_efs(DATA_PTR(rslot)));
    if (!NIL_P(reffect))
        set_efs_effect(rslot, reffect);

    return rslot;
}

Instance Method Details

- (Boolean) auto Also known as: auto?

Determines if the effect is automatically adjusted. The default is true (nonzero).

Returns:

  • (Boolean)


1688
1689
1690
1691
1692
1693
# File 'src/rubyext.c', line 1688

static
VALUE
is_efs_auto(VALUE refs)
{
    return get_obj_char(refs, seal_is_efs_auto);
}

- (Boolean) auto=(true)

Sets whether the effect should have automatic adjustments based on the physical positions of the sources and the listener.

Returns:

  • (Boolean)


1674
1675
1676
1677
1678
1679
# File 'src/rubyext.c', line 1674

static
VALUE
set_efs_auto(VALUE refs, VALUE value)
{
    return set_obj_char(refs, value, seal_set_efs_auto);
}

- (Object) effect

Gets the effect object in effect_slot. The default is nil.



1633
1634
1635
1636
1637
1638
# File 'src/rubyext.c', line 1633

static
VALUE
get_efs_effect(VALUE rslot)
{
    return rb_iv_get(rslot, "@effect");
}

- (Object) effect=(effect)

Fills effect_slot with effect, then effect_slot will become ready to be fed by sources. Pass nil to unfill the slot.

Changing the parameters of effect after it is attached to effect_slot will not change the sound effect provided by effect_slot. To update the sound effect, the updated effect must be re-attached to effect_slot.



1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
# File 'src/rubyext.c', line 1583

static
VALUE
set_efs_effect(VALUE rslot, VALUE reffect)
{
    void* effect;
    seal_err_t err;

    if (NIL_P(reffect)) {
        err = seal_set_efs_effect(DATA_PTR(rslot), 0);
    } else {
        Data_Get_Struct(reffect, void*, effect);
        err = seal_set_efs_effect(DATA_PTR(rslot), effect);
    }
    check_seal_err(err);
    rb_iv_set(rslot, "@effect", reffect);

    return reffect;
}

- (Object) gain

Gets the output level of effect_slot. The default is 1.0.



1660
1661
1662
1663
1664
1665
# File 'src/rubyext.c', line 1660

static
VALUE
get_efs_gain(VALUE refs)
{
    return get_obj_float(refs, seal_get_efs_gain);
}

- (Object) gain=(flt)

Sets the output level of effect_slot in the interval [0.0, 1.0]. A value of 0.0 mutes the output.



1647
1648
1649
1650
1651
1652
# File 'src/rubyext.c', line 1647

static
VALUE
set_efs_gain(VALUE refs, VALUE value)
{
    return set_obj_float(refs, value, seal_set_efs_gain);
}