Skip to content

Conversation

@MatusGuy
Copy link
Contributor

@MatusGuy MatusGuy commented Dec 7, 2025

This is a rewrite of the mixer to a better more versatile audio backend (miniaudio) that also adds new features.

@MatusGuy MatusGuy requested a review from swagtoy December 7, 2025 12:59
@MatusGuy MatusGuy self-assigned this Dec 7, 2025
Copy link
Member

@swagtoy swagtoy left a comment

Choose a reason for hiding this comment

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

Seems good; some requests

if (result != MA_SUCCESS)
{
Logger::error("Mixer", "Oops! ded.");
std::exit(-1);
Copy link
Member

Choose a reason for hiding this comment

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

Nein :) for now throw an exception, but try to handle it instead of panicking, we want the game to keep running but display an error

#define SUPERTUX_SRC_AUDIO_MUSIC_DATA_HPP

#include <string>

Copy link
Member

Choose a reason for hiding this comment

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

spacing


}

MusicData MusicReader::open(const std::string& filename)
Copy link
Member

Choose a reason for hiding this comment

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

Check for errors, compare int-max and negative values. I should probably add better functions to the parser for that..

Copy link
Member

Choose a reason for hiding this comment

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

also put return type on separate line

std::string join(const std::string &a, const std::string& b)
{
return a + "/" + b;
}
Copy link
Member

Choose a reason for hiding this comment

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

Sure..... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what was being done for FS::path, so...

Copy link
Member

Choose a reason for hiding this comment

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

message(STATUS "NOT using SDL3 Mixer...")
endif (NEOTUX_USE_MIXER)
if (PSP)
message(STATUS "Building PSP version...")
Copy link
Member

Choose a reason for hiding this comment

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

when merging, try to rebase, I moved this stuff now to psp.cmake

@@ -1,5 +1,4 @@
#cmakedefine NEOTUX_BGFX
#cmakedefine NEOTUX_USE_MIXER
Copy link
Member

Choose a reason for hiding this comment

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

No go

Copy link
Member

Choose a reason for hiding this comment

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

I made a comment explicity saying not to remove this bit but I mustve forgot to submit it; please add this logic back though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic can be emulated by using the Null miniaudio backend.

@swagtoy
Copy link
Member

swagtoy commented Dec 7, 2025

I think for now you should abstract the audio backend and select it at compile time in case we want to try something else one day. Have generic headers in src/audio and audio.hpp, then have src/audio/miniaudio implement. I dont want to hard depend on miniaudio so we can roll our own audio dummy too (i.e miniaudio has compile issues on some machine, or user is lazy)

well have to stop globbing, or we can glob all but the audio folder in cmake

@swagtoy
Copy link
Member

swagtoy commented Dec 7, 2025

we can also maybe use a namepace and just use a global with static stuff instead. That way no need for pimpl

std::runtime_error(std::format("{} (ma error: {})", what, result))
{}

struct Mixer::Impl
Copy link
Member

@swagtoy swagtoy Dec 8, 2025

Choose a reason for hiding this comment

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

See my other comment. We can abstract it all at compile time...

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.

3 participants