func OpenAudio(frequency int, format uint16, channels, chunksize int) bool { _frequency := (C.int)(frequency) _format := (C.Uint16)(format) _channels := (C.int)(channels) _chunksize := (C.int)(chunksize) return int(C.Mix_OpenAudio(_frequency, _format, _channels, _chunksize)) == 0 }
// Open the mixer with a certain audio format func OpenMixer(frequency int, format uint16, channels int, chunksize int) (bool) { res := (int(C.Mix_OpenAudio(C.int(frequency), C.Uint16(format), C.int( channels), C.int(chunksize)))) ok := (res == 0) MixerOpened = ok return ok }
// OpenAudio (https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_11.html) func OpenAudio(frequency int, format uint16, channels, chunksize int) error { _frequency := (C.int)(frequency) _format := (C.Uint16)(format) _channels := (C.int)(channels) _chunksize := (C.int)(chunksize) if C.Mix_OpenAudio(_frequency, _format, _channels, _chunksize) < 0 { return sdl.GetError() } return nil }
func Init(initSDL, stereo bool, rate, nchannels, nbuffers int) { if initSDL { GSDLWasInitHere = true if C.SDL_Init(C.SDL_INIT_AUDIO) != 0 { panic(fmt.Sprintf("Unable to initialize SDL: %v\n", util.GetSdlError())) } } //initFlags := C.MIX_INIT_FLAC | C.MIX_INIT_MP3 | C.MIX_INIT_OGG //C.Mix_Init(initFlags) audio_format := C.AUDIO_S16SYS nstereo := 1 if stereo { nstereo = 2 } if C.Mix_OpenAudio(C.int(rate), C.Uint16(audio_format), C.int(nstereo), C.int(nbuffers)) != 0 { panic(fmt.Sprintf("Unable to initialize audio: %v\n", util.GetMixError())) } channel.Allocate(nchannels) }
// Initializes SDL_mixer. Return 0 if successful and -1 if there were // initialization errors. func OpenAudio(frequency int, format uint16, channels, chunksize int) int { return int(C.Mix_OpenAudio(C.int(frequency), C.Uint16(format), C.int(channels), C.int(chunksize))) }