mirror of
				https://github.com/onyx-and-iris/voicemeeter-api-python.git
				synced 2025-11-03 23:21:48 +00:00 
			
		
		
		
	pan_x, pan_y added to virtual strips
pan_x, pan_y virt tests added to higher. patch bump
This commit is contained in:
		
							parent
							
								
									108c327c52
								
							
						
					
					
						commit
						5ad5622612
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
[tool.poetry]
 | 
					[tool.poetry]
 | 
				
			||||||
name = "voicemeeter-api"
 | 
					name = "voicemeeter-api"
 | 
				
			||||||
version = "0.9.0"
 | 
					version = "0.9.1"
 | 
				
			||||||
description = "A Python wrapper for the Voiceemeter API"
 | 
					description = "A Python wrapper for the Voiceemeter API"
 | 
				
			||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
 | 
					authors = ["onyx-and-iris <code@onyxandiris.online>"]
 | 
				
			||||||
license = "MIT"
 | 
					license = "MIT"
 | 
				
			||||||
 | 
				
			|||||||
@ -381,6 +381,8 @@ class TestSetAndGetFloatHigher:
 | 
				
			|||||||
    @pytest.mark.parametrize(
 | 
					    @pytest.mark.parametrize(
 | 
				
			||||||
        "index, param, value",
 | 
					        "index, param, value",
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
 | 
					            (data.virt_in, "pan_x", -0.6),
 | 
				
			||||||
 | 
					            (data.virt_in, "pan_x", 0.6),
 | 
				
			||||||
            (data.virt_in, "treble", -1.6),
 | 
					            (data.virt_in, "treble", -1.6),
 | 
				
			||||||
            (data.virt_in, "mid", 5.8),
 | 
					            (data.virt_in, "mid", 5.8),
 | 
				
			||||||
            (data.virt_in, "bass", -8.1),
 | 
					            (data.virt_in, "bass", -8.1),
 | 
				
			||||||
 | 
				
			|||||||
@ -82,13 +82,13 @@ class Strip(IRemote):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class PhysicalStrip(Strip):
 | 
					class PhysicalStrip(Strip):
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def make(cls, remote, i, kind):
 | 
					    def make(cls, remote, i, is_phys):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Factory method for PhysicalStrip.
 | 
					        Factory method for PhysicalStrip.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Returns a PhysicalStrip class.
 | 
					        Returns a PhysicalStrip class.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        EFFECTS_cls = _make_effects_mixins[kind.name]
 | 
					        EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
 | 
				
			||||||
        return type(
 | 
					        return type(
 | 
				
			||||||
            f"PhysicalStrip",
 | 
					            f"PhysicalStrip",
 | 
				
			||||||
            (cls, EFFECTS_cls),
 | 
					            (cls, EFFECTS_cls),
 | 
				
			||||||
@ -164,6 +164,20 @@ class StripDevice(IRemote):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class VirtualStrip(Strip):
 | 
					class VirtualStrip(Strip):
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def make(cls, remote, i, is_phys):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Factory method for PhysicalStrip.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Returns a PhysicalStrip class.
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
 | 
				
			||||||
 | 
					        return type(
 | 
				
			||||||
 | 
					            f"VirtualStrip",
 | 
				
			||||||
 | 
					            (cls, EFFECTS_cls),
 | 
				
			||||||
 | 
					            {},
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        return f"{type(self).__name__}{self.index}"
 | 
					        return f"{type(self).__name__}{self.index}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -340,23 +354,30 @@ _make_channelout_mixins = {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _make_effects_mixin(kind):
 | 
					def _make_effects_mixin(kind, is_phys):
 | 
				
			||||||
    """creates an effects mixin for a kind"""
 | 
					    """creates an effects mixin for a kind"""
 | 
				
			||||||
    XY_cls = type(
 | 
					
 | 
				
			||||||
        "XY",
 | 
					    def _make_xy_cls():
 | 
				
			||||||
        (),
 | 
					        pan = {param: float_prop(param) for param in ["pan_x", "pan_y"]}
 | 
				
			||||||
        {
 | 
					        color = {param: float_prop(param) for param in ["color_x", "color_y"]}
 | 
				
			||||||
            param: float_prop(param)
 | 
					        fx = {param: float_prop(param) for param in ["fx_x", "fx_y"]}
 | 
				
			||||||
            for param in [
 | 
					        if is_phys:
 | 
				
			||||||
                "pan_x",
 | 
					            return type(
 | 
				
			||||||
                "pan_y",
 | 
					                "XYPhys",
 | 
				
			||||||
                "color_x",
 | 
					                (),
 | 
				
			||||||
                "color_y",
 | 
					                {
 | 
				
			||||||
                "fx_x",
 | 
					                    **pan,
 | 
				
			||||||
                "fx_y",
 | 
					                    **color,
 | 
				
			||||||
            ]
 | 
					                    **fx,
 | 
				
			||||||
        },
 | 
					                },
 | 
				
			||||||
    )
 | 
					            )
 | 
				
			||||||
 | 
					        return type(
 | 
				
			||||||
 | 
					            "XYVirt",
 | 
				
			||||||
 | 
					            (),
 | 
				
			||||||
 | 
					            {**pan},
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    XY_cls = _make_xy_cls()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FX_cls = type(
 | 
					    FX_cls = type(
 | 
				
			||||||
        "FX",
 | 
					        "FX",
 | 
				
			||||||
@ -383,7 +404,8 @@ def _make_effects_mixin(kind):
 | 
				
			|||||||
    return type(f"Effects{kind}", (XY_cls,), {})
 | 
					    return type(f"Effects{kind}", (XY_cls,), {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_make_effects_mixins = {kind.name: _make_effects_mixin(kind) for kind in kinds_all}
 | 
					def _make_effects_mixins(is_phys):
 | 
				
			||||||
 | 
					    return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds_all}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]:
 | 
					def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]:
 | 
				
			||||||
@ -395,7 +417,9 @@ def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip
 | 
				
			|||||||
    Returns a physical or virtual strip subclass
 | 
					    Returns a physical or virtual strip subclass
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    STRIP_cls = (
 | 
					    STRIP_cls = (
 | 
				
			||||||
        PhysicalStrip.make(remote, i, remote.kind) if is_phys_strip else VirtualStrip
 | 
					        PhysicalStrip.make(remote, i, is_phys_strip)
 | 
				
			||||||
 | 
					        if is_phys_strip
 | 
				
			||||||
 | 
					        else VirtualStrip.make(remote, i, is_phys_strip)
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
 | 
					    CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user