diff --git a/include/SparkyStudios/Audio/Amplitude/Core/Log.h b/include/SparkyStudios/Audio/Amplitude/Core/Log.h index 504fed4..e75d33c 100644 --- a/include/SparkyStudios/Audio/Amplitude/Core/Log.h +++ b/include/SparkyStudios/Audio/Amplitude/Core/Log.h @@ -93,6 +93,16 @@ */ #define amLogCritical(_message_, ...) amLog(Critical, _message_, ##__VA_ARGS__) +/** + * @brief Logs a success message. + * + * @param _message_ The message to log. + * @param ... The arguments to format the message with. + * + * @ingroup core + */ +#define amLogSuccess(_message_,...) amLog(Success, _message_, ##__VA_ARGS__) + namespace SparkyStudios::Audio::Amplitude { /** @@ -109,6 +119,7 @@ namespace SparkyStudios::Audio::Amplitude eLogMessageLevel_Warning = 2, ///< Warning messages. eLogMessageLevel_Error = 3, ///< Error messages. eLogMessageLevel_Critical = 4, ///< Critical messages. + eLogMessageLevel_Success = 5, ///< Success messages. }; /** @@ -186,6 +197,15 @@ namespace SparkyStudios::Audio::Amplitude */ void Critical(const char* file, int line, const AmString& message); + /** + * @brief Logs a success message. + * + * @param[in] file The file where the message was logged. + * @param[in] line The line where the message was logged. + * @param[in] message The message to log. + */ + void Success(const char* file, int line, const AmString& message); + protected: /** * @brief Logs a message with the given level. diff --git a/src/Core/Drivers/MiniAudio/Driver.cpp b/src/Core/Drivers/MiniAudio/Driver.cpp index 04db69e..d4a6eed 100644 --- a/src/Core/Drivers/MiniAudio/Driver.cpp +++ b/src/Core/Drivers/MiniAudio/Driver.cpp @@ -66,7 +66,7 @@ namespace SparkyStudios::Audio::Amplitude { AM_UNUSED(pInput); - auto* driver = static_cast(pDevice->pUserData); + const auto* driver = static_cast(pDevice->pUserData); AudioBuffer* pOutputBuffer = nullptr; frameCount = amEngine->GetMixer()->Mix(&pOutputBuffer, frameCount); diff --git a/src/Core/Log.cpp b/src/Core/Log.cpp index bb1acc4..20e2926 100644 --- a/src/Core/Log.cpp +++ b/src/Core/Log.cpp @@ -57,6 +57,11 @@ namespace SparkyStudios::Audio::Amplitude Log(eLogMessageLevel_Critical, file, line, message); } + void Logger::Success(const char* file, int line, const AmString& message) + { + Log(eLogMessageLevel_Success, file, line, message); + } + ConsoleLogger::ConsoleLogger(bool displayFileAndLine) : m_displayFileAndLine(displayFileAndLine) {} @@ -80,6 +85,9 @@ namespace SparkyStudios::Audio::Amplitude case eLogMessageLevel_Critical: std::cout << "[CRITICAL] "; break; + case eLogMessageLevel_Success: + std::cout << "[SUCCESS] "; + break; } if (m_displayFileAndLine)