Some changes to the startup logging.

Also removed some unnecessary audio code.
This commit is contained in:
Leon Styhre 2020-12-23 17:56:21 +01:00
parent f7c33ecd26
commit a27c961987
4 changed files with 12 additions and 20 deletions

View file

@ -592,7 +592,7 @@ int main(int argc, char* argv[])
int ps_time = SDL_GetTicks(); int ps_time = SDL_GetTicks();
const auto applicationEndTime = std::chrono::system_clock::now(); const auto applicationEndTime = std::chrono::system_clock::now();
LOG(LogDebug) << "Application startup time: " << LOG(LogInfo) << "Application startup time: " <<
std::chrono::duration_cast<std::chrono::milliseconds> std::chrono::duration_cast<std::chrono::milliseconds>
(applicationEndTime - applicationStartTime).count() << " ms"; (applicationEndTime - applicationStartTime).count() << " ms";

View file

@ -77,8 +77,7 @@ void ViewController::goToStart()
// configuration has been performed. // configuration has been performed.
if (InputManager::getInstance()-> if (InputManager::getInstance()->
getInputConfigByDevice(DEVICE_KEYBOARD)->getDefaultConfigFlag()) { getInputConfigByDevice(DEVICE_KEYBOARD)->getDefaultConfigFlag()) {
LOG(LogInfo) << "Applying default keyboard mappings";
LOG(LogInfo) << "Applying default keyboard mappings.";
if (Settings::getInstance()->getBool("ShowDefaultKeyboardWarning")) { if (Settings::getInstance()->getBool("ShowDefaultKeyboardWarning")) {
std::string message = "NO KEYBOARD CONFIGURATION COULD BE\n" std::string message = "NO KEYBOARD CONFIGURATION COULD BE\n"

View file

@ -48,11 +48,7 @@ void AudioManager::init()
return; return;
} }
// Stop playing all Sounds. LOG(LogInfo) << "Audio driver: " << SDL_GetCurrentAudioDriver();
for (unsigned int i = 0; i < sSoundVector.size(); i++) {
if (sSoundVector.at(i)->isPlaying())
sSoundVector[i]->stop();
}
SDL_AudioSpec sRequestedAudioFormat; SDL_AudioSpec sRequestedAudioFormat;
@ -70,32 +66,31 @@ void AudioManager::init()
sRequestedAudioFormat.callback = mixAudio; sRequestedAudioFormat.callback = mixAudio;
sRequestedAudioFormat.userdata = nullptr; sRequestedAudioFormat.userdata = nullptr;
for (unsigned int i = 0; i < SDL_GetNumAudioDevices(0); i++) { for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) {
LOG(LogDebug) << "Detected playback device '" << SDL_GetAudioDeviceName(i, 0) << "'."; LOG(LogInfo) << "Detected playback device: " << SDL_GetAudioDeviceName(i, 0);
} }
sAudioDevice = SDL_OpenAudioDevice(0, 0, &sRequestedAudioFormat, &sAudioFormat, sAudioDevice = SDL_OpenAudioDevice(0, 0, &sRequestedAudioFormat, &sAudioFormat,
SDL_AUDIO_ALLOW_ANY_CHANGE); SDL_AUDIO_ALLOW_ANY_CHANGE);
if (sAudioDevice == 0) { if (sAudioDevice == 0) {
LOG(LogError) << "Unable to open audio device: " << SDL_GetError() << std::endl; LOG(LogError) << "Unable to open audio device: " << SDL_GetError();
return;
} }
if (sAudioFormat.freq != sRequestedAudioFormat.freq) { 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 " 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) { if (sAudioFormat.format != sRequestedAudioFormat.format) {
LOG(LogDebug) << "AudioManager::init(): Requested format " << LOG(LogDebug) << "AudioManager::init(): Requested format " <<
std::to_string(sRequestedAudioFormat.format) << " could not be " 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) { if (sAudioFormat.channels != sRequestedAudioFormat.channels) {
LOG(LogDebug) << "AudioManager::init(): Requested channel count " << LOG(LogDebug) << "AudioManager::init(): Requested channel count " <<
std::to_string(sRequestedAudioFormat.channels) << " could not be " 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__) #if defined(_WIN64) || defined(__APPLE__)
// Beats me why the buffer size is not divided by the channel count on some operating systems. // 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 #endif
LOG(LogDebug) << "AudioManager::init(): Requested sample buffer size " << LOG(LogDebug) << "AudioManager::init(): Requested sample buffer size " <<
std::to_string(sRequestedAudioFormat.samples / sRequestedAudioFormat.channels) << 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. // Just in case someone changed the es_settings.cfg file manually to invalid values.
@ -129,8 +124,6 @@ void AudioManager::init()
void AudioManager::deinit() void AudioManager::deinit()
{ {
// Stop all playback.
stop();
SDL_FreeAudioStream(sConversionStream); SDL_FreeAudioStream(sConversionStream);
SDL_CloseAudio(); SDL_CloseAudio();
SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_QuitSubSystem(SDL_INIT_AUDIO);

View file

@ -336,7 +336,7 @@ bool InputManager::loadInputConfig(InputConfig* config)
if (!Utils::FileSystem::exists(path)) { if (!Utils::FileSystem::exists(path)) {
if (config->getDeviceName() == "Keyboard") { if (config->getDeviceName() == "Keyboard") {
LOG(LogDebug) << "InputManager::loadInputConfig(): Assigning default 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(); loadDefaultKBConfig();
config->setDefaultConfigFlag(); config->setDefaultConfigFlag();
} }