Пример #1
0
def test_stereo_angles(context):
    """Test read-write property stereo_angles."""
    with Source(context) as source:
        assert allclose(source.stereo_angles, (pi / 6, -pi / 6))
        source.stereo_angles = 420, -69
        assert allclose(source.stereo_angles, (420, -69))
        source.stereo_angles = -5 / 7, 9 / 11
        assert allclose(source.stereo_angles, (-5 / 7, 9 / 11))
Пример #2
0
def test_velocity(context):
    """Test read-write property velocity."""
    with Source(context) as source:
        assert allclose(source.velocity, (0, 0, 0))
        source.velocity = -1, 0, 1
        assert allclose(source.velocity, (-1, 0, 1))
        source.velocity = 4, 20, 69
        assert allclose(source.velocity, (4, 20, 69))
Пример #3
0
def test_position(context):
    """Test read-write property position."""
    with Source(context) as source:
        assert allclose(source.position, (0, 0, 0))
        source.position = -1, 0, 1
        assert allclose(source.position, (-1, 0, 1))
        source.position = 4, 20, 69
        assert allclose(source.position, (4, 20, 69))
Пример #4
0
def test_rolloff_factors(context):
    """Test read-write property rolloff_factors."""
    with Source(context) as source:
        assert allclose(source.rolloff_factors, (1, 0))
        with raises(ValueError):
            source.rolloff_factors = -6, 9
        with raises(ValueError):
            source.rolloff_factors = 6, -9
        source.rolloff_factors = 6, 9
        assert allclose(source.rolloff_factors, (6, 9))
Пример #5
0
def test_cone_angles(context):
    """Test read-write property cone_angles."""
    with Source(context) as source:
        assert allclose(source.cone_angles, (360, 360))
        with raises(ValueError):
            source.cone_angles = 420, 69
        with raises(ValueError):
            source.cone_angles = -4.20, 69
        with raises(ValueError):
            source.cone_angles = 4.20, -69
        source.cone_angles = 4.20, 69
        assert allclose(source.cone_angles, (4.20, 69))
Пример #6
0
def test_gain_range(context):
    """Test read-write property gain_range."""
    with Source(context) as source:
        assert allclose(source.gain_range, (0, 1))
        with raises(ValueError):
            source.gain_range = 9 / 11, 5 / 7
        with raises(ValueError):
            source.gain_range = 6 / 9, 420
        with raises(ValueError):
            source.gain_range = -420, 6 / 9
        source.gain_range = 5 / 7, 9 / 11
        assert allclose(source.gain_range, (5 / 7, 9 / 11))
Пример #7
0
def test_reverb_late_reverb_pan(context):
    """Test ReverbEffect's property late_reverb_pan."""
    with ReverbEffect() as fx:
        assert allclose(fx.late_reverb_pan, (0, 0, 0))
        fx.late_reverb_pan = 5/7, -69/420, 6/9
        assert allclose(fx.late_reverb_pan, (5/7, -69/420, 6/9))
        with raises(ValueError): fx.late_reverb_pan = 1, 1, 1
        with raises(ValueError): fx.late_reverb_pan = 0, 0, 2
        with raises(ValueError): fx.late_reverb_pan = 0, 2, 0
        with raises(ValueError): fx.late_reverb_pan = 2, 0, 0
        with raises(ValueError): fx.late_reverb_pan = 0, 0, -2
        with raises(ValueError): fx.late_reverb_pan = 0, -2, 0
        with raises(ValueError): fx.late_reverb_pan = -2, 0, 0
Пример #8
0
def test_outer_cone_gains(context):
    """Test read-write property outer_cone_gains."""
    with Source(context) as source:
        assert allclose(source.outer_cone_gains, (0, 1))
        with raises(ValueError):
            source.outer_cone_gains = 6 / 9, -420
        with raises(ValueError):
            source.outer_cone_gains = 6 / 9, 420
        with raises(ValueError):
            source.outer_cone_gains = -420, 6 / 9
        with raises(ValueError):
            source.outer_cone_gains = 420, 6 / 9
        source.outer_cone_gains = 5 / 7, 9 / 11
        assert allclose(source.outer_cone_gains, (5 / 7, 9 / 11))
Пример #9
0
def test_distance_range(context):
    """Test read-write property distance_range."""
    with Source(context) as source:
        assert allclose(source.distance_range, (1, FLT_MAX))
        with raises(ValueError):
            source.distance_range = 9 / 11, 5 / 7
        with raises(ValueError):
            source.distance_range = -420, 6 / 9
        with raises(ValueError):
            source.distance_range = 420, inf
        source.distance_range = 5 / 7, 9 / 11
        assert allclose(source.distance_range, (5 / 7, 9 / 11))
        source.distance_range = 1, FLT_MAX
        assert allclose(source.distance_range, (1, FLT_MAX))
Пример #10
0
def test_orientation(context):
    """Test read-write property orientation."""
    with Source(context) as source:
        assert allclose(source.orientation, ((0, 0, -1), (0, 1, 0)), allclose)
        source.orientation = (1, 1, -2), (3, -5, 8)
        assert allclose(source.orientation, ((1, 1, -2), (3, -5, 8)), allclose)