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

player initialization params, voice groups, filters for single sounds. #105

Merged
merged 7 commits into from
Jul 22, 2024

Conversation

alnitak
Copy link
Owner

@alnitak alnitak commented Jul 15, 2024

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

/// [time] the fade slope duration.
/// Returns [PlayerErrors.noError] if no errors.
@mustBeOverridden
PlayerErrors fadeFilterParameter(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods now accept also the SoundHandle or the SoundHash. These parameters are needed by the callers from AudioSource when managing filters. When called from class SoLoud these parameters are not needed because the filters are managed globally (for all the sounds).
In short, AudioSource manages filters for single sounds/voices and SoLoud class global filters.

@alnitak alnitak marked this pull request as ready for review July 15, 2024 09:21
@alnitak alnitak requested a review from filiph July 15, 2024 09:21
@alnitak alnitak changed the title CHANGELOG, README update player initialization params, voice groups, filters for single sounds. Jul 15, 2024
@filiph
Copy link
Collaborator

filiph commented Jul 15, 2024

Should this be merging into web?

@alnitak
Copy link
Owner Author

alnitak commented Jul 15, 2024

Should this be merging into web?

Fixed! Sorry :)

@alnitak alnitak changed the base branch from web to main July 15, 2024 09:54
@sbauly
Copy link

sbauly commented Jul 22, 2024

Hi @alnitak, this PR looks very exciting! Regarding support for non-global filters, will we also be able to apply filters to voice groups? I imagine that may be useful in the case of wanting to apply a filter to all sounds apart from one or two. For example, a game might have a Freeverb filter for all in-game sounds, but not for the menu sfx.

Also, I'm not sure it's possible, but would the filters be able to behave similarly to buses/sends? This would probably be the most ideal way of using filters, as very few instances would be needed whilst still offering flexibility for different use cases. It would be useful to have a Freeverb send that SoundHandles could be sent to in varying amounts of wetness, for example.

@alnitak
Copy link
Owner Author

alnitak commented Jul 22, 2024

Hi @sbauly, thanks for the interest.

will we also be able to apply filters to voice groups?

I don't think it is somehow feasible. In the groups laid different voice handles that may belong to different AudioSources.
A filter (or more than one) can be added only to an AudioSource (not to voice handles it owns) and all its handles are affected. Although you can set different filter parameters for each handle of an AudioSource.
So I suppose this logic should be made outside the plugin.

Also, I'm not sure it's possible, but would the filters be able to behave similarly to buses/sends? This would probably be the most ideal way of using filters, as very few instances would be needed whilst still offering flexibility for different use cases. It would be useful to have a Freeverb send that SoundHandles could be sent to in varying amounts of wetness, for example.

Don't know if I understand correctly, but maybe I answered above to this. Anyway, this is the logic:

AudioSource source = loadFile(...);
source.addFilter(Freeverb);
SoundHandle handle1 = play(source);
SoundHandle handle2 = play(source);

/// now you are able to set parameters to handles
source.setFilterParameter(handle1, Freeverb.wet, 0);
source.setFilterParameter(handle2, Freeverb.wet, 1);

I hope I have been clear and helpful

Copy link
Collaborator

@filiph filiph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking this long. I'm really glad we're adding voice groups and per-voice filters! This basically completes the exposure of SoLoud C++ features needed for serious game development, as far as I'm concerned.

I read through the whole deal but I have to say I only skimmed through some parts (especially the bindings and the C++ files). I wish I had more time but I'm in full summer mode these past two weeks.

As far as I'm concerned, this is good to go. But as always, I'd love to have more eyes on this if possible.

example/tests/tests.dart Outdated Show resolved Hide resolved
example/tests/tests.dart Show resolved Hide resolved
example/tests/tests.dart Outdated Show resolved Hide resolved
example/tests/tests.dart Outdated Show resolved Hide resolved
lib/src/audio_source.dart Outdated Show resolved Hide resolved
lib/src/enums.dart Show resolved Hide resolved
lib/src/soloud.dart Show resolved Hide resolved
lib/src/soloud.dart Show resolved Hide resolved
lib/src/sound_handle.dart Show resolved Hide resolved
src/bindings.cpp Outdated Show resolved Hide resolved
@alnitak alnitak merged commit a5a34ac into main Jul 22, 2024
1 check passed
@alnitak alnitak deleted the feats branch July 22, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants