-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: Make the
Histogram
component display the actual audio instea…
…d of showing random bar heights (#1297) * feat: Make `Histogram` display the actual audio instead of showing random bar heights * fix(test): Fix & update Histogram tests after making it dependent on actual audio frequency data * fix: Set histogram end state to array of zeros * feat: Refactor Playback component and update stories to TypeScript and use correct props * chore: Add (creative commons) music audio file to test the histogram component * refactor: Remove the lower end of the histogram frequency data to avoid it overcrowding the histogram * fix: Fix test through improved fake timer configuration * chore: Update testing library dependencies in package.json * chore: Update vitest coverage dependencies to latest versions * chore: Remove babel-plugin-named-exports-order dependency from project
- Loading branch information
1 parent
c843f94
commit e5c886c
Showing
10 changed files
with
812 additions
and
1,059 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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,66 @@ | ||
import { useState } from "react"; | ||
import Playback, { PlaybackProps } from "../components/Playback/Playback"; | ||
import { AUTOPLAY } from "../types/Playback"; | ||
|
||
import audio from "./assets/music.ogg"; | ||
|
||
export default { | ||
title: "Playback", | ||
component: Playback, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
}; | ||
|
||
export const Button = { | ||
args: { | ||
playbackArgs: { | ||
view: AUTOPLAY, | ||
play_method: "BUFFER", | ||
show_animation: true, | ||
preload_message: "Loading audio...", | ||
instruction: "Click the button to play the audio.", | ||
sections: [ | ||
{ | ||
id: 0, | ||
url: audio, | ||
} | ||
], | ||
play_from: 0.0, | ||
resume_play: false, | ||
}, | ||
onPreloadReady: () => { }, | ||
autoAdvance: false, | ||
responseTime: 10, | ||
submitResult: () => { }, | ||
finishedPlaying: () => { }, | ||
} as PlaybackProps, | ||
decorators: [ | ||
(Story) => { | ||
|
||
const [initialized, setInitialized] = useState(false); | ||
|
||
|
||
if (!initialized) { | ||
return ( | ||
<> | ||
<button onClick={() => { | ||
setInitialized(true); | ||
} | ||
}> | ||
Initialize WebAudio | ||
</button> | ||
</> | ||
) | ||
} | ||
|
||
return ( | ||
<div | ||
style={{ width: "100%", height: "100%", backgroundColor: "#ddd", padding: "1rem" }} | ||
> | ||
<Story /> | ||
</div> | ||
) | ||
} | ||
], | ||
}; |
Binary file not shown.
Oops, something went wrong.