File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
tests/IntegrationTests/AudioNodeTests Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -52,4 +52,26 @@ public async Task GetByteFrequencyDataAsync_ShouldPopulateBuffer()
5252 byte tenthElement = await buffer . AtAsync ( 10 ) ;
5353 _ = tenthElement . Should ( ) . NotBe ( 0 ) ;
5454 }
55+
56+ [ Test ]
57+ public async Task GetFloatTimeDomainDataAsync_ShouldPopulateBuffer ( )
58+ {
59+ // Arrange
60+ await using AudioContext context = await GetAudioContextAsync ( ) ;
61+
62+ await using OscillatorNode oscillator = await OscillatorNode . CreateAsync ( JSRuntime , context ) ;
63+ await using AnalyserNode node = await AnalyserNode . CreateAsync ( JSRuntime , context ) ;
64+ await oscillator . ConnectAsync ( node ) ;
65+ await oscillator . StartAsync ( ) ;
66+
67+ int bufferLength = ( int ) await node . GetFftSizeAsync ( ) ;
68+ await using Float32Array buffer = await Float32Array . CreateAsync ( JSRuntime , bufferLength ) ;
69+
70+ // Act
71+ await node . GetFloatTimeDomainDataAsync ( buffer ) ;
72+
73+ // Assert
74+ float tenthElement = await buffer . AtAsync ( bufferLength - 1 ) ;
75+ _ = tenthElement . Should ( ) . NotBe ( 0 ) ;
76+ }
5577}
You can’t perform that action at this time.
0 commit comments