ngs2: report voice setup channels from the setup query

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

No files matched your search

+1
View File
@@ -1162,6 +1162,7 @@ LIB_DEFINE(InitAudio_1_Ngs2) {
LIB_FUNC("AbYvTOZ8Pts", Ngs2::Ngs2VoiceRunCommands);
LIB_FUNC("-TOuuAQ-buE", Ngs2::Ngs2VoiceGetState);
LIB_FUNC("rEh728kXk3w", Ngs2::Ngs2VoiceGetStateFlags);
LIB_FUNC("9eic4AmjGVI", Ngs2::Ngs2VoiceQueryInfo);
LIB_FUNC("i0VnXM-C9fc", Ngs2::Ngs2SystemRender);
LIB_FUNC("l4Q2dWEH6UM", Ngs2::Ngs2SystemSetGrainSamples);
LIB_FUNC("hyVLT2VlOYk", Ngs2::Ngs2ParseWaveformData);
+19
View File
@@ -2783,6 +2783,25 @@ int KYTY_SYSV_ABI Ngs2VoiceGetStateFlags(uintptr_t voice_handle, uint32_t* state
return OK;
}
int KYTY_SYSV_ABI Ngs2VoiceQueryInfo(uintptr_t voice_handle, uint32_t query_id, void* info,
size_t info_size) {
PRINT_NAME();
struct SetupInfo {
uint32_t channels, flags;
};
EXIT_NOT_IMPLEMENTED(voice_handle == 0 || info == nullptr);
EXIT_NOT_IMPLEMENTED(query_id != 0x4001 || info_size != sizeof(SetupInfo));
auto* voice = reinterpret_cast<Ngs2VoiceInternal*>(voice_handle);
Common::LockGuard lock(voice->rack->ngs->mutex);
*static_cast<SetupInfo*>(info) = {voice->channels, 0};
return OK;
}
int KYTY_SYSV_ABI Ngs2SystemLock(uintptr_t system_handle) {
PRINT_NAME();
+2
View File
@@ -60,6 +60,8 @@ int KYTY_SYSV_ABI Ngs2VoiceRunCommands(uintptr_t voice_handle, const void* comma
int KYTY_SYSV_ABI Ngs2VoiceGetState(uintptr_t voice_handle, Ngs2VoiceState* state,
size_t state_size);
int KYTY_SYSV_ABI Ngs2VoiceGetStateFlags(uintptr_t voice_handle, uint32_t* state_flags);
int KYTY_SYSV_ABI Ngs2VoiceQueryInfo(uintptr_t voice_handle, uint32_t query_id, void* info,
size_t info_size);
int KYTY_SYSV_ABI Ngs2SystemRender(uintptr_t system_handle, const Ngs2RenderBufferInfo* buffer_info,
uint32_t num_buffer_info);
int KYTY_SYSV_ABI Ngs2ParseWaveformData(const void* data, size_t data_size, Ngs2WaveformInfo* info);
+8
View File
@@ -1158,6 +1158,13 @@ void TestDeferredSamplerSetup() {
"sampler did not play after deferred stream setup");
}
void TestSetupQuery() {
Fixture f(48000, 2);
uint32_t info[2] = {99, 99};
Ngs2VoiceQueryInfo(reinterpret_cast<uintptr_t>(&f.voice), 0x4001, info, sizeof(info));
Check(info[0] == 2 && info[1] == 0, "setup query did not report the voice channels");
}
void TestPlayStateBeforeRender() {
Fixture f(48000);
const int16_t pcm[] = {8192, -16384};
@@ -1888,6 +1895,7 @@ int main() {
TestMonoRateAndRouting();
TestMatrixOutputChannels();
TestCustomPcmStillPlays();
TestSetupQuery();
TestPlayStateBeforeRender();
TestStatePublication();
TestStopThenPlayBeforeRender();