ngs2: let CLEAR reopen a closed waveform block list

Co-authored-by: Phr3d13 <phr3d13@gmail.com>
This commit is contained in:
nmzikandPhr3d13 committed 2026-10-30 01:57:41 +01:00
1 parent 2f6dccb10b
commit b65dd18224
2 files changed
+12 -1

No files matched your search

+2 -1
View File
@@ -713,10 +713,11 @@ struct Ngs2VoiceInternal {
if (count > capacity) {
return NGS2_ERROR_INVALID_NUM_WAVEFORM_BLOCKS;
}
EXIT_NOT_IMPLEMENTED(!accepts_blocks || (flags & ~0x17u) != 0);
const bool clear = (flags & 4u) != 0;
const bool only_data = (flags & 2u) != 0;
const bool join = only_data && (flags & 0x10u) == 0;
// CLEAR reopens a list that the previous addition closed.
EXIT_NOT_IMPLEMENTED((!accepts_blocks && !clear) || (flags & ~0x17u) != 0);
const auto retained = clear ? 0 : blocks.size();
Block tail = retained == 0 ? Block {} : blocks.back();
std::vector<Block> pending;
+10
View File
@@ -1210,6 +1210,15 @@ void TestDeferredSamplerSetup() {
"sampler did not play after deferred stream setup");
}
void TestClearReopensClosedList() {
Fixture f(48000);
const int16_t first = 8192, second = -16384;
f.Queue(&first, 1, 0);
f.Queue(&second, 1, 4);
f.Render(1);
Check(f.voice.samples[0] == -0.5f, "CLEAR did not reopen a closed waveform list");
}
void TestSetupQuery() {
Fixture f(48000, 2);
uint32_t info[2] = {99, 99};
@@ -1965,6 +1974,7 @@ int main() {
TestDefaultMatrix();
TestMatrixOutputChannels();
TestCustomPcmStillPlays();
TestClearReopensClosedList();
TestSetupQuery();
TestPortInfo();
TestPlayStateBeforeRender();