inline void mm_try(MMRESULT expr, const char *msg) { if (expr != MMSYSERR_NOERROR) { wchar_t text[1024]; waveOutGetErrorTextW(expr, text, 1024); throw std::runtime_error(strutil::format("WaveOut: %s", strutil::w2us(text).c_str())); } }
bool CWaveDevice::CheckResult(MMRESULT result) //-------------------------------------------- { if(result == MMSYSERR_NOERROR) { return true; } if(!m_Failed) { // only show the first error m_Failed = true; WCHAR errortext[MAXERRORLENGTH + 1]; MemsetZero(errortext); waveOutGetErrorTextW(result, errortext, MAXERRORLENGTH); SendDeviceMessage(LogError, mpt::format(MPT_USTRING("WaveOut error: 0x%1: %2"))(mpt::ufmt::hex0<8>(result), mpt::ToUnicode(errortext))); } RequestClose(); return false; }