mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
More Android stub-outs and bug fixes. Fix broken SDL fiber sync.
This commit is contained in:
30
GpApp/SoundSync_Cpp11.cpp
Normal file
30
GpApp/SoundSync_Cpp11.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "SoundSync.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
static std::atomic<uint64_t> gs_prioritiesBlob(0);
|
||||
|
||||
SoundSyncState SoundSync_ReadAll()
|
||||
{
|
||||
const uint64_t priorities = gs_prioritiesBlob.load(std::memory_order_relaxed);
|
||||
|
||||
SoundSyncState state;
|
||||
state.priority0 = static_cast<uint16_t>((priorities >> 0) & 0xffff);
|
||||
state.priority1 = static_cast<uint16_t>((priorities >> 16) & 0xffff);
|
||||
state.priority2 = static_cast<uint16_t>((priorities >> 32) & 0xffff);
|
||||
state.priority3 = static_cast<uint16_t>((priorities >> 48) & 0xffff);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void SoundSync_ClearPriority(int index)
|
||||
{
|
||||
const uint64_t clearMask = ~(static_cast<int64_t>(0xffff) << (index * 16));
|
||||
gs_prioritiesBlob &= clearMask;
|
||||
}
|
||||
|
||||
void SoundSync_PutPriority(int index, int16_t priority)
|
||||
{
|
||||
const uint64_t insertMask = static_cast<int64_t>(priority) << (index * 16);
|
||||
gs_prioritiesBlob |= insertMask;
|
||||
}
|
Reference in New Issue
Block a user