Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Audio support #70

Merged
merged 2 commits into from
Feb 12, 2023

Conversation

ellamosi
Copy link

@ellamosi ellamosi commented Mar 2, 2021

Another attempt to kick off: #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.

@ellamosi ellamosi force-pushed the add-basic-audio branch 2 times, most recently from dd96ec0 to c6a6c24 Compare January 20, 2022 01:15
@ellamosi
Copy link
Author

@Lucretia Rebased and cleaned up the branch and its commit history.

@ellamosi ellamosi changed the title Add Basic Audio Add basic Audio support Jan 20, 2022
@Lucretia
Copy link
Collaborator

I'm wondering about the change in ellamosi/sdlada@a335b11 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.

@Lucretia Lucretia merged commit b6e74cb into ada-game-framework:master Feb 12, 2023
@Lucretia
Copy link
Collaborator

Thanks for doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants