make render a method of milkdropwindow
This commit is contained in:
parent
4a9d73ef04
commit
622e85a4f6
10
main.go
10
main.go
|
@ -62,7 +62,7 @@ func (m *milkDropWindow) loadPreset(preset string) {
|
||||||
C.projectm_load_preset_file(m.handle, cPreset, false)
|
C.projectm_load_preset_file(m.handle, cPreset, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
|
func (m *milkDropWindow) render() (bool, error) {
|
||||||
var audioData [bufSize]int16
|
var audioData [bufSize]int16
|
||||||
|
|
||||||
err := binary.Read(os.Stdin, binary.LittleEndian, &audioData)
|
err := binary.Read(os.Stdin, binary.LittleEndian, &audioData)
|
||||||
|
@ -72,10 +72,10 @@ func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
|
||||||
return true, err
|
return true, err
|
||||||
}
|
}
|
||||||
|
|
||||||
C.projectm_pcm_add_int16(handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
|
C.projectm_pcm_add_int16(m.handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
|
||||||
|
|
||||||
C.projectm_opengl_render_frame(handle)
|
C.projectm_opengl_render_frame(m.handle)
|
||||||
window.GLSwap()
|
m.window.GLSwap()
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func main() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
running, err = render(m.window, m.handle)
|
running, err = m.render()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue