minor fixes

This commit is contained in:
Nomango 2019-08-23 13:22:21 +08:00
parent a5fe64fa2c
commit 84ede8af45
2 changed files with 14 additions and 7 deletions

View File

@ -65,8 +65,7 @@ namespace kiwano
Close(); Close();
} }
Transcoder transcoder; HRESULT hr = transcoder_.LoadMediaFile(file_path);
HRESULT hr = transcoder.LoadMediaFile(file_path);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -74,7 +73,7 @@ namespace kiwano
return false; return false;
} }
hr = Audio::GetInstance()->CreateVoice(&voice_, transcoder.GetBuffer().format); hr = Audio::GetInstance()->CreateVoice(&voice_, transcoder_.GetBuffer().format);
if (FAILED(hr)) if (FAILED(hr))
{ {
Close(); Close();
@ -94,8 +93,7 @@ namespace kiwano
Close(); Close();
} }
Transcoder transcoder; HRESULT hr = transcoder_.LoadMediaResource(res);
HRESULT hr = transcoder.LoadMediaResource(res);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -103,7 +101,7 @@ namespace kiwano
return false; return false;
} }
hr = Audio::GetInstance()->CreateVoice(&voice_, transcoder.GetBuffer().format); hr = Audio::GetInstance()->CreateVoice(&voice_, transcoder_.GetBuffer().format);
if (FAILED(hr)) if (FAILED(hr))
{ {
Close(); Close();

View File

@ -127,7 +127,16 @@ namespace kiwano
} }
debug_text_->SetText(ss.str()); debug_text_->SetText(ss.str());
SetSize(Size{ 20 + debug_text_->GetSize().x, 20 + debug_text_->GetSize().y });
if (debug_text_->GetWidth() > GetWidth() - 20)
{
SetWidth(20 + debug_text_->GetWidth());
}
if (debug_text_->GetHeight() > GetHeight() - 20)
{
SetHeight(20 + debug_text_->GetHeight());
}
} }
} }