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

Remove repeating code to fetch audio data #4103

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

netmindz
Copy link
Collaborator

Remove pointless code duplication

@blazoncek
Copy link
Collaborator

This optimisation is great, however..

Instead of modifying usermod manager with a single usermod extension it would be much better IMO to add a static function in FX.cpp to work arround the underlying issue.

I.e..

static um_data_t *getAudioData() {
  um_data_t *um_data;
  if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
    // add support for no audio
    um_data = simulateSound(SEGMENT.soundSim);
  }
  return um_data;
}

@netmindz
Copy link
Collaborator Author

Updated to suggested form, I was going to add to utils.cpp at first, the top of FX.cpp makes more sense though

This version is also more performant than when I moved to the UserModManager so definitely good suggestion @blazoncek

@blazoncek blazoncek merged commit 8688777 into Aircoookie:0_15 Aug 16, 2024
18 checks passed
@netmindz netmindz deleted the FX-cleanup branch August 16, 2024 16:30
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