-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added ts interface for AnalyserNode
- Loading branch information
Maciej Makowski
committed
Dec 18, 2024
1 parent
e23123b
commit d68b172
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { IAnalyserNode } from '../interfaces'; | ||
import AudioNode from './AudioNode'; | ||
import BaseAudioContext from './BaseAudioContext'; | ||
|
||
export default class AnalyserNode extends AudioNode { | ||
fftSize: number; | ||
readonly frequencyBinCount: number; | ||
minDecibels: number; | ||
maxDecibels: number; | ||
smoothingTimeConstant: number; | ||
|
||
constructor(context: BaseAudioContext, analyser: IAnalyserNode) { | ||
super(context, analyser); | ||
|
||
this.fftSize = analyser.fftSize; | ||
this.frequencyBinCount = analyser.frequencyBinCount; | ||
this.minDecibels = analyser.minDecibels; | ||
this.maxDecibels = analyser.maxDecibels; | ||
this.smoothingTimeConstant = analyser.smoothingTimeConstant; | ||
} | ||
|
||
getFloatFrequencyData(array: number[]): void { | ||
(this.node as IAnalyserNode).getFloatFrequencyData(array); | ||
} | ||
|
||
getByteFrequencyData(array: number[]): void { | ||
(this.node as IAnalyserNode).getByteFrequencyData(array); | ||
} | ||
|
||
getFloatTimeDomainData(array: number[]): void { | ||
(this.node as IAnalyserNode).getFloatTimeDomainData(array); | ||
} | ||
|
||
getByteTimeDomainData(array: number[]): void { | ||
(this.node as IAnalyserNode).getByteTimeDomainData(array); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters