mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
fix audio initialisation bug when device is not set in config
This commit is contained in:
@@ -33,9 +33,10 @@
|
|||||||
#include "openrct2.h"
|
#include "openrct2.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "ride/ride.h"
|
#include "ride/ride.h"
|
||||||
#include "util/sawyercoding.h"
|
|
||||||
#include "world/mapgen.h"
|
|
||||||
#include "title.h"
|
#include "title.h"
|
||||||
|
#include "util/sawyercoding.h"
|
||||||
|
#include "util/util.h"
|
||||||
|
#include "world/mapgen.h"
|
||||||
|
|
||||||
int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
|
int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
|
||||||
char gOpenRCT2StartupActionPath[512] = { 0 };
|
char gOpenRCT2StartupActionPath[512] = { 0 };
|
||||||
@@ -198,16 +199,19 @@ bool openrct2_initialise()
|
|||||||
|
|
||||||
openrct2_copy_original_user_files_over();
|
openrct2_copy_original_user_files_over();
|
||||||
|
|
||||||
char* devicename = gConfigSound.device;
|
// TODO move to audio initialise function
|
||||||
if (strlen(devicename) == 0) {
|
if (str_is_null_or_empty(gConfigSound.device)) {
|
||||||
devicename = NULL;
|
Mixer_Init(NULL);
|
||||||
}
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = 0;
|
||||||
Mixer_Init(devicename);
|
} else {
|
||||||
for (int i = 0; i < gAudioDeviceCount; i++) {
|
Mixer_Init(gConfigSound.device);
|
||||||
if (strcmp(gAudioDevices[i].name, gConfigSound.device) == 0) {
|
for (int i = 0; i < gAudioDeviceCount; i++) {
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = i;
|
if (strcmp(gAudioDevices[i].name, gConfigSound.device) == 0) {
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user