Ejemplo n.º 1
0
func (ap *audioPlayer) setVolumeLevel(value int) error {
	result := C.setVolumeLevel((*C.t_buffer_queue_ap)(ap.bqPlayer), C.SLmillibel(value))
	if result != C.SL_RESULT_SUCCESS {
		return fmt.Errorf("Unable to set volume level. Error code is %x", int(result))
	}
	return nil
}
Ejemplo n.º 2
0
func (a *Audio) AppendSample(s int16) {
	a.samples[a.sampleIndex] = C.SLmillibel(s)
	a.sampleIndex++

	if a.sampleIndex == SampleSize {
		a.mutex.Lock()
		a.output <- a.samples
		a.sampleIndex = 0
		a.mutex.Unlock()
	}
}