[DEV] update etk null

This commit is contained in:
Edouard DUPIN 2018-06-19 22:13:48 +02:00
parent 393be4ded5
commit 06b8d5d65e
5 changed files with 30 additions and 30 deletions

View File

@ -37,7 +37,7 @@ audio::ess::LoadedFile::LoadedFile(const etk::String& _fileName, int8_t _nbChanR
#if 1
EWOLSA_INFO("create thread");
m_thread = ememory::makeShared<ethread::Thread>([&](){decode();}, "audioDecoding");
if (m_thread == nullptr) {
if (m_thread == null) {
EWOLSA_ERROR("Can not create thread ...");
return;
}
@ -52,7 +52,7 @@ audio::ess::LoadedFile::LoadedFile(const etk::String& _fileName, int8_t _nbChanR
}
audio::ess::LoadedFile::~LoadedFile() {
if (m_thread != nullptr) {
if (m_thread != null) {
m_thread->join();
}
m_thread.reset();

View File

@ -73,7 +73,7 @@ etk::Vector<float> audio::ess::ogg::loadAudioFile(const etk::String& _filename,
EWOLSA_ERROR("Can not open the file : \"" << *fileAccess << "\"");
return out;
}
if (ov_open_callbacks(&(*fileAccess), &vf, nullptr, 0, tmpCallback) < 0) {
if (ov_open_callbacks(&(*fileAccess), &vf, null, 0, tmpCallback) < 0) {
EWOLSA_ERROR("Input does not appear to be an Ogg bitstream.");
return out;
}

View File

@ -22,7 +22,7 @@ audio::ess::Effects::Effects(const ememory::SharedPtr<audio::river::Manager>& _m
channelMap,
audio::format_float,
"speaker");
if (m_interface == nullptr) {
if (m_interface == null) {
EWOLSA_ERROR("can not allocate output interface ... ");
return;
}
@ -41,7 +41,7 @@ audio::ess::Effects::Effects(const ememory::SharedPtr<audio::river::Manager>& _m
}
audio::ess::Effects::~Effects() {
if (m_interface != nullptr) {
if (m_interface != null) {
m_interface->stop();
}
m_interface.reset();
@ -52,7 +52,7 @@ audio::ess::Effects::~Effects() {
static bool playData(const ememory::SharedPtr<audio::ess::LoadedFile>& _file, int32_t& _position, float* _bufferInterlace, int32_t _nbSample) {
if ( _file == nullptr
if ( _file == null
|| _file->m_data.size() == 0) {
return true;
}
@ -100,7 +100,7 @@ void audio::ess::Effects::onDataNeeded(void* _data,
void audio::ess::Effects::load(const etk::String& _file, const etk::String& _name) {
// load the file:
ememory::SharedPtr<audio::ess::LoadedFile> tmp = ememory::makeShared<audio::ess::LoadedFile>(_file, 2);
if (tmp == nullptr) {
if (tmp == null) {
EWOLSA_ERROR("can not load audio Effects = " << _file);
return;
}
@ -126,7 +126,7 @@ int32_t audio::ess::Effects::getId(const etk::String& _name) {
return iii;
}
}
m_list.pushBack(etk::Pair<etk::String,ememory::SharedPtr<audio::ess::LoadedFile>>(_name,nullptr));
m_list.pushBack(etk::Pair<etk::String,ememory::SharedPtr<audio::ess::LoadedFile>>(_name,null));
EWOLSA_WARNING("Can not find element name : '" << _name << "' added it ... (empty) ");
return m_list.size()-1;
}

View File

@ -34,7 +34,7 @@ void audio::ess::soundSetParse(const etk::String& _data) {
doc.parse(_data);
ejson::Object obj = doc["musics"].toObject();
if ( obj.exist() == true
&& g_music != nullptr) {
&& g_music != null) {
for (auto &it : obj.getKeys()) {
etk::String file = obj[it].toString().get();
EWOLSA_INFO("load Music : '" << it << "' file=" << file);
@ -43,7 +43,7 @@ void audio::ess::soundSetParse(const etk::String& _data) {
}
obj = doc["effects"].toObject();
if ( obj.exist() == true
&& g_effects != nullptr) {
&& g_effects != null) {
for (auto &it : obj.getKeys()) {
etk::String file = obj[it].toString().get();
EWOLSA_INFO("load Effect : '" << it << "' file=" << file);
@ -57,91 +57,91 @@ void audio::ess::soundSetLoad(const etk::String& _file) {
}
void audio::ess::musicPlay(const etk::String& _name) {
if (g_music == nullptr) {
if (g_music == null) {
return;
}
g_music->play(_name);
}
void audio::ess::musicStop() {
if (g_music == nullptr) {
if (g_music == null) {
return;
}
g_music->stop();
}
void audio::ess::musicSetVolume(float _dB) {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return;
}
g_audioManager->setVolume("MUSIC", _dB);
}
float audio::ess::musicGetVolume() {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return 0.0f;
}
return g_audioManager->getVolume("MUSIC");
}
void audio::ess::musicSetMute(bool _mute) {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return;
}
g_audioManager->setMute("MUSIC", _mute);
}
bool audio::ess::musicGetMute() {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return 0.0f;
}
return g_audioManager->getMute("MUSIC");
}
int32_t audio::ess::effectGetId(const etk::String& _name) {
if (g_effects == nullptr) {
if (g_effects == null) {
return -1;
}
return g_effects->getId(_name);
}
void audio::ess::effectPlay(int32_t _id, const vec3& _pos) {
if (g_effects == nullptr) {
if (g_effects == null) {
return;
}
g_effects->play(_id, _pos);
}
void audio::ess::effectPlay(const etk::String& _name, const vec3& _pos) {
if (g_effects == nullptr) {
if (g_effects == null) {
return;
}
g_effects->play(_name, _pos);
}
void audio::ess::effectSetVolume(float _dB) {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return;
}
g_audioManager->setVolume("EFFECT", _dB);
}
float audio::ess::effectGetVolume() {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return 0.0f;
}
return g_audioManager->getVolume("EFFECT");
}
void audio::ess::effectSetMute(bool _mute) {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return;
}
g_audioManager->setMute("EFFECT", _mute);
}
bool audio::ess::effectGetMute() {
if (g_audioManager == nullptr) {
if (g_audioManager == null) {
return 0.0f;
}
return g_audioManager->getMute("EFFECT");

View File

@ -24,7 +24,7 @@ audio::ess::Music::Music(const ememory::SharedPtr<audio::river::Manager>& _manag
channelMap,
audio::format_float,
"speaker");
if (m_interface == nullptr) {
if (m_interface == null) {
EWOLSA_ERROR("can not allocate output interface ... ");
return;
}
@ -43,7 +43,7 @@ audio::ess::Music::Music(const ememory::SharedPtr<audio::river::Manager>& _manag
}
audio::ess::Music::~Music() {
if (m_interface != nullptr) {
if (m_interface != null) {
m_interface->stop();
}
m_interface.reset();
@ -66,11 +66,11 @@ void audio::ess::Music::onDataNeeded(void* _data,
EWOLSA_VERBOSE(" get data Music: "<< _nbChunk);
ethread::UniqueLock lock(m_mutex);
if (m_current != m_next) {
EWOLSA_INFO("change track " << (m_current==nullptr?-1:m_current->getUId()) << " ==> " << (m_next==nullptr?-1:m_next->getUId()));
EWOLSA_INFO("change track " << (m_current==null?-1:m_current->getUId()) << " ==> " << (m_next==null?-1:m_next->getUId()));
m_current = m_next;
m_position = 0;
}
if (m_current == nullptr) {
if (m_current == null) {
// nothing to play ...
return;
}
@ -99,7 +99,7 @@ void audio::ess::Music::load(const etk::String& _file, const etk::String& _name)
return;
}
ememory::SharedPtr<audio::ess::LoadedFile> tmp = ememory::makeShared<audio::ess::LoadedFile>(_file, 2);
if (tmp == nullptr) {
if (tmp == null) {
EWOLSA_ERROR("can not load audio Music = " << _file);
return;
}
@ -117,11 +117,11 @@ void audio::ess::Music::play(const etk::String& _name) {
stop();
ethread::UniqueLock lock(m_mutex);
m_next = it->second;
EWOLSA_INFO("Playing track " << (m_current==nullptr?-1:m_current->getUId()) << " request next : " << m_next->getUId());
EWOLSA_INFO("Playing track " << (m_current==null?-1:m_current->getUId()) << " request next : " << m_next->getUId());
}
void audio::ess::Music::stop() {
if (m_current == nullptr) {
if (m_current == null) {
EWOLSA_INFO("No current audio is playing");
}
ethread::UniqueLock lock(m_mutex);