veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.17k stars 219 forks source link

SDL_Mixer: Flac support not available #457

Open Keithcat1 opened 4 years ago

Keithcat1 commented 4 years ago

FLAC support is not available. I have mix.INIT_FLAC specified. go version go1.14.1 windows/amd64

veeableful commented 4 years ago

Hi @Keithcat1, could you post the a minimal code that reproduces the issue? I tried to reproduce it but was unable to.

Keithcat1 commented 4 years ago

package main import( "github.com/veandco/go-sdl2/mix" "time" "os" ) func HandleError(err error) { if err!=nil { panic(err) } } func main() { if len(os.Args)<2 { println("Usage: File\n") os.Exit(0) } file:=os.Args[1] HandleError(mix.Init(mix.INIT_MP3|mix.INIT_OGG|mix.INIT_FLAC)) HandleError(mix.OpenAudio(mix.DEFAULT_FREQUENCY, mix.DEFAULT_FORMAT, mix.DEFAULT_CHANNELS, mix.DEFAULT_CHUNKSIZE)) defer mix.CloseAudio() ch, err:=mix.LoadMUS(file) HandleError(err) err=ch.Play(3) HandleError(err) for mix.PlayingMusic() { time.Sleep(time.Millisecond*5) } }

veeableful commented 4 years ago

Hi @Keithcat1, could you tell me what kind of error did you encounter? Depending on the problem, it might be possible to solve the issue by copying the SDL2 *.dll files. For example:

cp /c/Program\ Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/bin/lib*.dll .

Your MinGW version might be a little different!

Keithcat1 commented 4 years ago

panic: FLAC support not available

goroutine 1 [running, locked to thread]: main.HandleError(...) command-line-arguments/s.go:8 main.main() command-line-arguments/s.go:16 +0x1fa

veeableful commented 4 years ago

Hi @Keithcat1, did you try coping the *.dll files into your program directory? If you have, could you list the files in your program directory (with ls -lh for example)? There should be a .dll file for FLAC.