mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-02-22 20:57:12 +01:00
attempt to implement looping
This commit is contained in:
parent
9354db6a16
commit
312ecbccde
@ -14,14 +14,18 @@ BootSoundReader::BootSoundReader(FSCVirtualFile* bootsndFile, sint32 blockSize)
|
|||||||
|
|
||||||
sint16* BootSoundReader::getSamples()
|
sint16* BootSoundReader::getSamples()
|
||||||
{
|
{
|
||||||
auto read = fsc_readFile(bootsndFile, bufferBE.data(), blockSize);
|
size_t totalRead = 0;
|
||||||
if(read % sizeof(sint16be) != 0)
|
while(totalRead < blockSize)
|
||||||
cemu_assert_suspicious();
|
{
|
||||||
|
auto read = fsc_readFile(bootsndFile, bufferBE.data(), blockSize - totalRead);
|
||||||
|
if (read % sizeof(sint16be) != 0)
|
||||||
|
cemu_assert_suspicious();
|
||||||
|
|
||||||
auto readValues = read / sizeof(sint16be);
|
std::copy_n(bufferBE.begin(), read / sizeof(sint16be), buffer.begin() + totalRead);
|
||||||
if (readValues < blockSize)
|
totalRead += read;
|
||||||
std::fill(buffer.begin() + readValues, buffer.end(), 0);
|
if (totalRead < blockSize)
|
||||||
|
fsc_setFileSeek(bootsndFile, loopPoint * 4);
|
||||||
|
}
|
||||||
|
|
||||||
std::copy_n(bufferBE.begin(), read / sizeof(sint16be), buffer.begin());
|
|
||||||
return buffer.data();
|
return buffer.data();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user