oprypin / crsfml

Crystal bindings to SFML multimedia/game library

Home Page:https://oprypin.github.io/crsfml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to resolve SF::Sound (also SF::Music)

freeze-dolphin opened this issue · comments

image

I have added require "crsfml" at the top of the file.

Need to require "crsfml/audio", that's probably what's missing

Thanks, it works.

But now another problem comes into being... xd

This is my code:

def play(audio : String,
         volume : Float64,
         loop? : Bool = false)
  if loop?
    music = SF::Music.new
    music.open_from_file audio
    music.volume = volume * 100
    music.loop = true
    music.play
  else 
    sound = SF::Sound.new SF::SoundBuffer.from_file audio
    sound.volume = volume * 100
    sound.play
  end
end

and here is the runtime error:

freeze-dolphin@nebula:~/Documents/vscode-workspace/arcaea-inspector$ shards run -- -o /home/freeze-dolphin/Documents/arcaea_4.0.255c_assets/app-data/story/vn/epilogue_last_zh-Hans.vns
Dependencies are satisfied
Building: arcaea-inspector
Executing: arcaea-inspector -o /home/freeze-dolphin/Documents/arcaea_4.0.255c_assets/app-data/story/vn/epilogue_last_zh-Hans.vns

AL lib: (EE) alc_cleanup: 1 device not closed
freeze-dolphin@nebula:~/Documents/vscode-workspace/arcaea-inspector$ 

And no sound was played

My operating system: Ubuntu 22.04 LTS, GNOME 42.2, Wayland

It seems like to be a concurrent-related topic..
posted on crystal forum: https://forum.crystal-lang.org/t/concurrency-related-problem/4808