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 · 8 comments
Open

Add some prefabricated sound effects #1590

SiegeLord opened this issue Nov 4, 2024 · 8 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 Nov 17, 2024

I fully understand if the core ideology of Allegro is to just have a very basic framework to simplify and streamline the implementation of essential functionality that almost all of even the simplest of video games require, such as rendering graphics on the screen, playing back sound files, monitoring input devices etc, but I still can't deny that the thought of having an optional candy layer of slightly more sophisticated yet still quite ubiquitous capabilites in the form of graphics shaders and real-time sound processing effects wouldn't make me feel all warm and fuzzy inside. I don't think taking small steps towards the game engine territory from being just a bare bones framework would be a bad idea at all, but quite the contrary, actually, as there is a rather big gap between them and fully fledged game engines, and bridging that gap even by just a teeny bit would, in my humble yet noobish opinion, be very beneficial to all parties involved. And, of course, given enough modularity, everyone can tailor their project setup to be just as minimalist as they please in the case they are worried about the core getting bloated.

As a hobbyist composer and sound designer, in addition to a fledgling video game developer and programmer, what I personally would love to see (or hear in this case) from Allegro in this regard the most would be a simple reverb effect. If Allegro 5 uses OpenAL for audio and the latter already has a built-in reverb effect, would it be possible to have some sort of very VERY streamlined and simplified out-of-the-box implementation for it in Allegro so that using it wouldn't require anything more than a simple function call with just the sound file and the reverb parameters as arguments? Or if that is too much overhead, then what about being able to turn the reverb on on an entire mixer channel permanently, or atleast until turned off manually in the code?

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