ngs2: report voice port routing and volume

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

No files matched your search

+1
View File
@@ -1163,6 +1163,7 @@ LIB_DEFINE(InitAudio_1_Ngs2) {
LIB_FUNC("-TOuuAQ-buE", Ngs2::Ngs2VoiceGetState); LIB_FUNC("-TOuuAQ-buE", Ngs2::Ngs2VoiceGetState);
LIB_FUNC("rEh728kXk3w", Ngs2::Ngs2VoiceGetStateFlags); LIB_FUNC("rEh728kXk3w", Ngs2::Ngs2VoiceGetStateFlags);
LIB_FUNC("9eic4AmjGVI", Ngs2::Ngs2VoiceQueryInfo); LIB_FUNC("9eic4AmjGVI", Ngs2::Ngs2VoiceQueryInfo);
LIB_FUNC("WCayTgob7-o", Ngs2::Ngs2VoiceGetPortInfo);
LIB_FUNC("i0VnXM-C9fc", Ngs2::Ngs2SystemRender); LIB_FUNC("i0VnXM-C9fc", Ngs2::Ngs2SystemRender);
LIB_FUNC("l4Q2dWEH6UM", Ngs2::Ngs2SystemSetGrainSamples); LIB_FUNC("l4Q2dWEH6UM", Ngs2::Ngs2SystemSetGrainSamples);
LIB_FUNC("hyVLT2VlOYk", Ngs2::Ngs2ParseWaveformData); LIB_FUNC("hyVLT2VlOYk", Ngs2::Ngs2ParseWaveformData);
+25
View File
@@ -2802,6 +2802,31 @@ int KYTY_SYSV_ABI Ngs2VoiceQueryInfo(uintptr_t voice_handle, uint32_t query_id,
return OK; return OK;
} }
int KYTY_SYSV_ABI Ngs2VoiceGetPortInfo(uintptr_t voice_handle, uint32_t port, void* info,
size_t info_size) {
PRINT_NAME();
struct PortInfo {
int32_t matrix;
float volume;
uint32_t delay_samples, input;
uintptr_t dest;
};
EXIT_NOT_IMPLEMENTED(voice_handle == 0 || info == nullptr || info_size != sizeof(PortInfo));
auto* voice = reinterpret_cast<Ngs2VoiceInternal*>(voice_handle);
Common::LockGuard lock(voice->rack->ngs->mutex);
EXIT_NOT_IMPLEMENTED(port >= voice->ports.size());
const auto& p = voice->ports[port];
*static_cast<PortInfo*>(info) = {p.matrix, p.volume, 0, p.input,
reinterpret_cast<uintptr_t>(p.dest)};
return OK;
}
int KYTY_SYSV_ABI Ngs2SystemLock(uintptr_t system_handle) { int KYTY_SYSV_ABI Ngs2SystemLock(uintptr_t system_handle) {
PRINT_NAME(); PRINT_NAME();
+2
View File
@@ -62,6 +62,8 @@ int KYTY_SYSV_ABI Ngs2VoiceGetState(uintptr_t voice_handle, Ngs2VoiceState* stat
int KYTY_SYSV_ABI Ngs2VoiceGetStateFlags(uintptr_t voice_handle, uint32_t* state_flags); 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, int KYTY_SYSV_ABI Ngs2VoiceQueryInfo(uintptr_t voice_handle, uint32_t query_id, void* info,
size_t info_size); size_t info_size);
int KYTY_SYSV_ABI Ngs2VoiceGetPortInfo(uintptr_t voice_handle, uint32_t port, void* info,
size_t info_size);
int KYTY_SYSV_ABI Ngs2SystemRender(uintptr_t system_handle, const Ngs2RenderBufferInfo* buffer_info, int KYTY_SYSV_ABI Ngs2SystemRender(uintptr_t system_handle, const Ngs2RenderBufferInfo* buffer_info,
uint32_t num_buffer_info); uint32_t num_buffer_info);
int KYTY_SYSV_ABI Ngs2ParseWaveformData(const void* data, size_t data_size, Ngs2WaveformInfo* info); int KYTY_SYSV_ABI Ngs2ParseWaveformData(const void* data, size_t data_size, Ngs2WaveformInfo* info);
+17
View File
@@ -1165,6 +1165,22 @@ void TestSetupQuery() {
Check(info[0] == 2 && info[1] == 0, "setup query did not report the voice channels"); Check(info[0] == 2 && info[1] == 0, "setup query did not report the voice channels");
} }
void TestPortInfo() {
Fixture f(48000);
Ngs2VoiceInternal dest;
f.voice.ports.push_back({&dest, 1, 0.5f, 0});
struct {
int32_t matrix;
float volume;
uint32_t delay_samples, input;
uintptr_t dest;
} info {99, 99, 99, 99, 99};
Ngs2VoiceGetPortInfo(reinterpret_cast<uintptr_t>(&f.voice), 0, &info, sizeof(info));
Check(info.matrix == 0 && info.volume == 0.5f && info.delay_samples == 0 && info.input == 1 &&
info.dest == reinterpret_cast<uintptr_t>(&dest),
"port info did not report the port routing and volume");
}
void TestPlayStateBeforeRender() { void TestPlayStateBeforeRender() {
Fixture f(48000); Fixture f(48000);
const int16_t pcm[] = {8192, -16384}; const int16_t pcm[] = {8192, -16384};
@@ -1896,6 +1912,7 @@ int main() {
TestMatrixOutputChannels(); TestMatrixOutputChannels();
TestCustomPcmStillPlays(); TestCustomPcmStillPlays();
TestSetupQuery(); TestSetupQuery();
TestPortInfo();
TestPlayStateBeforeRender(); TestPlayStateBeforeRender();
TestStatePublication(); TestStatePublication();
TestStopThenPlayBeforeRender(); TestStopThenPlayBeforeRender();