From e3a8d3374e4426ce4f15907ddb6d62c222d73802 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Wed, 19 May 2021 14:22:38 +0200 Subject: [PATCH 1/5] EAX listener mod UI --- korman/properties/modifiers/region.py | 101 ++++++++++++++++++++++++++ korman/ui/modifiers/region.py | 28 +++++++ 2 files changed, 129 insertions(+) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index fda1bc4..312d46e 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -203,6 +203,107 @@ class PlasmaPanicLinkRegion(PlasmaModifierProperties): return True +reverb_flags = [("kDecayTimeScale", "Decay Time Scale", "Reverberation decay time"), + ("kReflectionsScale", "Reflections Scale", "Reflection level"), + ("kReflectionsDelayScale", "Reflections Delay Scale", "Initial reflection delay time"), + ("kReverbScale", "Reverb Scale", "Reverberation level"), + ("kReverbDelayScale", "Reverb Delay Scale", "Late reverberation delay time"), + ("kEchoTimeScale", "Echo Time Scale", "Echo time"), + ("kModulationTimeScale", "Modulation Time Scale", "Modulation time"), + ("kDecayHFLimit", "Decay HF Limit", "Limits high-frequency decay time according to air absorption")] + +class PlasmaReverbRegion(PlasmaModifierProperties): + pl_id = "reverb" + pl_depends = {"softvolume"} + + bl_category = "Region" + bl_label = "Sound Reverb Region" + bl_description = "Sound Reverberation (EAX) Region" + bl_icon = "IPO_ELASTIC" + + preset = EnumProperty(name="Environment Preset", + description="The type of audio environment to simulate", + items=[("generic", "Generic", "A generic-sounding environment with light reverberation"), + ("stoneroom", "Stone Room", ""), + ("custom", "Custom", "Your own environment")], + default="generic", + options=set()) + + # TODO - min/max/percentages + environment_size = FloatProperty(name="Environment Size", description="Environment Size", + default=7.5, min=1.0, max=100.0) + environment_diffusion = FloatProperty(name="Environment Diffusion", description="Environment Diffusion", + default=1.0, min=0.0, max=1.0) + room = IntProperty(name="Room", description="Room", + default=-1000, min=-10000, max=0) + room_hf = IntProperty(name="Room HF", description="Room High Frequency", + default=-100, min=-10000, max=0) + room_lf = IntProperty(name="Room LF", description="Room Low Frequency", + default=0, min=-10000, max=0) + decay_time = FloatProperty(name="Decay Time", description="Decay Time", + default=1.49, min=0.1, max=20.0) + decay_hf_ratio = FloatProperty(name="Decay HF Ratio", description="Decay High Frequency Ratio", + default=0.83, min=0.1, max=2.0) + decay_lf_ratio = FloatProperty(name="Decay LF Ratio", description="Decay Low Frequency Ratio", + default=1.0, min=0.1, max=2.0) + reflections = IntProperty(name="Reflections", description="Reflections", + default=-2602, min=-10000, max=1000) + reflections_delay = FloatProperty(name="Reflections Delay", description="Reflections Delay", + default=0.007, min=0.0, max=0.3) + reverb = IntProperty(name="Reverb", description="Reverb", + default=200, min=-10000, max=2000) + reverb_delay = FloatProperty(name="Reverb Delay", description="Reverb Delay", + default=0.011, min=0.0, max=0.3) + echo_time = FloatProperty(name="Echo Time", description="Echo Time", + default=0.25, min=0.1, max=0.5) + echo_depth = FloatProperty(name="Echo Depth", description="Echo Depth", + default=0.0, min=0.0, max=1.0) + modulation_time = FloatProperty(name="Modulation Time", description="Modulation Time", + default=0.25, min=0.1, max=5.0) + modulation_depth = FloatProperty(name="Modulation Depth", description="Modulation Depth", + default=0.0, min=0.0, max=1.0) + air_absorption_hf = FloatProperty(name="Air Absorption HF", description="Air Absorption High Frequency", + default=-5.0, min=-10.0, max=0.0) + hf_reference = FloatProperty(name="HF reference", description="High Frequency Reference", + default=5000.0, min=1000.0, max=20000.0) + lf_reference = FloatProperty(name="LF reference", description="Low Frequency Reference", + default=250.0, min=20.0, max=1000.0) + # room_rolloff_factor = FloatProperty(name="Room Rolloff Factor", description="Room Rolloff Factor", + # default=0.0, min=0.0, max=1.0) + + flags = EnumProperty(name="Flags", + description="Reverb flags", + items=reverb_flags, + default={ "kDecayTimeScale", "kReflectionsScale", "kReflectionsDelayScale", + "kReverbScale", "kReverbDelayScale", "kEchoTimeScale"}, + options={"ENUM_FLAG"}) + + def export(self, exporter, bo, so): + eax_listener = exporter.mgr.find_create_object(plEAXListenerMod, so=so) + # TODO - auto-set environment to 26 if using custom values. + """ + if self.preset == "generic": + camera_so_key = exporter.mgr.find_create_key(plSceneObject, bl=self.camera_object) + camera_props = self.camera_object.data.plasma_camera.settings + + # Setup physical stuff + phys_mod = bo.plasma_modifiers.collision + exporter.physics.generate_physical(bo, so, member_group="kGroupDetector", + report_groups=["kGroupAvatar"], + properties=["kPinned"]) + + # I don't feel evil enough to make this generate a logic tree... + msg = plCameraMsg() + msg.BCastFlags |= plMessage.kLocalPropagate | plMessage.kBCastByType + msg.setCmd(plCameraMsg.kRegionPushCamera) + msg.setCmd(plCameraMsg.kSetAsPrimary, camera_props.primary_camera) + msg.newCam = camera_so_key + + region = exporter.mgr.find_create_object(plCameraRegionDetector, so=so) + region.addMessage(msg) + """ + + class PlasmaSoftVolume(idprops.IDPropMixin, PlasmaModifierProperties): pl_id = "softvolume" diff --git a/korman/ui/modifiers/region.py b/korman/ui/modifiers/region.py index 52eb6e7..ad100c4 100644 --- a/korman/ui/modifiers/region.py +++ b/korman/ui/modifiers/region.py @@ -43,6 +43,34 @@ def paniclink(modifier, layout, context): layout.prop(phys_mod, "bounds") layout.prop(modifier, "play_anim") +def reverb(modifier, layout, context): + layout.prop(modifier, "preset") + if modifier.preset == "custom": + split = layout.split() + colA = split.column() + colB = split.column() + colA.prop(modifier, "environment_size") + colA.prop(modifier, "environment_diffusion") + colB.prop(modifier, "room") + colB.prop(modifier, "room_hf") + colB.prop(modifier, "room_lf") + colA.prop(modifier, "decay_time") + colA.prop(modifier, "decay_hf_ratio") + colA.prop(modifier, "decay_lf_ratio") + colB.prop(modifier, "reflections") + colB.prop(modifier, "reflections_delay") + colB.prop(modifier, "reverb") + colB.prop(modifier, "reverb_delay") + colA.prop(modifier, "echo_time") + colA.prop(modifier, "echo_depth") + colA.prop(modifier, "modulation_time") + colA.prop(modifier, "modulation_depth") + colA.prop(modifier, "air_absorption_hf") + colB.prop(modifier, "hf_reference") + colB.prop(modifier, "lf_reference") + # colB.prop(modifier, "room_rolloff_factor") + layout.prop(modifier, "flags") + def softvolume(modifier, layout, context): row = layout.row() row.prop(modifier, "use_nodes", text="", icon="NODETREE") From 5cde764ae68d04b6508e82ba324563cc8f515d0d Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Wed, 19 May 2021 20:43:05 +0200 Subject: [PATCH 2/5] EAX: finish UI, actually export --- korman/properties/modifiers/region.py | 204 +++++++++++++++++++++----- korman/ui/modifiers/region.py | 4 +- 2 files changed, 170 insertions(+), 38 deletions(-) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index 312d46e..dd4fa59 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -203,14 +203,14 @@ class PlasmaPanicLinkRegion(PlasmaModifierProperties): return True -reverb_flags = [("kDecayTimeScale", "Decay Time Scale", "Reverberation decay time"), - ("kReflectionsScale", "Reflections Scale", "Reflection level"), - ("kReflectionsDelayScale", "Reflections Delay Scale", "Initial reflection delay time"), - ("kReverbScale", "Reverb Scale", "Reverberation level"), - ("kReverbDelayScale", "Reverb Delay Scale", "Late reverberation delay time"), - ("kEchoTimeScale", "Echo Time Scale", "Echo time"), - ("kModulationTimeScale", "Modulation Time Scale", "Modulation time"), - ("kDecayHFLimit", "Decay HF Limit", "Limits high-frequency decay time according to air absorption")] +reverb_flags = [("kFlagDecayTimeScale", "Decay Time Scale", "Reverberation decay time"), + ("kFlagReflectionsScale", "Reflections Scale", "Reflection level"), + ("kFlagReflectionsDelayScale", "Reflections Delay Scale", "Initial reflection delay time"), + ("kFlagReverbScale", "Reverb Scale", "Reverberation level"), + ("kFlagReverbDelayScale", "Reverb Delay Scale", "Late reverberation delay time"), + ("kFlagEchoTimeScale", "Echo Time Scale", "Echo time"), + ("kFlagModulationTimeScale", "Modulation Time Scale", "Modulation time"), + ("kFlagDecayHFLimit", "Decay HF Limit", "Limit unnaturally long decay times of high-frequency sounds by forcing a limit to the decay time to be calculated from the Air Absorption HF value")] class PlasmaReverbRegion(PlasmaModifierProperties): pl_id = "reverb" @@ -223,13 +223,130 @@ class PlasmaReverbRegion(PlasmaModifierProperties): preset = EnumProperty(name="Environment Preset", description="The type of audio environment to simulate", - items=[("generic", "Generic", "A generic-sounding environment with light reverberation"), - ("stoneroom", "Stone Room", ""), - ("custom", "Custom", "Your own environment")], - default="generic", + items=[("GENERIC", "Generic", "A generic-sounding environment with light reverberation"), + ("PADDEDCELL", "Padded cell", ""), + ("ROOM", "Room", ""), + ("BATHROOM", "Bathroom", ""), + ("LIVINGROOM", "Living room", ""), + ("STONEROOM", "Stone room", ""), + ("AUDITORIUM", "Auditorium", ""), + ("CONCERTHALL", "Concert Hall", ""), + ("CAVE", "Cave", ""), + ("ARENA", "Arena", ""), + ("HANGAR", "Hangar", ""), + ("CARPETTEDHALLWAY", "Carpetted hallway", ""), + ("HALLWAY", "Hallway", ""), + ("STONECORRIDOR", "Stone corridor", ""), + ("ALLEY", "Alley", ""), + ("FOREST", "Forest", ""), + ("CITY", "City", ""), + ("MOUNTAINS", "Mountains", ""), + ("QUARRY", "Quarry", ""), + ("PLAIN", "Plain", ""), + ("PARKINGLOT", "Parking lot", ""), + ("SEWERPIPE", "Sewer pipe", ""), + ("UNDERWATER", "Underwater", ""), + ("DRUGGED", "Drugged", ""), + ("DIZZY", "Drizzy", ""), + ("PSYCHOTIC", "Psychotic", ""), + ("MORE", "More choices...", ""), + ("CUSTOM", "Custom", "Setup your own environment")], + default="GENERIC", + options=set()) + + # Thikk list for annoying users. + preset_more = EnumProperty(name="More Environment Preset", + description="Some more environment presets for your convenience", + items=[("CASTLE_SMALLROOM", "Castle - Small room", ""), + ("CASTLE_SHORTPASSAGE", "Castle - Short passage", ""), + ("CASTLE_MEDIUMROOM", "Castle - Medium room", ""), + ("CASTLE_LONGPASSAGE", "Castle - Long passage", ""), + ("CASTLE_LARGEROOM", "Castle - Large room", ""), + ("CASTLE_HALL", "Castle - Hall", ""), + ("CASTLE_CUPBOARD", "Castle - Cupboard", ""), + ("CASTLE_COURTYARD", "Castle - Courtyard", ""), + ("CASTLE_ALCOVE", "Castle - Alcove", ""), + ("FACTORY_ALCOVE", "Factory - Alcove", ""), + ("FACTORY_SHORTPASSAGE", "Factory - Short passage", ""), + ("FACTORY_MEDIUMROOM", "Factory - Medium room", ""), + ("FACTORY_LONGPASSAGE", "Factory - Long passage", ""), + ("FACTORY_LARGEROOM", "Factory - Large room", ""), + ("FACTORY_HALL", "Factory - Hall", ""), + ("FACTORY_CUPBOARD", "Factory - Cupboard", ""), + ("FACTORY_COURTYARD", "Factory - Courtyard", ""), + ("FACTORY_SMALLROOM", "Factory - Small room", ""), + ("ICEPALACE_ALCOVE", "Ice palace - Alcove", ""), + ("ICEPALACE_SHORTPASSAGE", "Ice palace - Short passage", ""), + ("ICEPALACE_MEDIUMROOM", "Ice palace - Medium room", ""), + ("ICEPALACE_LONGPASSAGE", "Ice palace - Long passage", ""), + ("ICEPALACE_LARGEROOM", "Ice palace - Large room", ""), + ("ICEPALACE_HALL", "Ice palace - Hall", ""), + ("ICEPALACE_CUPBOARD", "Ice palace - Cupboard", ""), + ("ICEPALACE_COURTYARD", "Ice palace - Courtyard", ""), + ("ICEPALACE_SMALLROOM", "Ice palace - Small room", ""), + ("SPACESTATION_ALCOVE", "Space station - Alcove", ""), + ("SPACESTATION_MEDIUMROOM", "Space station - Medium room", ""), + ("SPACESTATION_SHORTPASSAGE", "Space station - Short passage", ""), + ("SPACESTATION_LONGPASSAGE", "Space station - Long passage", ""), + ("SPACESTATION_LARGEROOM", "Space station - Large room", ""), + ("SPACESTATION_HALL", "Space station - Hall", ""), + ("SPACESTATION_CUPBOARD", "Space station - Cupboard", ""), + ("SPACESTATION_SMALLROOM", "Space station - Small room", ""), + ("WOODEN_ALCOVE", "Wooden alcove", ""), + ("WOODEN_SHORTPASSAGE", "Wooden short passage", ""), + ("WOODEN_MEDIUMROOM", "Wooden medium room", ""), + ("WOODEN_LONGPASSAGE", "Wooden long passage", ""), + ("WOODEN_LARGEROOM", "Wooden large room", ""), + ("WOODEN_HALL", "Wooden hall", ""), + ("WOODEN_CUPBOARD", "Wooden cupboard", ""), + ("WOODEN_SMALLROOM", "Wooden small room", ""), + ("WOODEN_COURTYARD", "Wooden courtyard", ""), + ("SPORT_EMPTYSTADIUM", "Sport - Empty stadium", ""), + ("SPORT_SQUASHCOURT", "Sport - Squash court", ""), + ("SPORT_SMALLSWIMMINGPOOL", "Sport - Small swimming pool", ""), + ("SPORT_LARGESWIMMINGPOOL", "Sport - Large swimming pool", ""), + ("SPORT_GYMNASIUM", "Sport - Gymnasium", ""), + ("SPORT_FULLSTADIUM", "Sport - Full stadium", ""), + ("SPORT_STADIUMTANNOY", "Sport - Stadium tannoy", ""), + ("PREFAB_WORKSHOP", "Prefab - Workshop", ""), + ("PREFAB_SCHOOLROOM", "Prefab - Schoolroom", ""), + ("PREFAB_PRACTISEROOM", "Prefab - Practise room", ""), + ("PREFAB_OUTHOUSE", "Prefab - Outhouse", ""), + ("PREFAB_CARAVAN", "Prefab - Zandi's Trailer", ""), + ("DOME_TOMB", "Tomb dome", ""), + ("DOME_SAINTPAULS", "St Paul's Dome", ""), + ("PIPE_SMALL", "Pipe - small", ""), + ("PIPE_LONGTHIN", "Pipe - long & thin", ""), + ("PIPE_LARGE", "Pipe - large", ""), + ("PIPE_RESONANT", "Pipe - resonant", ""), + ("OUTDOORS_BACKYARD", "Outdoors - Backyard", ""), + ("OUTDOORS_ROLLINGPLAINS", "Outdoors - Rolling plains", ""), + ("OUTDOORS_DEEPCANYON", "Outdoors - Deep canyon", ""), + ("OUTDOORS_CREEK", "Outdoors - Creek", ""), + ("OUTDOORS_VALLEY", "Outdoors - Valley", ""), + ("MOOD_HEAVEN", "Mood - Heaven", ""), + ("MOOD_HELL", "Mood - Hell", ""), + ("MOOD_MEMORY", "Mood - Memory", ""), + ("DRIVING_COMMENTATOR", "Driving - Commentator", ""), + ("DRIVING_PITGARAGE", "Driving - In pit garage", ""), + ("DRIVING_INCAR_RACER", "Driving - In racer car", ""), + ("DRIVING_INCAR_SPORTS", "Driving - In sports car", ""), + ("DRIVING_INCAR_LUXURY", "Driving - In luxury car", ""), + ("DRIVING_FULLGRANDSTAND", "Driving - Full grand stand", ""), + ("DRIVING_EMPTYGRANDSTAND", "Driving - Empty grand stand", ""), + ("DRIVING_TUNNEL", "Driving - Tunnel", ""), + ("CITY_STREETS", "City - Streets", ""), + ("CITY_SUBWAY", "City - Subway", ""), + ("CITY_MUSEUM", "City - Museum", ""), + ("CITY_LIBRARY", "City - Library", ""), + ("CITY_UNDERPASS", "City - Underpass", ""), + ("CITY_ABANDONED", "City - Abandoned", ""), + ("DUSTYROOM", "Dusty room", ""), + ("CHAPEL", "Chapel", ""), + ("SMALLWATERROOM", "Small water room", "")], + default="OUTDOORS_ROLLINGPLAINS", options=set()) - # TODO - min/max/percentages environment_size = FloatProperty(name="Environment Size", description="Environment Size", default=7.5, min=1.0, max=100.0) environment_diffusion = FloatProperty(name="Environment Diffusion", description="Environment Diffusion", @@ -268,40 +385,53 @@ class PlasmaReverbRegion(PlasmaModifierProperties): default=5000.0, min=1000.0, max=20000.0) lf_reference = FloatProperty(name="LF reference", description="Low Frequency Reference", default=250.0, min=20.0, max=1000.0) + + # Room rolloff - always at 0 in all presets, so screw it. # room_rolloff_factor = FloatProperty(name="Room Rolloff Factor", description="Room Rolloff Factor", # default=0.0, min=0.0, max=1.0) flags = EnumProperty(name="Flags", description="Reverb flags", items=reverb_flags, - default={ "kDecayTimeScale", "kReflectionsScale", "kReflectionsDelayScale", - "kReverbScale", "kReverbDelayScale", "kEchoTimeScale"}, + default={ "kFlagDecayTimeScale", "kFlagReflectionsScale", "kFlagReflectionsDelayScale", + "kFlagReverbScale", "kFlagReverbDelayScale", "kFlagEchoTimeScale" }, options={"ENUM_FLAG"}) def export(self, exporter, bo, so): eax_listener = exporter.mgr.find_create_object(plEAXListenerMod, so=so) - # TODO - auto-set environment to 26 if using custom values. - """ - if self.preset == "generic": - camera_so_key = exporter.mgr.find_create_key(plSceneObject, bl=self.camera_object) - camera_props = self.camera_object.data.plasma_camera.settings - - # Setup physical stuff - phys_mod = bo.plasma_modifiers.collision - exporter.physics.generate_physical(bo, so, member_group="kGroupDetector", - report_groups=["kGroupAvatar"], - properties=["kPinned"]) - - # I don't feel evil enough to make this generate a logic tree... - msg = plCameraMsg() - msg.BCastFlags |= plMessage.kLocalPropagate | plMessage.kBCastByType - msg.setCmd(plCameraMsg.kRegionPushCamera) - msg.setCmd(plCameraMsg.kSetAsPrimary, camera_props.primary_camera) - msg.newCam = camera_so_key - - region = exporter.mgr.find_create_object(plCameraRegionDetector, so=so) - region.addMessage(msg) - """ + eax_listener.softRegion = bo.plasma_modifiers.softvolume.get_key(exporter, so) + if self.preset == "CUSTOM": + # Someone's feeling exceedingly confident today... + props = EaxReverbProperties() + props.environment = 26 + props.environmentSize = self.environment_size + props.environmentDiffusion = self.environment_diffusion + props.room = self.room + props.roomHF = self.room_hf + props.roomLF = self.room_lf + props.decayTime = self.decay_time + props.decayHFRatio = self.decay_hf_ratio + props.decayLFRatio = self.decay_lf_ratio + props.reflections = self.reflections + props.reflectionsDelay = self.reflections_delay + props.reverb = self.reverb + props.reverbDelay = self.reverb_delay + props.echoTime = self.echo_time + props.echoDepth = self.echo_depth + props.modulationTime = self.modulation_time + props.modulationDepth = self.modulation_depth + props.airAbsorptionHF = self.air_absorption_hf + props.hfReference = self.hf_reference + props.lfReference = self.lf_reference + flags = 0 + for flag in self.flags: + flags |= getattr(EaxReverbProperties, flag) + props.flags = flags + eax_listener.listenerProps = props + elif self.preset == "MORE": + eax_listener.listenerProps = getattr(EaxReverbProperties, "REVERB_PRESET_" + self.preset_more) + else: + eax_listener.listenerProps = getattr(EaxReverbProperties, "REVERB_PRESET_" + self.preset) class PlasmaSoftVolume(idprops.IDPropMixin, PlasmaModifierProperties): diff --git a/korman/ui/modifiers/region.py b/korman/ui/modifiers/region.py index ad100c4..72a9360 100644 --- a/korman/ui/modifiers/region.py +++ b/korman/ui/modifiers/region.py @@ -45,7 +45,9 @@ def paniclink(modifier, layout, context): def reverb(modifier, layout, context): layout.prop(modifier, "preset") - if modifier.preset == "custom": + if modifier.preset == "MORE": + layout.prop(modifier, "preset_more") + elif modifier.preset == "CUSTOM": split = layout.split() colA = split.column() colB = split.column() From 63526834f0fabb944c94a4a9c77704022f4ae9b4 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Sun, 30 May 2021 19:19:41 +0200 Subject: [PATCH 3/5] Add reverb option to sound emitters. Rename EAXReverbProperties. --- korman/properties/modifiers/region.py | 10 +++++----- korman/properties/modifiers/sound.py | 25 +++++++++++++++++++++++++ korman/ui/modifiers/sound.py | 8 ++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index dd4fa59..73eb95c 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -402,7 +402,7 @@ class PlasmaReverbRegion(PlasmaModifierProperties): eax_listener.softRegion = bo.plasma_modifiers.softvolume.get_key(exporter, so) if self.preset == "CUSTOM": # Someone's feeling exceedingly confident today... - props = EaxReverbProperties() + props = EAXReverbProperties() props.environment = 26 props.environmentSize = self.environment_size props.environmentDiffusion = self.environment_diffusion @@ -425,13 +425,13 @@ class PlasmaReverbRegion(PlasmaModifierProperties): props.lfReference = self.lf_reference flags = 0 for flag in self.flags: - flags |= getattr(EaxReverbProperties, flag) + flags |= getattr(EAXReverbProperties, flag) props.flags = flags eax_listener.listenerProps = props elif self.preset == "MORE": - eax_listener.listenerProps = getattr(EaxReverbProperties, "REVERB_PRESET_" + self.preset_more) + eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset_more) else: - eax_listener.listenerProps = getattr(EaxReverbProperties, "REVERB_PRESET_" + self.preset) + eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset) class PlasmaSoftVolume(idprops.IDPropMixin, PlasmaModifierProperties): @@ -562,7 +562,7 @@ class PlasmaSubworldRegion(PlasmaModifierProperties): def export(self, exporter, bo, so): # Due to the fact that our subworld modifier can produce both RidingAnimatedPhysical - # and [HK|PX]Subworlds depending on the situation, this could get hairy, fast. + # and [HK|PX]Subworlds depending on the situation, this could get hairy, fast. # Start by surveying the lay of the land. from_sub, to_sub = bo.plasma_object.subworld, self.subworld from_isded = exporter.physics.is_dedicated_subworld(from_sub) diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index 71b37fd..c933b7a 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -152,6 +152,16 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): options={"ANIMATABLE"}, subtype="PERCENTAGE") + use_reverb = BoolProperty(name="Reverberation", + description="Allow the sound to be affected by reverberation regions", + default=False, + options=set()) + reverb_amount = IntProperty(name="Reverb amount", + description="Amount of reverb to apply to this sound (at 0, reverb volume reduced by 100 dB)", + min=0, max=100, default=100, + options=set(), + subtype="PERCENTAGE") + fade_in = PointerProperty(type=PlasmaSfxFade, options=set()) fade_out = PointerProperty(type=PlasmaSfxFade, options=set()) @@ -290,6 +300,21 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): else: sound.channel = plWin32Sound.kRightChannel + # Reverb/EAX + if self.use_reverb: + eax = sound.eaxSettings + eax.enable = True + # Occlusion: the minimum is -100 dB (but the value is multiplied by 100 in EAX's API) + eax.room = int(-10000 * (1 - (self.reverb_amount / 100.0))) + + # I couldn't get doppler effect working ingame, nor could I figure out how soft + # starts/ends are supposed to work in conjunction with the soft region. + # If you have more infos about those, feel free to share. + + # Make sure we use sensible defaults for soft starts/ends + eax.softStarts.reset() + eax.softEnds.reset() + # Whew, that was a lot of work! return sound.key diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index f80fae6..50cd0ed 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -101,3 +101,11 @@ def soundemit(modifier, layout, context): col.separator() col.label("Soft Region:") col.prop(sound, "sfx_region", text="") + + layout.separator() + split = layout.split() + col = split.column() + col.prop(sound, "use_reverb") + if sound.use_reverb: + col = split.column() + col.prop(sound, "reverb_amount", text="Reverb Amount") From 5bee3e8c0b3baa08e45c8dfff335e44452162273 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Mon, 31 May 2021 21:00:48 +0200 Subject: [PATCH 4/5] Implement review suggestions: - Prevent animating EAX region properties - Automatically enable/disable EAX - Better flag assignment Co-authored-by: Adam Johnson <AdamJohnso@gmail.com> --- korman/properties/modifiers/region.py | 63 +++++++++++++++++---------- korman/properties/modifiers/sound.py | 8 +--- korman/ui/modifiers/sound.py | 12 ++--- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index 73eb95c..1cc9f06 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -254,7 +254,7 @@ class PlasmaReverbRegion(PlasmaModifierProperties): default="GENERIC", options=set()) - # Thikk list for annoying users. + # Thicc list for annoying users. preset_more = EnumProperty(name="More Environment Preset", description="Some more environment presets for your convenience", items=[("CASTLE_SMALLROOM", "Castle - Small room", ""), @@ -348,43 +348,62 @@ class PlasmaReverbRegion(PlasmaModifierProperties): options=set()) environment_size = FloatProperty(name="Environment Size", description="Environment Size", - default=7.5, min=1.0, max=100.0) + default=7.5, min=1.0, max=100.0, + options=set()) environment_diffusion = FloatProperty(name="Environment Diffusion", description="Environment Diffusion", - default=1.0, min=0.0, max=1.0) + default=1.0, min=0.0, max=1.0, + options=set()) room = IntProperty(name="Room", description="Room", - default=-1000, min=-10000, max=0) + default=-1000, min=-10000, max=0, + options=set()) room_hf = IntProperty(name="Room HF", description="Room High Frequency", - default=-100, min=-10000, max=0) + default=-100, min=-10000, max=0, + options=set()) room_lf = IntProperty(name="Room LF", description="Room Low Frequency", - default=0, min=-10000, max=0) + default=0, min=-10000, max=0, + options=set()) decay_time = FloatProperty(name="Decay Time", description="Decay Time", - default=1.49, min=0.1, max=20.0) + default=1.49, min=0.1, max=20.0, + options=set()) decay_hf_ratio = FloatProperty(name="Decay HF Ratio", description="Decay High Frequency Ratio", - default=0.83, min=0.1, max=2.0) + default=0.83, min=0.1, max=2.0, + options=set()) decay_lf_ratio = FloatProperty(name="Decay LF Ratio", description="Decay Low Frequency Ratio", - default=1.0, min=0.1, max=2.0) + default=1.0, min=0.1, max=2.0, + options=set()) reflections = IntProperty(name="Reflections", description="Reflections", - default=-2602, min=-10000, max=1000) + default=-2602, min=-10000, max=1000, + options=set()) reflections_delay = FloatProperty(name="Reflections Delay", description="Reflections Delay", - default=0.007, min=0.0, max=0.3) + default=0.007, min=0.0, max=0.3, + options=set()) reverb = IntProperty(name="Reverb", description="Reverb", - default=200, min=-10000, max=2000) + default=200, min=-10000, max=2000, + options=set()) reverb_delay = FloatProperty(name="Reverb Delay", description="Reverb Delay", - default=0.011, min=0.0, max=0.3) + default=0.011, min=0.0, max=0.3, + options=set()) echo_time = FloatProperty(name="Echo Time", description="Echo Time", - default=0.25, min=0.1, max=0.5) + default=0.25, min=0.1, max=0.5, + options=set()) echo_depth = FloatProperty(name="Echo Depth", description="Echo Depth", - default=0.0, min=0.0, max=1.0) + default=0.0, min=0.0, max=1.0, + options=set()) modulation_time = FloatProperty(name="Modulation Time", description="Modulation Time", - default=0.25, min=0.1, max=5.0) + default=0.25, min=0.1, max=5.0, + options=set()) modulation_depth = FloatProperty(name="Modulation Depth", description="Modulation Depth", - default=0.0, min=0.0, max=1.0) + default=0.0, min=0.0, max=1.0, + options=set()) air_absorption_hf = FloatProperty(name="Air Absorption HF", description="Air Absorption High Frequency", - default=-5.0, min=-10.0, max=0.0) + default=-5.0, min=-10.0, max=0.0, + options=set()) hf_reference = FloatProperty(name="HF reference", description="High Frequency Reference", - default=5000.0, min=1000.0, max=20000.0) + default=5000.0, min=1000.0, max=20000.0, + options=set()) lf_reference = FloatProperty(name="LF reference", description="Low Frequency Reference", - default=250.0, min=20.0, max=1000.0) + default=250.0, min=20.0, max=1000.0, + options=set()) # Room rolloff - always at 0 in all presets, so screw it. # room_rolloff_factor = FloatProperty(name="Room Rolloff Factor", description="Room Rolloff Factor", @@ -423,10 +442,8 @@ class PlasmaReverbRegion(PlasmaModifierProperties): props.airAbsorptionHF = self.air_absorption_hf props.hfReference = self.hf_reference props.lfReference = self.lf_reference - flags = 0 for flag in self.flags: - flags |= getattr(EAXReverbProperties, flag) - props.flags = flags + props.flags |= getattr(EAXReverbProperties, flag) eax_listener.listenerProps = props elif self.preset == "MORE": eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset_more) diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index c933b7a..ff99fd7 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -152,12 +152,8 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): options={"ANIMATABLE"}, subtype="PERCENTAGE") - use_reverb = BoolProperty(name="Reverberation", - description="Allow the sound to be affected by reverberation regions", - default=False, - options=set()) reverb_amount = IntProperty(name="Reverb amount", - description="Amount of reverb to apply to this sound (at 0, reverb volume reduced by 100 dB)", + description="Amount of reverb to apply to this sound (at 0%, reverb volume is reduced by 100 dB and thus disabled)", min=0, max=100, default=100, options=set(), subtype="PERCENTAGE") @@ -301,7 +297,7 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): sound.channel = plWin32Sound.kRightChannel # Reverb/EAX - if self.use_reverb: + if self.sfx_type in ("kSoundFX", "kNPCVoices") and self.reverb_amount > 0: eax = sound.eaxSettings eax.enable = True # Occlusion: the minimum is -100 dB (but the value is multiplied by 100 in EAX's API) diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index 50cd0ed..e2569bb 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -83,6 +83,10 @@ def soundemit(modifier, layout, context): col.separator() _draw_fade_ui(sound.fade_out, col, "Fade Out:") + if sound.sfx_type in ("kSoundFX", "kNPCVoices"): + col.separator() + col.prop(sound, "reverb_amount", text="Reverb Amount") + col = split.column() col.label("Cone Effect:") col.prop(sound, "inner_cone") @@ -101,11 +105,3 @@ def soundemit(modifier, layout, context): col.separator() col.label("Soft Region:") col.prop(sound, "sfx_region", text="") - - layout.separator() - split = layout.split() - col = split.column() - col.prop(sound, "use_reverb") - if sound.use_reverb: - col = split.column() - col.prop(sound, "reverb_amount", text="Reverb Amount") From 23d0aeb363ce1171652ccf402f653d14cd2a0837 Mon Sep 17 00:00:00 2001 From: Jrius <2261279+Jrius@users.noreply.github.com> Date: Sun, 1 Aug 2021 12:40:01 +0200 Subject: [PATCH 5/5] Implement suggestions: - syntax improvements - merge both EAX presets lists into one Co-authored-by: Adam Johnson <AdamJohnso@gmail.com> --- korman/properties/modifiers/region.py | 193 ++++++++++++-------------- korman/properties/modifiers/sound.py | 2 +- korman/ui/modifiers/sound.py | 2 +- 3 files changed, 92 insertions(+), 105 deletions(-) diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index 1cc9f06..c51db96 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -249,104 +249,97 @@ class PlasmaReverbRegion(PlasmaModifierProperties): ("DRUGGED", "Drugged", ""), ("DIZZY", "Drizzy", ""), ("PSYCHOTIC", "Psychotic", ""), - ("MORE", "More choices...", ""), + ("CASTLE_SMALLROOM", "Castle - Small room", ""), + ("CASTLE_SHORTPASSAGE", "Castle - Short passage", ""), + ("CASTLE_MEDIUMROOM", "Castle - Medium room", ""), + ("CASTLE_LONGPASSAGE", "Castle - Long passage", ""), + ("CASTLE_LARGEROOM", "Castle - Large room", ""), + ("CASTLE_HALL", "Castle - Hall", ""), + ("CASTLE_CUPBOARD", "Castle - Cupboard", ""), + ("CASTLE_COURTYARD", "Castle - Courtyard", ""), + ("CASTLE_ALCOVE", "Castle - Alcove", ""), + ("FACTORY_ALCOVE", "Factory - Alcove", ""), + ("FACTORY_SHORTPASSAGE", "Factory - Short passage", ""), + ("FACTORY_MEDIUMROOM", "Factory - Medium room", ""), + ("FACTORY_LONGPASSAGE", "Factory - Long passage", ""), + ("FACTORY_LARGEROOM", "Factory - Large room", ""), + ("FACTORY_HALL", "Factory - Hall", ""), + ("FACTORY_CUPBOARD", "Factory - Cupboard", ""), + ("FACTORY_COURTYARD", "Factory - Courtyard", ""), + ("FACTORY_SMALLROOM", "Factory - Small room", ""), + ("ICEPALACE_ALCOVE", "Ice palace - Alcove", ""), + ("ICEPALACE_SHORTPASSAGE", "Ice palace - Short passage", ""), + ("ICEPALACE_MEDIUMROOM", "Ice palace - Medium room", ""), + ("ICEPALACE_LONGPASSAGE", "Ice palace - Long passage", ""), + ("ICEPALACE_LARGEROOM", "Ice palace - Large room", ""), + ("ICEPALACE_HALL", "Ice palace - Hall", ""), + ("ICEPALACE_CUPBOARD", "Ice palace - Cupboard", ""), + ("ICEPALACE_COURTYARD", "Ice palace - Courtyard", ""), + ("ICEPALACE_SMALLROOM", "Ice palace - Small room", ""), + ("SPACESTATION_ALCOVE", "Space station - Alcove", ""), + ("SPACESTATION_MEDIUMROOM", "Space station - Medium room", ""), + ("SPACESTATION_SHORTPASSAGE", "Space station - Short passage", ""), + ("SPACESTATION_LONGPASSAGE", "Space station - Long passage", ""), + ("SPACESTATION_LARGEROOM", "Space station - Large room", ""), + ("SPACESTATION_HALL", "Space station - Hall", ""), + ("SPACESTATION_CUPBOARD", "Space station - Cupboard", ""), + ("SPACESTATION_SMALLROOM", "Space station - Small room", ""), + ("WOODEN_ALCOVE", "Wooden alcove", ""), + ("WOODEN_SHORTPASSAGE", "Wooden short passage", ""), + ("WOODEN_MEDIUMROOM", "Wooden medium room", ""), + ("WOODEN_LONGPASSAGE", "Wooden long passage", ""), + ("WOODEN_LARGEROOM", "Wooden large room", ""), + ("WOODEN_HALL", "Wooden hall", ""), + ("WOODEN_CUPBOARD", "Wooden cupboard", ""), + ("WOODEN_SMALLROOM", "Wooden small room", ""), + ("WOODEN_COURTYARD", "Wooden courtyard", ""), + ("SPORT_EMPTYSTADIUM", "Sport - Empty stadium", ""), + ("SPORT_SQUASHCOURT", "Sport - Squash court", ""), + ("SPORT_SMALLSWIMMINGPOOL", "Sport - Small swimming pool", ""), + ("SPORT_LARGESWIMMINGPOOL", "Sport - Large swimming pool", ""), + ("SPORT_GYMNASIUM", "Sport - Gymnasium", ""), + ("SPORT_FULLSTADIUM", "Sport - Full stadium", ""), + ("SPORT_STADIUMTANNOY", "Sport - Stadium tannoy", ""), + ("PREFAB_WORKSHOP", "Prefab - Workshop", ""), + ("PREFAB_SCHOOLROOM", "Prefab - Schoolroom", ""), + ("PREFAB_PRACTISEROOM", "Prefab - Practise room", ""), + ("PREFAB_OUTHOUSE", "Prefab - Outhouse", ""), + ("PREFAB_CARAVAN", "Prefab - Zandi's Trailer", ""), + ("DOME_TOMB", "Tomb dome", ""), + ("DOME_SAINTPAULS", "St Paul's Dome", ""), + ("PIPE_SMALL", "Pipe - small", ""), + ("PIPE_LONGTHIN", "Pipe - long & thin", ""), + ("PIPE_LARGE", "Pipe - large", ""), + ("PIPE_RESONANT", "Pipe - resonant", ""), + ("OUTDOORS_BACKYARD", "Outdoors - Backyard", ""), + ("OUTDOORS_ROLLINGPLAINS", "Outdoors - Rolling plains", ""), + ("OUTDOORS_DEEPCANYON", "Outdoors - Deep canyon", ""), + ("OUTDOORS_CREEK", "Outdoors - Creek", ""), + ("OUTDOORS_VALLEY", "Outdoors - Valley", ""), + ("MOOD_HEAVEN", "Mood - Heaven", ""), + ("MOOD_HELL", "Mood - Hell", ""), + ("MOOD_MEMORY", "Mood - Memory", ""), + ("DRIVING_COMMENTATOR", "Driving - Commentator", ""), + ("DRIVING_PITGARAGE", "Driving - In pit garage", ""), + ("DRIVING_INCAR_RACER", "Driving - In racer car", ""), + ("DRIVING_INCAR_SPORTS", "Driving - In sports car", ""), + ("DRIVING_INCAR_LUXURY", "Driving - In luxury car", ""), + ("DRIVING_FULLGRANDSTAND", "Driving - Full grand stand", ""), + ("DRIVING_EMPTYGRANDSTAND", "Driving - Empty grand stand", ""), + ("DRIVING_TUNNEL", "Driving - Tunnel", ""), + ("CITY_STREETS", "City - Streets", ""), + ("CITY_SUBWAY", "City - Subway", ""), + ("CITY_MUSEUM", "City - Museum", ""), + ("CITY_LIBRARY", "City - Library", ""), + ("CITY_UNDERPASS", "City - Underpass", ""), + ("CITY_ABANDONED", "City - Abandoned", ""), + ("DUSTYROOM", "Dusty room", ""), + ("CHAPEL", "Chapel", ""), + ("SMALLWATERROOM", "Small water room", ""), ("CUSTOM", "Custom", "Setup your own environment")], default="GENERIC", options=set()) - # Thicc list for annoying users. - preset_more = EnumProperty(name="More Environment Preset", - description="Some more environment presets for your convenience", - items=[("CASTLE_SMALLROOM", "Castle - Small room", ""), - ("CASTLE_SHORTPASSAGE", "Castle - Short passage", ""), - ("CASTLE_MEDIUMROOM", "Castle - Medium room", ""), - ("CASTLE_LONGPASSAGE", "Castle - Long passage", ""), - ("CASTLE_LARGEROOM", "Castle - Large room", ""), - ("CASTLE_HALL", "Castle - Hall", ""), - ("CASTLE_CUPBOARD", "Castle - Cupboard", ""), - ("CASTLE_COURTYARD", "Castle - Courtyard", ""), - ("CASTLE_ALCOVE", "Castle - Alcove", ""), - ("FACTORY_ALCOVE", "Factory - Alcove", ""), - ("FACTORY_SHORTPASSAGE", "Factory - Short passage", ""), - ("FACTORY_MEDIUMROOM", "Factory - Medium room", ""), - ("FACTORY_LONGPASSAGE", "Factory - Long passage", ""), - ("FACTORY_LARGEROOM", "Factory - Large room", ""), - ("FACTORY_HALL", "Factory - Hall", ""), - ("FACTORY_CUPBOARD", "Factory - Cupboard", ""), - ("FACTORY_COURTYARD", "Factory - Courtyard", ""), - ("FACTORY_SMALLROOM", "Factory - Small room", ""), - ("ICEPALACE_ALCOVE", "Ice palace - Alcove", ""), - ("ICEPALACE_SHORTPASSAGE", "Ice palace - Short passage", ""), - ("ICEPALACE_MEDIUMROOM", "Ice palace - Medium room", ""), - ("ICEPALACE_LONGPASSAGE", "Ice palace - Long passage", ""), - ("ICEPALACE_LARGEROOM", "Ice palace - Large room", ""), - ("ICEPALACE_HALL", "Ice palace - Hall", ""), - ("ICEPALACE_CUPBOARD", "Ice palace - Cupboard", ""), - ("ICEPALACE_COURTYARD", "Ice palace - Courtyard", ""), - ("ICEPALACE_SMALLROOM", "Ice palace - Small room", ""), - ("SPACESTATION_ALCOVE", "Space station - Alcove", ""), - ("SPACESTATION_MEDIUMROOM", "Space station - Medium room", ""), - ("SPACESTATION_SHORTPASSAGE", "Space station - Short passage", ""), - ("SPACESTATION_LONGPASSAGE", "Space station - Long passage", ""), - ("SPACESTATION_LARGEROOM", "Space station - Large room", ""), - ("SPACESTATION_HALL", "Space station - Hall", ""), - ("SPACESTATION_CUPBOARD", "Space station - Cupboard", ""), - ("SPACESTATION_SMALLROOM", "Space station - Small room", ""), - ("WOODEN_ALCOVE", "Wooden alcove", ""), - ("WOODEN_SHORTPASSAGE", "Wooden short passage", ""), - ("WOODEN_MEDIUMROOM", "Wooden medium room", ""), - ("WOODEN_LONGPASSAGE", "Wooden long passage", ""), - ("WOODEN_LARGEROOM", "Wooden large room", ""), - ("WOODEN_HALL", "Wooden hall", ""), - ("WOODEN_CUPBOARD", "Wooden cupboard", ""), - ("WOODEN_SMALLROOM", "Wooden small room", ""), - ("WOODEN_COURTYARD", "Wooden courtyard", ""), - ("SPORT_EMPTYSTADIUM", "Sport - Empty stadium", ""), - ("SPORT_SQUASHCOURT", "Sport - Squash court", ""), - ("SPORT_SMALLSWIMMINGPOOL", "Sport - Small swimming pool", ""), - ("SPORT_LARGESWIMMINGPOOL", "Sport - Large swimming pool", ""), - ("SPORT_GYMNASIUM", "Sport - Gymnasium", ""), - ("SPORT_FULLSTADIUM", "Sport - Full stadium", ""), - ("SPORT_STADIUMTANNOY", "Sport - Stadium tannoy", ""), - ("PREFAB_WORKSHOP", "Prefab - Workshop", ""), - ("PREFAB_SCHOOLROOM", "Prefab - Schoolroom", ""), - ("PREFAB_PRACTISEROOM", "Prefab - Practise room", ""), - ("PREFAB_OUTHOUSE", "Prefab - Outhouse", ""), - ("PREFAB_CARAVAN", "Prefab - Zandi's Trailer", ""), - ("DOME_TOMB", "Tomb dome", ""), - ("DOME_SAINTPAULS", "St Paul's Dome", ""), - ("PIPE_SMALL", "Pipe - small", ""), - ("PIPE_LONGTHIN", "Pipe - long & thin", ""), - ("PIPE_LARGE", "Pipe - large", ""), - ("PIPE_RESONANT", "Pipe - resonant", ""), - ("OUTDOORS_BACKYARD", "Outdoors - Backyard", ""), - ("OUTDOORS_ROLLINGPLAINS", "Outdoors - Rolling plains", ""), - ("OUTDOORS_DEEPCANYON", "Outdoors - Deep canyon", ""), - ("OUTDOORS_CREEK", "Outdoors - Creek", ""), - ("OUTDOORS_VALLEY", "Outdoors - Valley", ""), - ("MOOD_HEAVEN", "Mood - Heaven", ""), - ("MOOD_HELL", "Mood - Hell", ""), - ("MOOD_MEMORY", "Mood - Memory", ""), - ("DRIVING_COMMENTATOR", "Driving - Commentator", ""), - ("DRIVING_PITGARAGE", "Driving - In pit garage", ""), - ("DRIVING_INCAR_RACER", "Driving - In racer car", ""), - ("DRIVING_INCAR_SPORTS", "Driving - In sports car", ""), - ("DRIVING_INCAR_LUXURY", "Driving - In luxury car", ""), - ("DRIVING_FULLGRANDSTAND", "Driving - Full grand stand", ""), - ("DRIVING_EMPTYGRANDSTAND", "Driving - Empty grand stand", ""), - ("DRIVING_TUNNEL", "Driving - Tunnel", ""), - ("CITY_STREETS", "City - Streets", ""), - ("CITY_SUBWAY", "City - Subway", ""), - ("CITY_MUSEUM", "City - Museum", ""), - ("CITY_LIBRARY", "City - Library", ""), - ("CITY_UNDERPASS", "City - Underpass", ""), - ("CITY_ABANDONED", "City - Abandoned", ""), - ("DUSTYROOM", "Dusty room", ""), - ("CHAPEL", "Chapel", ""), - ("SMALLWATERROOM", "Small water room", "")], - default="OUTDOORS_ROLLINGPLAINS", - options=set()) - environment_size = FloatProperty(name="Environment Size", description="Environment Size", default=7.5, min=1.0, max=100.0, options=set()) @@ -405,15 +398,11 @@ class PlasmaReverbRegion(PlasmaModifierProperties): default=250.0, min=20.0, max=1000.0, options=set()) - # Room rolloff - always at 0 in all presets, so screw it. - # room_rolloff_factor = FloatProperty(name="Room Rolloff Factor", description="Room Rolloff Factor", - # default=0.0, min=0.0, max=1.0) - flags = EnumProperty(name="Flags", description="Reverb flags", items=reverb_flags, - default={ "kFlagDecayTimeScale", "kFlagReflectionsScale", "kFlagReflectionsDelayScale", - "kFlagReverbScale", "kFlagReverbDelayScale", "kFlagEchoTimeScale" }, + default={"kFlagDecayTimeScale", "kFlagReflectionsScale", "kFlagReflectionsDelayScale", + "kFlagReverbScale", "kFlagReverbDelayScale", "kFlagEchoTimeScale"}, options={"ENUM_FLAG"}) def export(self, exporter, bo, so): @@ -445,10 +434,8 @@ class PlasmaReverbRegion(PlasmaModifierProperties): for flag in self.flags: props.flags |= getattr(EAXReverbProperties, flag) eax_listener.listenerProps = props - elif self.preset == "MORE": - eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset_more) else: - eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_" + self.preset) + eax_listener.listenerProps = getattr(EAXReverbProperties, "REVERB_PRESET_{}".format(self.preset)) class PlasmaSoftVolume(idprops.IDPropMixin, PlasmaModifierProperties): diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index ff99fd7..1025d40 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -297,7 +297,7 @@ class PlasmaSound(idprops.IDPropMixin, bpy.types.PropertyGroup): sound.channel = plWin32Sound.kRightChannel # Reverb/EAX - if self.sfx_type in ("kSoundFX", "kNPCVoices") and self.reverb_amount > 0: + if self.sfx_type in {"kSoundFX", "kNPCVoices"} and self.reverb_amount > 0: eax = sound.eaxSettings eax.enable = True # Occlusion: the minimum is -100 dB (but the value is multiplied by 100 in EAX's API) diff --git a/korman/ui/modifiers/sound.py b/korman/ui/modifiers/sound.py index e2569bb..b0f9692 100644 --- a/korman/ui/modifiers/sound.py +++ b/korman/ui/modifiers/sound.py @@ -83,7 +83,7 @@ def soundemit(modifier, layout, context): col.separator() _draw_fade_ui(sound.fade_out, col, "Fade Out:") - if sound.sfx_type in ("kSoundFX", "kNPCVoices"): + if sound.sfx_type in {"kSoundFX", "kNPCVoices"}: col.separator() col.prop(sound, "reverb_amount", text="Reverb Amount")