Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Clamp audio slider between 0 - 2 #10854

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import NumericInput from '../../input/Numeric'
import SelectInput from '../../input/Select'
import NodeEditor from '../nodeEditor'

const AUDIO_MULTIPLIER = 50
const PlayModeOptions = [
{
label: 'Single',
Expand Down Expand Up @@ -99,9 +100,9 @@ export const MediaNodeEditor: EditorComponentType = (props) => {
min={0}
max={100}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to change the min/max/step ?

Copy link
Member Author

@SYBIOTE SYBIOTE Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the min max is for the slider UI, is we want the values to be between 0 - 100 on the UI
, we need to use a converter
to convert between 0-2 on the audio scale to 0 - 100 on the UI

Copy link
Member Author

@SYBIOTE SYBIOTE Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can keep the values between 0 - 2 on the UI as well, if needed, is that preffered?

step={1}
value={media.volume.value}
onChange={updateProperty(MediaComponent, 'volume')}
onRelease={commitProperty(MediaComponent, 'volume')}
value={media.volume.value * AUDIO_MULTIPLIER}
onChange={(value) => updateProperty(MediaComponent, 'volume')(value / AUDIO_MULTIPLIER)}
onRelease={(value) => commitProperty(MediaComponent, 'volume')(value / AUDIO_MULTIPLIER)}
/>
</InputGroup>

Expand Down
Loading