| 595 | } |
| 596 | |
| 597 | int |
| 598 | SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len) |
| 599 | { |
| 600 | SDL_AudioDevice *device = get_audio_device(devid); |
| 601 | int rc = 0; |
| 602 | |
| 603 | if (!device) { |
| 604 | return -1; /* get_audio_device() will have set the error state */ |
| 605 | } else if (device->iscapture) { |
| 606 | return SDL_SetError("This is a capture device, queueing not allowed"); |
| 607 | } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) { |
| 608 | return SDL_SetError("Audio device has a callback, queueing not allowed"); |
| 609 | } |
| 610 | |
| 611 | if (len > 0) { |
| 612 | current_audio.impl.LockDevice(device); |
| 613 | rc = SDL_WriteToDataQueue(device->buffer_queue, data, len); |
| 614 | current_audio.impl.UnlockDevice(device); |
| 615 | } |
| 616 | |
| 617 | return rc; |
| 618 | } |
| 619 | |
| 620 | Uint32 |
| 621 | SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len) |