MCPcopy
hub / github.com/ebitengine/oto / resume

Method resume

driver_darwin.go:252–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

250}
251
252func (c *context) resume() error {
253 var retryCount int
254try:
255 if osstatus := _AudioQueueStart(c.audioQueue, nil); osstatus != noErr {
256 if (osstatus == avAudioSessionErrorCodeCannotStartPlaying ||
257 osstatus == avAudioSessionErrorCodeCannotInterruptOthers) &&
258 retryCount < 30 {
259 // It is uncertain that this error is temporary or not. Then let's use exponential-time sleeping.
260 time.Sleep(sleepTime(retryCount))
261 retryCount++
262 goto try
263 }
264 if osstatus == avAudioSessionErrorCodeSiriIsRecording {
265 // As this error should be temporary, it should be OK to use a short time for sleep anytime.
266 time.Sleep(10 * time.Millisecond)
267 goto try
268 }
269 return fmt.Errorf("oto: AudioQueueStart failed at Resume: %d", osstatus)
270 }
271 return nil
272}
273
274func (c *context) Err() error {
275 if err := c.err.Load(); err != nil {

Callers 1

appendBufferMethod · 0.95

Calls 1

sleepTimeFunction · 0.85

Tested by

no test coverage detected