Audio: Improved error trace when init fails
This commit is contained in:
parent
4495239669
commit
e871a9ce15
2 changed files with 16 additions and 9 deletions
|
@ -33,7 +33,7 @@ std::unordered_map<string, string> MessageManager::_enResources = {
|
|||
{ "ConnectedAsSpectator", u8"Connected as spectator." },
|
||||
{ "ConnectionLost", u8"Connection to server lost." },
|
||||
{ "CouldNotConnect", u8"Could not connect to the server." },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"Could not initialize audio system" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"Could not initialize audio system" },
|
||||
{ "CouldNotFindRom", u8"Could not find matching game ROM." },
|
||||
{ "CouldNotLoadFile", u8"Could not load file: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Maximum speed" },
|
||||
|
@ -108,7 +108,7 @@ std::unordered_map<string, string> MessageManager::_frResources = {
|
|||
{ "ConnectedAsSpectator", u8"Connecté en tant que spectateur." },
|
||||
{ "ConnectionLost", u8"La connexion avec le serveur a été perdue." },
|
||||
{ "CouldNotConnect", u8"Impossible de se connecter au serveur." },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"L'initialisation du système de son à échoué" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"L'initialisation du système de son à échoué" },
|
||||
{ "CouldNotFindRom", u8"Impossible de trouvé un rom correspondant." },
|
||||
{ "CouldNotLoadFile", u8"Impossible de charger le fichier : %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Vitesse maximale" },
|
||||
|
@ -183,7 +183,7 @@ std::unordered_map<string, string> MessageManager::_jaResources = {
|
|||
{ "ConnectedAsSpectator", u8"観客として接続しました。" },
|
||||
{ "ConnectionLost", u8"サーバから切断されました。" },
|
||||
{ "CouldNotConnect", u8"サーバに接続出来ませんでした。" },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"オーディオデバイスを初期化出来ませんでした。" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"オーディオデバイスを初期化出来ませんでした。" },
|
||||
{ "CouldNotFindRom", u8"該当するゲームファイルは見つかりませんでした。" },
|
||||
{ "CouldNotLoadFile", u8"ファイルをロードできませんでした: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"最高速度" },
|
||||
|
@ -258,7 +258,7 @@ std::unordered_map<string, string> MessageManager::_ruResources = {
|
|||
{ "ConnectedAsSpectator", u8"Подключен как наблюдатель." },
|
||||
{ "ConnectionLost", u8"Соединение потеряно." },
|
||||
{ "CouldNotConnect", u8"Не удалось подключиться к серверу" },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"Не удалось инициализировать звуковую подсистему" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"Не удалось инициализировать звуковую подсистему" },
|
||||
{ "CouldNotFindRom", u8"Не удалось найти подходящий ROM." },
|
||||
{ "CouldNotLoadFile", u8"Не удалось загрузить файл: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Максимальная скорость" },
|
||||
|
@ -333,7 +333,7 @@ std::unordered_map<string, string> MessageManager::_esResources = {
|
|||
{ "ConnectedAsSpectator", u8"Conectado como espectador." },
|
||||
{ "ConnectionLost", u8"Conexión con el servidor perdida." },
|
||||
{ "CouldNotConnect", u8"No se puede conectar con el servidor." },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"No se puede iniciar el sistema de sonido" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"No se puede iniciar el sistema de sonido" },
|
||||
{ "CouldNotFindRom", u8"No se ha podido encontrar la ROM buscada." },
|
||||
{ "CouldNotLoadFile", u8"No se puede cargar el archivo: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Velocidad Máxima" },
|
||||
|
@ -409,7 +409,7 @@ std::unordered_map<string, string> MessageManager::_ukResources = {
|
|||
{ "ConnectedAsSpectator", u8"Підключений як спостерігач." },
|
||||
{ "ConnectionLost", u8"З'єднання втрачено." },
|
||||
{ "CouldNotConnect", u8"Не вдалося підключитися до сервера" },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"Не вдалося ініціалізувати звукову підсистему" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"Не вдалося ініціалізувати звукову підсистему" },
|
||||
{ "CouldNotFindRom", u8"Не вдалося знайти відповідний ROM." },
|
||||
{ "CouldNotLoadFile", u8"Не вдалося завантажити файл: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Максимальна швидкiсть" },
|
||||
|
@ -484,7 +484,7 @@ std::unordered_map<string, string> MessageManager::_ptResources = {
|
|||
{ "ConnectedAsSpectator", u8"Conectado como espectador." },
|
||||
{ "ConnectionLost", u8"Conexão com o servidor perdida." },
|
||||
{ "CouldNotConnect", u8"Não foi possível conectar ao servidor." },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"Não foi possível iniciar o sistema de som" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"Não foi possível iniciar o sistema de som" },
|
||||
{ "CouldNotFindRom", u8"Não foi possível encontrar a ROM procurada." },
|
||||
{ "CouldNotLoadFile", u8"Não foi possível carregar o arquivo: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Velocidade Máxima" },
|
||||
|
@ -559,7 +559,7 @@ std::unordered_map<string, string> MessageManager::_caResources = {
|
|||
{ "ConnectedAsSpectator", u8"Connectat com a espectador." },
|
||||
{ "ConnectionLost", u8"S'ha perdut la connexió amb el servidor." },
|
||||
{ "CouldNotConnect", u8"No s'ha pogut connectar amb el servidor." },
|
||||
{ "CouldNotIniitalizeAudioSystem", u8"No s'ha pogut inicialitzar el sistema de so" },
|
||||
{ "CouldNotInitializeAudioSystem", u8"No s'ha pogut inicialitzar el sistema de so" },
|
||||
{ "CouldNotFindRom", u8"Incapaç de trobar una ROM corresponent." },
|
||||
{ "CouldNotLoadFile", u8"Incapaç de carregar el fitxer: %1" },
|
||||
{ "EmulationMaximumSpeed", u8"Velocitat màxima" },
|
||||
|
|
|
@ -15,7 +15,7 @@ SoundManager::SoundManager(HWND hwnd)
|
|||
if(InitializeDirectSound(44100, false)) {
|
||||
SoundMixer::RegisterAudioDevice(this);
|
||||
} else {
|
||||
MessageManager::DisplayMessage("Error", "Could not initialize audio system");
|
||||
MessageManager::DisplayMessage("Error", "CouldNotInitializeAudioSystem");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,12 +78,14 @@ bool SoundManager::InitializeDirectSound(uint32_t sampleRate, bool isStereo)
|
|||
// Initialize the direct sound interface pointer for the default sound device.
|
||||
result = DirectSoundCreate8(&_audioDeviceID, &_directSound, NULL);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to create direct sound device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the cooperative level to priority so the format of the primary sound buffer can be modified.
|
||||
result = _directSound->SetCooperativeLevel(_hWnd, DSSCL_PRIORITY);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to set cooperative level.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -98,6 +100,7 @@ bool SoundManager::InitializeDirectSound(uint32_t sampleRate, bool isStereo)
|
|||
// Get control of the primary sound buffer on the default sound device.
|
||||
result = _directSound->CreateSoundBuffer(&bufferDesc, &_primaryBuffer, NULL);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to create primary sound buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -116,6 +119,7 @@ bool SoundManager::InitializeDirectSound(uint32_t sampleRate, bool isStereo)
|
|||
// Set the primary buffer to be the wave format specified.
|
||||
result = _primaryBuffer->SetFormat(&waveFormat);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to set the sound format.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -131,18 +135,21 @@ bool SoundManager::InitializeDirectSound(uint32_t sampleRate, bool isStereo)
|
|||
IDirectSoundBuffer* tempBuffer;
|
||||
result = _directSound->CreateSoundBuffer(&bufferDesc, &tempBuffer, NULL);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to create temporary sound buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Test the buffer format against the direct sound 8 interface and create the secondary buffer.
|
||||
result = tempBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*)&_secondaryBuffer);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to obtain secondary sound buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set volume of the buffer to 100%.
|
||||
result = _secondaryBuffer->SetVolume(DSBVOLUME_MAX);
|
||||
if(FAILED(result)) {
|
||||
MessageManager::Log("[Audio] Failed to set volume of the secondary sound buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue