Пример #1
0
func main() {
	spec := &sdl.AudioSpec{
		Freq:     sampleHz,
		Format:   sdl.AUDIO_U8,
		Channels: 2,
		Samples:  sampleHz,
		Callback: sdl.AudioCallback(C.SineWave),
	}
	sdl.OpenAudio(spec, nil)
	sdl.PauseAudio(0)
	time.Sleep(1 * time.Second)
}
Пример #2
0
func main() {
	if err := sdl.Init(sdl.INIT_AUDIO); err != nil {
		log.Println(err)
		return
	}
	defer sdl.Quit()

	spec := &sdl.AudioSpec{
		Freq:     sampleHz,
		Format:   sdl.AUDIO_U8,
		Channels: 2,
		Samples:  sampleHz,
		Callback: sdl.AudioCallback(C.SineWave),
	}
	sdl.OpenAudio(spec, nil)
	sdl.PauseAudio(false)
	time.Sleep(1 * time.Second)
}
Пример #3
0
func (m *machine) EndTone() {
	sdl.PauseAudio(true)
}
Пример #4
0
func (m *machine) BeginTone() {
	sdl.PauseAudio(false)
}