-
Notifications
You must be signed in to change notification settings - Fork 96
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
Hot-reloading crashes when using sprites #43
Comments
I think I am getting an error from the same underlying issue. When I hot reload using my next.js app, I get that error. But I also get a very similar error when doing something as simple as adjusting the volume:
I get the following error: Unhandled Runtime Error Call Stack |
UPDATE: I found a work around using the exposedData Howl object: `
} |
Ps. Love this Hook by the way, thanks for all your work on it! |
Still hoping this bug might get a fix? It's a bummer to keep having to reload the page with every change since this bug prevents hot reloading. |
what is "pianoSoundData.sprite" in your solution? |
That's the list of sprites in the JSON object for the audio data. You can
use https://github.com/tonistiigi/audiosprite to generate the JSON file and
the audio file for whatever audio you are using.
Here's an example:
{
"src": ["/audio/sounds.ogg", "/audio/sounds.m4a", "/audio/sounds.mp3",
"/audio/sounds.ac3"],
"sprite": {
"guitar-A2#": [0, 2142.4036281179137],
"guitar-A2": [3000, 2137.5963718820863],
"guitar-A3#": [6000, 2143.8548752834467],
"guitar-A3": [9000, 2140.5895691609976]
}
}
…On Sun, Dec 18, 2022 at 10:58 PM rymdmetafor ***@***.***> wrote:
UPDATE:
I found a work around using the exposedData Howl object:
` const [volume, setVolume] = useState(0.75); const [play, exposedData] =
useSound([pianoSoundsOgg, pianoSoundsMp3, pianoSoundsM4a], { sprite:
pianoSoundData.sprite, volume: volume, });
function handleChangeVolumeOnClick() {
if (volume === .75) {
setVolume(.25)
exposedData.sound.volume(.25) // update howl object volume at the same time as state.
}
}
} `
what is "pianoSoundData.sprite" in your solution?
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJVT3RBOC3FV3EPQDEZEDLTWOABRLANCNFSM4SEZAVAA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
*Scott Wolf, DMA*
Oxnard College - Professor of Music
www.scottwolfguitar.com
All Strings Considered <http://www.scottwolfguitar.com/podcast.html>
Follow on Twitter - @allstrings <https://twitter.com/allstrings>
Subscribe free on iTunes
<https://itunes.apple.com/us/podcast/all-strings-considered/id562425515> -
Subscribe - Please Rate!
|
Update for 2024:
How come there are no well-maintained sound libraries? |
Whats wrong with including |
When using sprites, hot reloading does not work anymore.
When react calls
commitHookEffectListMount
after hot reloading, this gets called in use-soundwhere
sound.rate(playbackRate);
fails in howler becauseself._sprite
is undefinedTypeError: self._sprite[sound._sprite] is undefined
.Your comment suggest you're already aware of this issue. This is more a inconvinience than anything serious, so i created this issue just to keep track of this bug.
The text was updated successfully, but these errors were encountered: