Closed konsumer closed 2 years ago
Ah, silly me, I forgot I needed InitAudioDevice()
in C, too. I added it and it works great:
const r = require('raylib')
r.InitWindow(320, 240, 'music demo')
r.SetTargetFPS(60)
r.InitAudioDevice()
const music = r.LoadMusicStream('assets/the_golden_ages.mod')
r.PlayMusicStream(music)
while (!r.WindowShouldClose()) {
r.UpdateMusicStream(music)
r.BeginDrawing()
r.ClearBackground(r.BLACK)
r.DrawText('HELLO!', 10, 10, 20, r.LIGHTGRAY)
r.EndDrawing()
}
r.UnloadMusicStream(music)
r.CloseWindow()
Sorry for the queue-noise.
We could add a check in the constructor to ensure it's initialized.
Nah, not necessary at all. I like that it works the same, personally, just an error on my part.
Sidenote: I love what you did with this. It works really well, and mirrors the C interface really closely (so far) so it's fairly easy to figure out how to make stuff work.
I wrote a simple demo in raylib, in C, that loads a mod music file, and I am trying to create the same thing in node:
It appears like it's working, and prints "Hello!" on screen, but I don't hear any sound.
It outputs this:
In C I needed this:
How do I add this to node-raylib?