Skip to content

Refactor Audio Functions to use new parser - #5346

Open
iManGaaX wants to merge 9 commits into
multitheftauto:masterfrom
iManGaaX:refactor/newparser/audio-functions
Open

Refactor Audio Functions to use new parser#5346
iManGaaX wants to merge 9 commits into
multitheftauto:masterfrom
iManGaaX:refactor/newparser/audio-functions

Conversation

@iManGaaX

@iManGaaX iManGaaX commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h Outdated

@FileEX FileEX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A lot of things

@iManGaaX
iManGaaX requested a review from FileEX September 9, 2026 19:12
Comment out audio function bindings for future reference.
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp Outdated
return newData;
}

static bool IsSoundURL(const std::string& soundPath)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

noexcept

bankIndex = *bankValue;
else if (containerIndex == AUDIO_LOOKUP_RADIO)
bankIndex = static_cast<int>(*std::get_if<eRadioStreamIndex>(&bank));
else if (auto* radioIndex = std::get_if<eRadioStreamIndex>(&bank))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

containerIndex == AUDIO_LOOKUP_RADIO and std::get_if

{
using ResultType = std::variant<std::unordered_map<int, float>, bool>;

if (!IsValidFFTBandCount(length, bands.value_or(0)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of repeating bands.value_or(0), define it once in a variable.

fftData = ProcessFFTData(std::move(fftData), length, bands.value_or(0));

const int size = bands.value_or(0) == 0 ? length / 2 : bands.value_or(0) - 1;
std::unordered_map<int, float> data;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

reserve?

if (!waveData)
return ResultType{false};

std::unordered_map<int, float> data;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

reserve?

Comment on lines +16 to +20
#include <array>
#include <cctype>
#include <cmath>
#include <memory>
#include <ranges>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you really need <memory> and <cctype>?

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