From 6d09cb7547b02054e24b659dffdb064d8e53b7c5 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Tue, 13 Feb 2024 22:21:34 -0800 Subject: [PATCH] feat: OBS.Beat.Duration ( Fixes #189 ) --- Types/OBS.Beat/get_Duration.ps1 | 11 +++++++++++ Types/OBS.Beat/set_Duration.ps1 | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 Types/OBS.Beat/get_Duration.ps1 create mode 100644 Types/OBS.Beat/set_Duration.ps1 diff --git a/Types/OBS.Beat/get_Duration.ps1 b/Types/OBS.Beat/get_Duration.ps1 new file mode 100644 index 000000000..2337666c6 --- /dev/null +++ b/Types/OBS.Beat/get_Duration.ps1 @@ -0,0 +1,11 @@ +<# +.SYNOPSIS + Gets the Duration +.DESCRIPTION + Gets the Duration of a Beat +.OUTPUTS + [TimeSpan] +#> +if ($this.'.BPM') { + [Timespan]::FromMilliseconds((60 * 1000) / $this.'.BPM') +} diff --git a/Types/OBS.Beat/set_Duration.ps1 b/Types/OBS.Beat/set_Duration.ps1 new file mode 100644 index 000000000..774e63492 --- /dev/null +++ b/Types/OBS.Beat/set_Duration.ps1 @@ -0,0 +1,19 @@ +<# +.SYNOPSIS + Gets the Duration +.DESCRIPTION + Gets the Duration of a Beat +.OUTPUTSobs + [TimeSpan] +#> +param( +# The new duration. +# This will also set the BPM +[timespan] +$Duration +) + +$this | Add-Member NoteProperty ".BPM" ( + (60 * 1000) / $Duration.TotalMilliseconds +) -Force -PassThru +