-
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.
Use solidjs-store for reactivity (#12)
* Reduce control panel rerenders * Fix button text colour on iOS * Only show 9 buttons on small screen * Move beep out of default 12 * Unmute audio on iOS * Memoise model hooks * Fix linter issues * Use global signal for AudioContext also add docstrings for tsdoc * Use CSS module for App * Rewrite using solid-store * Add persistence in localStorage * Display knob block * Modal use css module * Update docstring * Use CSS modules * Safer parse localStorage * Drop console logs * Removed unused
- Loading branch information
Showing
63 changed files
with
1,466 additions
and
738 deletions.
There are no files selected for viewing
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,21 @@ | ||
env: | ||
browser: true | ||
es2022: true | ||
extends: | ||
- 'eslint:recommended' | ||
- 'plugin:@typescript-eslint/recommended' | ||
parser: '@typescript-eslint/parser' | ||
plugins: | ||
- '@typescript-eslint' | ||
- 'simple-import-sort' | ||
root: true | ||
rules: | ||
# Non-null assertions used for refs in solidJS | ||
'@typescript-eslint/no-non-null-assertion': 0 | ||
'@typescript-eslint/no-unused-vars': 'error' | ||
'@typescript-eslint/explicit-function-return-type': | ||
- error | ||
- allowExpressions: true | ||
|
||
simple-import-sort/imports: | ||
- error |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,33 @@ | ||
import { createSignal } from 'solid-js'; | ||
import { unmute } from 'src/audio/unmute'; | ||
|
||
const [AudioCtx, setAudioCtx] = createSignal<AudioContext | null>(null); | ||
|
||
/** | ||
* Activates the Global Audio Context signal | ||
* | ||
* Must be used in a user interaction callback (ie onclick) to initialise the context in an active state | ||
* @param contextOptions - Options to pass to the new AudioContext | ||
* @param force - Initialise a new AudioContext even if another is running | ||
*/ | ||
function activateAudioCtx( | ||
contextOptions?: AudioContextOptions, | ||
force = false, | ||
): void { | ||
if (!force && AudioCtx()) { | ||
return; | ||
} | ||
const ctx = new AudioContext(contextOptions); | ||
unmute(ctx); | ||
setAudioCtx(ctx); | ||
} | ||
|
||
export { | ||
/** | ||
* # AudioCtx | ||
* ## Description | ||
* Global AudioContext signal | ||
*/ | ||
AudioCtx, | ||
activateAudioCtx, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './AudioContextManager'; | ||
export * from './AudioCtx'; | ||
export * from './AudioPlayerNode'; | ||
export * from './unmute'; |
Oops, something went wrong.