sdlada
sdlada copied to clipboard
Add basic Audio support
Another attempt to kick off: https://github.com/Lucretia/sdlada/issues/26
Thick binding to the methods required to output audio using either callbacks or queues. The reason I went for a thick binding is to hide the low level buffer passing/size calculations that is done with the C arrays so we can offer something more Ada-like through unconstrained arrays.
This implements:
- SDL_AudioInit
- SDL_GetAudioDeviceName
- SDL_GetAudioDeviceStatus
- SDL_GetAudioDriver
- SDL_CloseAudioDevice
- SDL_GetCurrentAudioDriver
- SDL_GetNumAudioDevices
- SDL_GetNumAudioDrivers
- SDL_GetQueuedAudioSize
- SDL_OpenAudioDevice
- SDL_PauseAudioDevice
This purposely skips the legacy OpenAudio
(no Device) methods, as implementing the binding in a similar fashion would just result in duplicate signatures.
Also made a few tweaks so things compile out of the box on a recent MacOS version (Catalina) with SDL installed from Homebrew as well as renaming the os to account for future MacOS releases (no longer OSX). Also makes building the tests from GPR/GPS possible by adding the Linker flags in the project file.
Possible Concerns
- Copyright notices (not quite sure what's expected here, happy to remove myself from them if necessary)
- ~Dirty commit history. Can either squash this or separate the build config changes from audio additions into different PR~
- The
Device
abstraction might be thicker than needed, but I think that it works well and the overhead is minimal. Makes for a clean interface that can be easily changed under the hood without breaking the clients. - The whole Audio Devices package is generic even though there are a few methods that don't really rely on that. I don't think it's worth dividing things as one is likely bound to use the bits that depend on the generic arguments in real world uses.
@Lucretia Rebased and cleaned up the branch and its commit history.
I'm wondering about the change in ellamosi@a335b11e7769ab24b08a494955f48d6f5d43f20d and the whole linker section there, homebrew has sdl2-config right? Does it work? The idea behind the build is that the makefile does all the command line crap through sdl2-config; and therefore any app using the lib would also call the same script to get the platform specific flags set.
Can you check the makefile and see if the command for linux "SDL2_CONFIG =" works for homebrew?
Thanks.
Thanks for doing this.