Runtime/Audio: Replace bitfield unions with constructor initializers

This commit is contained in:
Luke Street 2020-04-10 15:02:55 -04:00
parent 346d110b79
commit 8e691d0f73
1 changed files with 11 additions and 13 deletions

View File

@ -446,14 +446,9 @@ public:
private:
dspadpcm_header x0_header;
std::string x60_fileName; // arg1
union {
u32 dummy = 0;
struct {
bool x70_24_unclaimed : 1;
bool x70_25_headerReadCancelled : 1;
u8 x70_26_headerReadState : 2; // 0: not read 1: reading 2: read
};
};
s8 x71_companionRight = -1;
s8 x72_companionLeft = -1;
float x73_volume = 0.f;
@ -465,13 +460,16 @@ private:
static std::array<CDSPStreamManager, 4> g_Streams;
public:
CDSPStreamManager() { x70_24_unclaimed = true; }
CDSPStreamManager() : x70_24_unclaimed(true), x70_25_headerReadCancelled(false), x70_26_headerReadState(0) {}
CDSPStreamManager(std::string_view fileName, s32 handle, float volume, bool oneshot)
: x60_fileName(fileName), x73_volume(volume), x74_oneshot(oneshot), x78_handleId(handle) {
if (!CDvdFile::FileExists(fileName))
x70_24_unclaimed = true;
}
: x60_fileName(fileName)
, x70_24_unclaimed(!CDvdFile::FileExists(fileName))
, x70_25_headerReadCancelled(false)
, x70_26_headerReadState(0)
, x73_volume(volume)
, x74_oneshot(oneshot)
, x78_handleId(handle) {}
static s32 FindUnclaimedStreamIdx() {
for (size_t i = 0; i < g_Streams.size(); ++i) {