QOA data open API tweak
parent
8829b7bcc3
commit
c284037c62
|
@ -1 +1 @@
|
|||
Subproject commit a016259994797f96db2bda75c90b359258e99d09
|
||||
Subproject commit f065a5519fa2a1020eb971c0da66c877f2a97f18
|
|
@ -205,7 +205,7 @@ namespace MoonWorks.Audio
|
|||
fileStream.ReadExactly(fileDataSpan);
|
||||
fileStream.Close();
|
||||
|
||||
var qoaHandle = FAudio.qoa_open((char*) fileDataPtr, (uint) fileDataSpan.Length);
|
||||
var qoaHandle = FAudio.qoa_open_memory((char*) fileDataPtr, (uint) fileDataSpan.Length);
|
||||
if (qoaHandle == 0)
|
||||
{
|
||||
NativeMemory.Free(fileDataPtr);
|
||||
|
@ -215,7 +215,12 @@ namespace MoonWorks.Audio
|
|||
|
||||
FAudio.qoa_attributes(qoaHandle, out var channels, out var samplerate, out var samples_per_channel_per_frame, out var total_samples_per_channel);
|
||||
|
||||
var buffer = FAudio.qoa_load(qoaHandle);
|
||||
var bufferLengthInBytes = total_samples_per_channel * channels * sizeof(short);
|
||||
var buffer = NativeMemory.Alloc(bufferLengthInBytes);
|
||||
FAudio.qoa_decode_entire(qoaHandle, (short*) buffer);
|
||||
|
||||
FAudio.qoa_close(qoaHandle);
|
||||
NativeMemory.Free(fileDataPtr);
|
||||
|
||||
return new StaticSound(
|
||||
device,
|
||||
|
@ -225,7 +230,7 @@ namespace MoonWorks.Audio
|
|||
(ushort) channels,
|
||||
samplerate,
|
||||
(nint) buffer,
|
||||
total_samples_per_channel * channels * sizeof(short),
|
||||
bufferLengthInBytes,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MoonWorks.Audio
|
|||
fileStream.ReadExactly(fileDataSpan);
|
||||
fileStream.Close();
|
||||
|
||||
var qoaHandle = FAudio.qoa_open((char*) fileDataPtr, (uint) fileDataSpan.Length);
|
||||
var qoaHandle = FAudio.qoa_open_memory((char*) fileDataPtr, (uint) fileDataSpan.Length);
|
||||
if (qoaHandle == 0)
|
||||
{
|
||||
NativeMemory.Free(fileDataPtr);
|
||||
|
|
Loading…
Reference in New Issue