From: <man...@us...> - 2015-02-20 11:33:20
|
Revision: 4774 http://sourceforge.net/p/modplug/code/4774 Author: manxorist Date: 2015-02-20 11:33:14 +0000 (Fri, 20 Feb 2015) Log Message: ----------- [Ref] sounddev: Add log level to SoundDevice::IMessageReceiver. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Reporting.cpp trunk/OpenMPT/mptrack/Reporting.h trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2015-02-20 11:33:14 UTC (rev 4774) @@ -630,11 +630,11 @@ } -void CMainFrame::AudioMessage(const mpt::ustring &str) -//---------------------------------------------------- +void CMainFrame::SoundDeviceMessage(LogLevel level, const mpt::ustring &str) +//-------------------------------------------------------------------------- { MPT_TRACE(); - Reporting::Notification(str); + Reporting::Message(level, str); } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2015-02-20 11:33:14 UTC (rev 4774) @@ -401,7 +401,7 @@ void AudioDone(const SoundDevice::Settings &settings, const SoundDevice::Flags &flags, const SoundDevice::BufferAttributes &bufferAttributes, SoundDevice::TimeInfo timeInfo, std::size_t numFrames, int64 streamPosition); // from SoundDevice::IMessageReceiver - void AudioMessage(const mpt::ustring &str); + void SoundDeviceMessage(LogLevel level, const mpt::ustring &str); bool InGuiThread() const { return theApp.InGuiThread(); } bool InAudioThread() const { return GetCurrentThreadId() == m_AudioThreadId; } Modified: trunk/OpenMPT/mptrack/Reporting.cpp =================================================================== --- trunk/OpenMPT/mptrack/Reporting.cpp 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/mptrack/Reporting.cpp 2015-02-20 11:33:14 UTC (rev 4774) @@ -149,6 +149,18 @@ } +void Reporting::Message(LogLevel level, const AnyStringLocale &text, const CWnd *parent) +//-------------------------------------------------------------------------------------- +{ + ShowNotificationImpl(mpt::ToWide(text), FillEmptyCaption(std::wstring(), level), LogLevelToFlags(level), parent); +} +void Reporting::Message(LogLevel level, const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent) +//---------------------------------------------------------------------------------------------------------------------- +{ + ShowNotificationImpl(mpt::ToWide(text), FillEmptyCaption(mpt::ToWide(caption), level), LogLevelToFlags(level), parent); +} + + ConfirmAnswer Reporting::Confirm(const AnyStringLocale &text, bool showCancel, bool defaultNo, const CWnd *parent) //---------------------------------------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Reporting.h =================================================================== --- trunk/OpenMPT/mptrack/Reporting.h 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/mptrack/Reporting.h 2015-02-20 11:33:14 UTC (rev 4774) @@ -55,6 +55,10 @@ static void Error(const AnyStringLocale &text, const CWnd *parent = nullptr); static void Error(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr); + // Simplified version of the above + static void Message(LogLevel level, const AnyStringLocale &text, const CWnd *parent = nullptr); + static void Message(LogLevel level, const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr); + // Show a confirmation dialog. static ConfirmAnswer Confirm(const AnyStringLocale &text, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr); static ConfirmAnswer Confirm(const AnyStringLocale &text, const AnyStringLocale &caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr); Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2015-02-20 11:33:14 UTC (rev 4774) @@ -315,13 +315,14 @@ } -void Base::AudioSendMessage(const mpt::ustring &str) -//-------------------------------------------------- +void Base::SendDeviceMessage(LogLevel level, const mpt::ustring &str) +//------------------------------------------------------------------- { MPT_TRACE(); + Log(level, str); if(m_MessageReceiver) { - m_MessageReceiver->AudioMessage(str); + m_MessageReceiver->SoundDeviceMessage(level, str); } } Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2015-02-20 11:33:14 UTC (rev 4774) @@ -42,7 +42,7 @@ //==================== { public: - virtual void AudioMessage(const mpt::ustring &str) = 0; + virtual void SoundDeviceMessage(LogLevel level, const mpt::ustring &str) = 0; }; @@ -597,7 +597,7 @@ void RequestReset() { m_RequestFlags.fetch_or(RequestFlagReset); } void RequestRestart() { m_RequestFlags.fetch_or(RequestFlagRestart); } - void AudioSendMessage(const mpt::ustring &str); + void SendDeviceMessage(LogLevel level, const mpt::ustring &str); protected: Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-02-19 14:14:09 UTC (rev 4773) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-02-20 11:33:14 UTC (rev 4774) @@ -1362,8 +1362,7 @@ //----------------------------------------------------------- { MPT_TRACE(); - AudioSendMessage(mpt::ToUnicode(mpt::CharsetLocale, str)); - Log("%s", str.c_str()); + SendDeviceMessage(LogError, mpt::ToUnicode(mpt::CharsetLocale, str)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |