From a27c961987adc4be8b209a297940f18d1e2e2219 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 23 Dec 2020 17:56:21 +0100 Subject: [PATCH] Some changes to the startup logging. Also removed some unnecessary audio code. --- es-app/src/main.cpp | 2 +- es-app/src/views/ViewController.cpp | 3 +-- es-core/src/AudioManager.cpp | 25 +++++++++---------------- es-core/src/InputManager.cpp | 2 +- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 7cb498d22..1c96ec358 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -592,7 +592,7 @@ int main(int argc, char* argv[]) int ps_time = SDL_GetTicks(); const auto applicationEndTime = std::chrono::system_clock::now(); - LOG(LogDebug) << "Application startup time: " << + LOG(LogInfo) << "Application startup time: " << std::chrono::duration_cast (applicationEndTime - applicationStartTime).count() << " ms"; diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 56ca29309..f7c492a8f 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -77,8 +77,7 @@ void ViewController::goToStart() // configuration has been performed. if (InputManager::getInstance()-> getInputConfigByDevice(DEVICE_KEYBOARD)->getDefaultConfigFlag()) { - - LOG(LogInfo) << "Applying default keyboard mappings."; + LOG(LogInfo) << "Applying default keyboard mappings"; if (Settings::getInstance()->getBool("ShowDefaultKeyboardWarning")) { std::string message = "NO KEYBOARD CONFIGURATION COULD BE\n" diff --git a/es-core/src/AudioManager.cpp b/es-core/src/AudioManager.cpp index 49bcd29d0..8c83c7a6a 100644 --- a/es-core/src/AudioManager.cpp +++ b/es-core/src/AudioManager.cpp @@ -48,11 +48,7 @@ void AudioManager::init() return; } - // Stop playing all Sounds. - for (unsigned int i = 0; i < sSoundVector.size(); i++) { - if (sSoundVector.at(i)->isPlaying()) - sSoundVector[i]->stop(); - } + LOG(LogInfo) << "Audio driver: " << SDL_GetCurrentAudioDriver(); SDL_AudioSpec sRequestedAudioFormat; @@ -70,32 +66,31 @@ void AudioManager::init() sRequestedAudioFormat.callback = mixAudio; sRequestedAudioFormat.userdata = nullptr; - for (unsigned int i = 0; i < SDL_GetNumAudioDevices(0); i++) { - LOG(LogDebug) << "Detected playback device '" << SDL_GetAudioDeviceName(i, 0) << "'."; + for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) { + LOG(LogInfo) << "Detected playback device: " << SDL_GetAudioDeviceName(i, 0); } sAudioDevice = SDL_OpenAudioDevice(0, 0, &sRequestedAudioFormat, &sAudioFormat, SDL_AUDIO_ALLOW_ANY_CHANGE); if (sAudioDevice == 0) { - LOG(LogError) << "Unable to open audio device: " << SDL_GetError() << std::endl; - return; + LOG(LogError) << "Unable to open audio device: " << SDL_GetError(); } if (sAudioFormat.freq != sRequestedAudioFormat.freq) { - LOG(LogDebug) << "AudioManager::init(): Requested sampling rate " << + LOG(LogDebug) << "AudioManager::init(): Requested sample rate " << std::to_string(sRequestedAudioFormat.freq) << " could not be " - "set, obtained " << std::to_string(sAudioFormat.freq) << "."; + "set, obtained " << std::to_string(sAudioFormat.freq); } if (sAudioFormat.format != sRequestedAudioFormat.format) { LOG(LogDebug) << "AudioManager::init(): Requested format " << std::to_string(sRequestedAudioFormat.format) << " could not be " - "set, obtained " << std::to_string(sAudioFormat.format) << "."; + "set, obtained " << std::to_string(sAudioFormat.format); } if (sAudioFormat.channels != sRequestedAudioFormat.channels) { LOG(LogDebug) << "AudioManager::init(): Requested channel count " << std::to_string(sRequestedAudioFormat.channels) << " could not be " - "set, obtained " << std::to_string(sAudioFormat.channels) << "."; + "set, obtained " << std::to_string(sAudioFormat.channels); } #if defined(_WIN64) || defined(__APPLE__) // Beats me why the buffer size is not divided by the channel count on some operating systems. @@ -105,7 +100,7 @@ void AudioManager::init() #endif LOG(LogDebug) << "AudioManager::init(): Requested sample buffer size " << std::to_string(sRequestedAudioFormat.samples / sRequestedAudioFormat.channels) << - " could not be set, obtained " << std::to_string(sAudioFormat.samples) << "."; + " could not be set, obtained " << std::to_string(sAudioFormat.samples); } // Just in case someone changed the es_settings.cfg file manually to invalid values. @@ -129,8 +124,6 @@ void AudioManager::init() void AudioManager::deinit() { - // Stop all playback. - stop(); SDL_FreeAudioStream(sConversionStream); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 8f230fe5b..7dda7e847 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -336,7 +336,7 @@ bool InputManager::loadInputConfig(InputConfig* config) if (!Utils::FileSystem::exists(path)) { if (config->getDeviceName() == "Keyboard") { LOG(LogDebug) << "InputManager::loadInputConfig(): Assigning default keyboard " - "mappings as there is no es_input.cfg configuration file."; + "mappings as there is no es_input.cfg configuration file"; loadDefaultKBConfig(); config->setDefaultConfigFlag(); }