Example #1
0
// Pause or unpause the audio.
func PauseAudio(pause_on bool) {
	if pause_on {
		C.SDL_PauseAudio(1)
	} else {
		C.SDL_PauseAudio(0)
	}
}
Example #2
0
//
// This function pauses and unpauses the audio callback processing.
// It should be called with a parameter of 0 after opening the audio
// device to start playing sound.  This is so you can safely initialize
// data for your callback function after opening the audio device.
// Silence will be written to the audio device during the pause.
///
func PauseAudio(pause_on bool) {
	pause := 0
	if pause_on {
		pause = 1
	}
	C.SDL_PauseAudio(C.int(pause))
}
Example #3
0
func PauseAudio(p bool) {
	var cp C.int
	if p {
		cp = 1
	}

	C.SDL_PauseAudio(cp)
}
Example #4
0
File: audio.go Project: velour/ui
func initAudio() {
	var want C.SDL_AudioSpec
	want.freq = 44100
	want.format = C.AUDIO_S16LSB
	want.samples = 8096
	C.setCallback(&want)
	C.SDL_OpenAudio(&want, &openedSpec)
	C.SDL_PauseAudio(0)
}
Example #5
0
// Pause or unpause the audio.
// Unpausing is deferred until a SendAudio function receives some samples.
func PauseAudio(pause_on bool) {
	mutex.Lock()

	if pause_on != sdlPaused {
		if pause_on {
			// Pause SDL audio
			userPaused = true
			sdlPaused = true
			C.SDL_PauseAudio(1)
		} else {
			userPaused = false
			if haveData {
				// Unpause SDL audio
				sdlPaused = false
				C.SDL_PauseAudio(0)
			} else {
				// Defer until SendAudio is called
			}
		}
	}

	mutex.Unlock()
}
Example #6
0
func sendAudio(data *C.Uint8, numBytes C.size_t) {
	if numBytes > 0 {
		mutex.Lock()
		{
			haveData = true

			if (userPaused == false) && (sdlPaused == true) {
				// Unpause SDL audio
				sdlPaused = false
				C.SDL_PauseAudio(0)
			}
		}
		mutex.Unlock()

		C.callback_fillBuffer(data, numBytes)

		mutex.Lock()
		haveData = false
		mutex.Unlock()
	}
}
Example #7
0
// PauseAudio (https://wiki.libsdl.org/SDL_PauseAudio)
func PauseAudio(pauseOn int) {
	C.SDL_PauseAudio(C.int(pauseOn))
}
Example #8
0
// PauseAudio (https://wiki.libsdl.org/SDL_PauseAudio)
func PauseAudio(pauseOn bool) {
	C.SDL_PauseAudio(C.int(Btoi(pauseOn)))
}
Example #9
0
func PauseAudio(pause_on int) {
	_pause_on := (C.int)(pause_on)
	C.SDL_PauseAudio(_pause_on)
}
Example #10
0
func PauseAudio(pause_on bool) {
	C.SDL_PauseAudio(C.int(bool2int(pause_on)))
}