-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: Add channelIdx parameter to have the ability to create a region just for a specific channel #3234
Feat: Add channelIdx parameter to have the ability to create a region just for a specific channel #3234
Conversation
224724c
to
5a37baf
Compare
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.
Hey, thanks for the PR! Looks good overall, just left a couple comments. Cheers!
src/plugins/regions.ts
Outdated
@@ -57,6 +58,8 @@ export type RegionParams = { | |||
minLength?: number | |||
/** Max length when resizing (in seconds) */ | |||
maxLength?: number | |||
/** The id of the channel */ | |||
channelId?: number |
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.
In v6, this param was called channelIdx
which was technically more correct because it's a channel's index, not an id.
Should we call it channelIndex
maybe? Or just keep channelIdx
for backwards compatibility.
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.
I agree with you, for some reason I didn't realize it was an index instead of an id 🙈
src/plugins/regions.ts
Outdated
|
||
constructor(params: RegionParams, private totalDuration: number) { | ||
constructor(params: RegionParams, private totalDuration: number, wavesurfer: WaveSurfer) { |
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.
I intentionally didn't pass the wavesurfer instance to the Region class to limit its responsibilities.
The only place where you're using it is to get the numberOfChannels, so I'd suggest to pass that instead.
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.
I see it, thanks for explaining! I just pushed this change
5a37baf
to
d1cae0a
Compare
Thanks for addressing my comments! |
d1cae0a
to
c17d1cc
Compare
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.
Thank you!
Short description
Resolves #3220
Implementation details
Add channelIdx parameter to have the ability to create a region just for a specific channel
How to test it
You can use this code to test it:
code
Screenshots
Checklist