Really micromanaged audio programming (C++)

Started by
15 comments, last by PSvils 6 years, 5 months ago
16 minutes ago, Embassy of Time said:

 

As for DirectSound / XAudio, it's a part of DirectX as I understand it, and that always bugs me. Is it possible to use it completely detached from DirectX, preferably without even importing any of the graphical libraries (I use OpenGL, for the platform portability)?

For xaudio2, it only rely's on xaudio2.lib as far as i'm aware.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Advertisement
21 hours ago, Embassy of Time said:

I have been dabbling with the Waveform and similar APIs before, but I keep feeling like they are to rigid. This might just be me, since audio is not a field I ever did much programming in. If there are good tutorials on things like those I have described, I am very interested in knowing!!

Rigid? How can you feel constrained by an API that lets you fill a buffer with arbitrary samples and play them? Are you attempting something impossible like going back in time and altering sample buffers that have already been sent to playback? Are you disoriented because a relatively low-level interfaces forces you to do all mixing, synthesis etc. on your own with little or no help? Are you in trouble with some specific task?

 

21 hours ago, Embassy of Time said:

As for DirectSound / XAudio, it's a part of DirectX as I understand it, and that always bugs me. Is it possible to use it completely detached from DirectX, preferably without even importing any of the graphical libraries (I use OpenGL, for the platform portability)?

i'm sure these libraries are adequately organized into many modules, both in the actual DLLs and in header files for C and C++ and in namespaces for C++ and C#, and you'll be able to leave out unneeded parts.  And even if you accidentally linked your program with something pointless, it would be very unlikely to cause trouble with OpenGL. 

 

Omae Wa Mou Shindeiru

1 hour ago, LorenzoGatti said:

Rigid? How can you feel constrained by an API that lets you fill a buffer with arbitrary samples and play them? Are you attempting something impossible like going back in time and altering sample buffers that have already been sent to playback? Are you disoriented because a relatively low-level interfaces forces you to do all mixing, synthesis etc. on your own with little or no help? Are you in trouble with some specific task?

No, I just think I never got the right angle on the API. All I found were examples on loading up a file and playing it as-is. Even something like storing it for later replay seemed byzantine to figure out, so at some point, I just assumed it was too rigid. Do you have some tutorials or the like that show me the better side of the API, because I would love some?

[DEDACTED FOR SECURITY REASONS]

xaudio obviously isn't multi platform, if that's what you're asking. It works on Xbox (afaik), Windows, and that's it.

You could try https://www.fmod.com/ with an indie licence.

Anyway, whatever audio lib you use, it'll probably work on top of the native audio layer of the OS. Say, OpenAL Soft will work on top of ALSA/PulseAudio on Linux, WASAPI/DirectSound (or whatever else they have) on Windows, and so on.

So if you go below OpenAL level, you get into platform specific code.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

8 hours ago, Embassy of Time said:

No, I just think I never got the right angle on the API. All I found were examples on loading up a file and playing it as-is

Since you want to perform all the audio synthesis yourself, the API is pretty much irrelevant. All you'd need of the XAudio2 API, for example, would be this.

Its up to you to actually fill the buffer with useful audio data, of course.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Here are some real time audio frameworks that might be of interest to you:

https://github.com/thestk/rtaudio

http://www.portaudio.com/

And a synthesis library I just found: http://maximilian.strangeloop.co.uk/

I've given RTAudio a test run, and they have an example that sets up a audio stream callback, and generates a saw wave. This sounds like something you're looking for, and it's very straight forward to setup. Also is crossplatform.

This topic is closed to new replies.

Advertisement