-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/android/gain node #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small js nitpicks, overall looks good
|
||
namespace audiocontext { | ||
|
||
using namespace facebook::jni; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this file then? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right
example/src/App.tsx
Outdated
} | ||
minimumValue={0.0} | ||
maximumValue={1.0} | ||
step={0.1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: why only 10 steps instead of 100 with step of 0.01
or even go with [0, 100]
scope and normalize it when setting a gainRef property
example/src/App.tsx
Outdated
const handleSliderChange = ( | ||
value: number[], | ||
defaultValue: number, | ||
setValue: (value: number) => void, | ||
ref: React.MutableRefObject<{ [key: string]: any } | null>, | ||
propName: string | ||
) => { | ||
const newValue = value[0] || defaultValue; | ||
setValue(newValue); | ||
if (ref.current) { | ||
ref.current[propName] = newValue; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't notice is earlier, why so over-complicated?
const handleSliderChange = ( | |
value: number[], | |
defaultValue: number, | |
setValue: (value: number) => void, | |
ref: React.MutableRefObject<{ [key: string]: any } | null>, | |
propName: string | |
) => { | |
const newValue = value[0] || defaultValue; | |
setValue(newValue); | |
if (ref.current) { | |
ref.current[propName] = newValue; | |
} | |
}; | |
const handleSliderChange = (value: number[]) => { | |
const newValue = value[0] || 0.0; | |
setValue(newValue); | |
ganinRef.current?.gain = value; | |
}; |
if we would like to have generic way of modify'ing nodes via sliders we could create a hook and/or components for that
useNodeValue(node: AudioNode) {
// state
// callbacks
// return values?
}
...
useNodeValue(gainNodeRef.current);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently I have implemented three handlers each for parameter. In future I will introduce sth like a hook that u mentioned.
Fix conflicting files, consider the comments and you can merge this branch :) |
-Implemented classes for GainNode and whole necessary logic in AudioContext classes
-Implemented get method in AudioNodeHostObject in order to call it from derived classes
-Refactored imports, friend class marks, etc.
Closes: #22