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 some prefabricated sound effects #1590

Open
SiegeLord opened this issue Nov 4, 2024 · 9 comments
Open

Add some prefabricated sound effects #1590

SiegeLord opened this issue Nov 4, 2024 · 9 comments

Comments

@SiegeLord
Copy link
Member

SiegeLord commented Nov 4, 2024

The mixer has al_set_mixer_postprocess_callback function. We should provide a bunch of pre-made effects. An API could be:

ALLEGRO_DELAY_AUDIO_EFFECT *al_create_delay_audio_effect(delay_secs, channel_conf, channel_depth, frequency);
pp_callback_t al_get_audio_effect_callback(ALLEGRO_DELAY_EFFECT *effect);
al_destroy_audio_effect(ALLEGRO_DELAY_EFFECT *effect);

And then you use it as:

auto effect = al_create_delay_audio_effect(0.5, al_get_mixer_channels(mixer), al_get_mixer_depth(mixer), al_get_mixer_frequency(mixer));
al_set_mixer_postprocess_callback(mixer, al_get_audio_effect_callback(effect), effect);
@SiegeLord
Copy link
Member Author

See https://www.fmod.com/docs/2.00/api/effects-reference.html for some inspiration.

@MarkOates
Copy link
Contributor

Ooh ✨. This would be nice, but I feel like this is getting into game/asset content and engine design. Right now we have a builtin font and that's it. No sine wave generators, texture generators, shader effects off-the-shelf, or things like this.

It would be great to have as a sort-of standardized implementation, or an open source implementation that can be referenced somewhere and works with Allegro. (It would actually be amazing to start some kind of resource like this), but I'm not sure it should go in core?

@SiegeLord
Copy link
Member Author

Also, this should plug in nicely into the simple subset of the audio API, which does not expose mixers directly. This part can be figured out later.

@SiegeLord
Copy link
Member Author

SiegeLord commented Nov 4, 2024

shader effects off-the-shelf

I have wanted something like this too, but I don't know how to come up with an API for this, since many real effects require multiple passes. Unlike the audio effects here, it'd be very complicated.

@MarkOates
Copy link
Contributor

MarkOates commented Nov 4, 2024

Shader effects are also dependent on the vertex format too. A lot of 3D effects are dependent on having a normal, which isn't present in any standard implementation in Allegro. I have this ALLEGRO_VERTEX_WITH_NORMAL I use for a lot of stuff.

@MarkOates
Copy link
Contributor

I do really like the idea of the "Allegro product" somehow providing another layer of features, candy if you will, that can work out of the box. For example, some standard effects like audio reverb, delay... some shaders like flat color (not tint) or gradients or wobbles. Clarifying some path forward for these things could be good.

Is there an implementation somewhere ... omg I just realized I actually do have an implementation for delay.... hahah!

include/AllegroFlare/AudioProcessing/Filters/Delay.hpp
src/AllegroFlare/AudioProcessing/Filters/Delay.cpp
tests/AllegroFlare/AudioProcessing/Filters/DelayTest.cpp

@SiegeLord
Copy link
Member Author

Well, if we're upset about adding non-minimal features (I will invite those upset to take a look at Allegro 4's API), there's always the option to add it to the contrib directory in Allegro's source, or make a wiki article.

@githubgavin1337
Copy link

githubgavin1337 commented Dec 21, 2024

If Allegro already supports OpenAL by default, and OpenAL already has some effects built in, could we have some kind of simplified access to those effects through the Allegro API? Also, could those effects be implemented into the SoundFont player in a way that you could have, let's say, custom levels of reverb on different instruments on each music track?

@SiegeLord
Copy link
Member Author

That could be done for OpenAL, but OpenAL is not a commonly enabled dependency: none of the pre-built binaries have it.

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

No branches or pull requests

3 participants