Ejemplo n.º 1
0
// BufferAudio adds 8-bit audio to the play buffer.
func BufferAudio(sound []int8) {
	if len(sound) == 0 {
		return
	}
	mutex.Lock()
	C.play((*C.Uint8)(unsafe.Pointer(&sound[0])), C.int(len(sound)))
	mutex.Unlock()
}
Ejemplo n.º 2
0
func playTrack(t uint8) {
	//
	if t >= nTracks {
		return
	}
	if int(C.start(C.int(cdd))) == 0 {
		return
	}
	C.play(C.int(cdd), C.uint(startFrame[t]), C.uint(startFrame[nTracks]-offset))
}
Ejemplo n.º 3
0
func Play(input io.Reader) error {
	buf, err := ioutil.ReadAll(input)
	if err != nil {
		return err
	}
	mutex.Lock()
	C.play((*C.Uint8)(unsafe.Pointer(&buf[0])), C.int(len(buf)))
	mutex.Unlock()
	return nil
}
Ejemplo n.º 4
0
func posTime(all bool, sec uint) {
	//
	f := frames * sec
	t := uint8(0)
	if !all {
		var f1 uint
		f1, status = cstatus(cdd)
		t = inTrack(f1)
	}
	f += startFrame[t]
	if f > startFrame[nTracks] {
		return
	}
	C.play(C.int(cdd), C.uint(f), C.uint(startFrame[nTracks]-offset))
}