Skip to content

Commit

Permalink
improved luf meter animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoxor committed Jan 27, 2023
1 parent 1333a1f commit f79098a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/renderer/components/visualizers/DbMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ onUnmounted(() => shouldStopRendering = true);
<template>
<div
class="relative h-full"
:style="`width: ${(width + (width / 2)) * nChannels + 6}px`"
:style="`
width: ${(width + (width / 2)) * nChannels + 2}px;
min-width: ${(width + (width / 2)) * nChannels + 2}px;
`"
>
<div
v-for="i of nChannels"
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/components/visualizers/LoudnessMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { player } from "@/logic/player";
const props = defineProps<{ node: AudioNode }>();
const MINIMUM_LUFS = -64;
const MINIMUM_LUFS = -20;
const shortTerm = ref(MINIMUM_LUFS);
const momentary = ref(MINIMUM_LUFS);
Expand Down Expand Up @@ -65,6 +65,7 @@ onMounted(() => {
const computeWidth = (value: number): number => {
const MAX = 0;
const MIN = MINIMUM_LUFS;
if (value < MINIMUM_LUFS) return 0; // if below threashold don't default to 100
return ((value - MIN) / (MAX - MIN)) * 100;
};
Expand Down Expand Up @@ -129,10 +130,10 @@ const computeWidth = (value: number): number => {
@apply flex flex-col gap-1.5;
}
.barBg {
@apply bg-surface-600 w-full rounded-2px;
@apply bg-surface-600 w-full overflow-hidden rounded-2px;
}
.bar {
@apply h-1 duration-500 rounded-2px p-0.5 bg-cyan-400;
@apply h-1 duration-250 rounded-2px bg-cyan-400;
}
</style>

0 comments on commit f79098a

Please sign in to comment.