Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
Fix also bug with non updating UI for Rhythm
Egor Khindikaynene050e60fc355
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a4bbaecc..d3579dd1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -800,9 +800,9 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.### Fixed- **A rack chain's pop-out GUI showed a frozen picture.** Opening **GUI** on an effect or- instrument inside an Instrument Rack, Drum Rack or Audio Effect Rack chain showed its real- editor, but its meters, scopes, curves and held keys never moved. They now follow that- device's own signal live.+ instrument inside an Instrument Rack, Drum Rack or Audio Effect Rack chain, or on an effect+ on a Nota Rhythm voice, showed its real editor, but its meters, scopes, curves and held keys+ never moved. They now follow that device's own signal live.- **Rack macro mappings came loose when a chain's effects changed.** Removing or reorderingan effect in an Instrument Rack, Drum Rack or Audio Effect Rack chain left the macrosmapped to whichever device now sat at the old position. A mapping now moves with itsdiff --git a/src/managed/Nota.App/DeviceCards/Rack/IRackAccess.cs b/src/managed/Nota.App/DeviceCards/Rack/IRackAccess.csindex d1868d88..e2516aee 100644--- a/src/managed/Nota.App/DeviceCards/Rack/IRackAccess.cs+++ b/src/managed/Nota.App/DeviceCards/Rack/IRackAccess.cs@@ -217,6 +217,11 @@ internal sealed class RhythmVoiceAccess(IAudioEngine e, int t) : IRackAccesspublic void SetChainDeviceBypassed(int c, int d, bool b) => e.RhythmSetVoiceDeviceBypassed(t, c, d, b);public int ChainDeviceBuiltinKind(int c, int d) => e.RhythmVoiceDeviceBuiltinKind(t, c, d);public void OpenChainDeviceEditor(int c, int d) { }+ public float ChainDeviceGainReduction(int c, int d) => e.RhythmVoiceDeviceGainReduction(t, c, d);+ public int ChainDeviceScope(int c, int d, float[] o, int n) => e.RhythmVoiceDeviceScope(t, c, d, o, n);+ public int ChainDeviceLayerWave(int c, int d, int l, float[] o, int n) => e.RhythmVoiceDeviceLayerWave(t, c, d, l, o, n);+ public string ChainDeviceText(int c, int d, int id) => e.RhythmVoiceDeviceText(t, c, d, id);+ public void ChainDeviceAction(int c, int d, int id, int iarg, float farg) => e.RhythmVoiceDeviceAction(t, c, d, id, iarg, farg);public float ChainGain(int c) => 1f; public void SetChainGain(int c, float v) { }public float ChainPan(int c) => 0f; public void SetChainPan(int c, float v) { }public bool ChainMute(int c) => false; public void SetChainMute(int c, bool b) { }diff --git a/src/managed/Nota.Application/Engine/IAudioEngine.cs b/src/managed/Nota.Application/Engine/IAudioEngine.csindex ee8511e8..41471373 100644--- a/src/managed/Nota.Application/Engine/IAudioEngine.cs+++ b/src/managed/Nota.Application/Engine/IAudioEngine.cs@@ -297,6 +297,13 @@ public interface IAudioEngine : IDisposablevoid RhythmVoiceDeviceParamSet(int trackId, int voice, int dev, int param, float value);bool RhythmVoiceDeviceBypassed(int trackId, int voice, int dev);void RhythmSetVoiceDeviceBypassed(int trackId, int voice, int dev, bool bypassed);+ // Voice-device telemetry — mirrors DeviceGainReduction / DeviceScope / DeviceLayerWave /+ // DeviceText / DeviceAction for an effect on a Rhythm voice.+ float RhythmVoiceDeviceGainReduction(int trackId, int voice, int dev);+ int RhythmVoiceDeviceScope(int trackId, int voice, int dev, float[] outSamples, int maxSamples);+ int RhythmVoiceDeviceLayerWave(int trackId, int voice, int dev, int layer, float[] outSamples, int maxSamples);+ string RhythmVoiceDeviceText(int trackId, int voice, int dev, int id);+ void RhythmVoiceDeviceAction(int trackId, int voice, int dev, int id, int iarg, float farg);/// <summary>The factory kit a Rhythm's voices were loaded from ("" = none) — display only, saved with the track.</summary>string RhythmKitName(int trackId);void RhythmSetKitName(int trackId, string name);diff --git a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.csindex 4da9688c..dd609546 100644--- a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs+++ b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs@@ -371,6 +371,17 @@ internal static partial class NativeMethods[LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_bypassed")]internal static partial int RhythmVoiceDeviceBypassed(IntPtr engine, int trackId, int voice, int dev);+ [LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_gain_reduction")]+ internal static partial float RhythmVoiceDeviceGainReduction(IntPtr engine, int trackId, int voice, int dev);+ [LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_scope")]+ internal static partial int RhythmVoiceDeviceScope(IntPtr engine, int trackId, int voice, int dev, [Out] float[] outSamples, int maxSamples);+ [LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_layer_wave")]+ internal static partial int RhythmVoiceDeviceLayerWave(IntPtr engine, int trackId, int voice, int dev, int layer, [Out] float[] outSamples, int maxSamples);+ [LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_text")]+ internal static partial int RhythmVoiceDeviceText(IntPtr engine, int trackId, int voice, int dev, int id, [Out] byte[]? outBytes, int cap);+ [LibraryImport(Lib, EntryPoint = "nota_rhythm_voice_device_action")]+ internal static partial void RhythmVoiceDeviceAction(IntPtr engine, int trackId, int voice, int dev, int id, int iarg, float farg);+[LibraryImport(Lib, EntryPoint = "nota_rhythm_set_voice_device_bypassed")]internal static partial void RhythmSetVoiceDeviceBypassed(IntPtr engine, int trackId, int voice, int dev, int bypassed);diff --git a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.csindex 20da9d8f..9221d8ca 100644--- a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs+++ b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs@@ -713,6 +713,23 @@ public sealed partial class NotaEngine{ ThrowIfDisposed(); return NativeMethods.RhythmVoiceDeviceBypassed(_handle, trackId, voice, dev) != 0; }public void RhythmSetVoiceDeviceBypassed(int trackId, int voice, int dev, bool bypassed){ ThrowIfDisposed(); NativeMethods.RhythmSetVoiceDeviceBypassed(_handle, trackId, voice, dev, bypassed ? 1 : 0); }+ public float RhythmVoiceDeviceGainReduction(int trackId, int voice, int dev)+ { ThrowIfDisposed(); return NativeMethods.RhythmVoiceDeviceGainReduction(_handle, trackId, voice, dev); }+ public int RhythmVoiceDeviceScope(int trackId, int voice, int dev, float[] outSamples, int maxSamples)+ { ThrowIfDisposed(); return NativeMethods.RhythmVoiceDeviceScope(_handle, trackId, voice, dev, outSamples, maxSamples); }+ public int RhythmVoiceDeviceLayerWave(int trackId, int voice, int dev, int layer, float[] outSamples, int maxSamples)+ { ThrowIfDisposed(); return NativeMethods.RhythmVoiceDeviceLayerWave(_handle, trackId, voice, dev, layer, outSamples, maxSamples); }+ public void RhythmVoiceDeviceAction(int trackId, int voice, int dev, int id, int iarg, float farg)+ { ThrowIfDisposed(); NativeMethods.RhythmVoiceDeviceAction(_handle, trackId, voice, dev, id, iarg, farg); }+ public string RhythmVoiceDeviceText(int trackId, int voice, int dev, int id)+ {+ ThrowIfDisposed();+ int n = NativeMethods.RhythmVoiceDeviceText(_handle, trackId, voice, dev, id, null, 0);+ if (n <= 0) return "";+ var buf = new byte[n + 1];+ NativeMethods.RhythmVoiceDeviceText(_handle, trackId, voice, dev, id, buf, buf.Length);+ return System.Text.Encoding.UTF8.GetString(buf, 0, n);+ }public string RhythmKitName(int trackId){ ThrowIfDisposed(); return System.Runtime.InteropServices.Marshal.PtrToStringUTF8(NativeMethods.RhythmKitName(_handle, trackId)) ?? ""; }public void RhythmSetKitName(int trackId, string name)diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.hindex dfb38e91..4eee6478 100644--- a/src/native/nota.engine/include/nota/nota_engine.h+++ b/src/native/nota.engine/include/nota/nota_engine.h@@ -420,6 +420,12 @@ NOTA_API float nota_rhythm_voice_device_param_get(const NotaEngine* engineNOTA_API void nota_rhythm_voice_device_param_set(NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, int32_t param, float value);NOTA_API int32_t nota_rhythm_voice_device_bypassed(const NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev);NOTA_API void nota_rhythm_set_voice_device_bypassed(NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, int32_t bypassed);+/* Voice-device telemetry: same semantics as nota_device_gain_reduction / _scope / _layer_wave / _text / _action. */+NOTA_API float nota_rhythm_voice_device_gain_reduction(const NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev);+NOTA_API int32_t nota_rhythm_voice_device_scope(const NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, float* out, int32_t max_samples);+NOTA_API int32_t nota_rhythm_voice_device_layer_wave(const NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, int32_t layer, float* out, int32_t max_samples);+NOTA_API int32_t nota_rhythm_voice_device_text(const NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, int32_t id, char* out, int32_t cap);+NOTA_API void nota_rhythm_voice_device_action(NotaEngine* engine, int32_t track_id, int32_t voice, int32_t dev, int32_t id, int32_t iarg, float farg);NOTA_API const char* nota_rhythm_kit_name(const NotaEngine* engine, int32_t track_id);NOTA_API void nota_rhythm_set_kit_name(NotaEngine* engine, int32_t track_id, const char* name);/* Nota Rhythm macros. The eight values are the instrument's macro1..macro8 plugin params; these editdiff --git a/src/native/nota.engine/src/nota_engine_track.cpp b/src/native/nota.engine/src/nota_engine_track.cppindex e6217be3..3385af1d 100644--- a/src/native/nota.engine/src/nota_engine_track.cpp+++ b/src/native/nota.engine/src/nota_engine_track.cpp@@ -8,6 +8,7 @@#include "nota_engine_internal.h"#include <algorithm>+#include <cstring>#include <string>#include <utility>#include <vector>@@ -184,6 +185,29 @@ int32_t nota_rhythm_voice_device_bypassed(const NotaEngine* e, int32_t t, int32_void nota_rhythm_set_voice_device_bypassed(NotaEngine* e, int32_t t, int32_t v, int32_t d, int32_t bypassed) {if (nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr) dev->setBypassed(bypassed != 0);}+float nota_rhythm_voice_device_gain_reduction(const NotaEngine* e, int32_t t, int32_t v, int32_t d) {+ nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr; return dev ? dev->gainReductionDb() : 0.0f;+}+int32_t nota_rhythm_voice_device_scope(const NotaEngine* e, int32_t t, int32_t v, int32_t d, float* out, int32_t n) {+ nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr; return dev ? dev->scopeRead(out, n) : 0;+}+int32_t nota_rhythm_voice_device_layer_wave(const NotaEngine* e, int32_t t, int32_t v, int32_t d, int32_t layer, float* out, int32_t n) {+ nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr; return dev ? dev->layerWave(layer, out, n) : 0;+}+int32_t nota_rhythm_voice_device_text(const NotaEngine* e, int32_t t, int32_t v, int32_t d, int32_t id, char* out, int32_t cap) {+ nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr;+ const std::string s = dev ? dev->deviceText(id) : std::string{};+ const int32_t n = static_cast<int32_t>(s.size());+ if (out && cap > 0) {+ const int32_t m = std::min(n, cap - 1);+ std::memcpy(out, s.data(), static_cast<size_t>(m));+ out[m] = '\0';+ }+ return n; // full length (probe with a null buffer, then fetch)+}+void nota_rhythm_voice_device_action(NotaEngine* e, int32_t t, int32_t v, int32_t d, int32_t id, int32_t iarg, float farg) {+ if (nota::Device* dev = e ? CENG(e)->rhythmVoiceDevice(t, v, d) : nullptr) dev->deviceAction(id, iarg, farg);+}const char* nota_rhythm_kit_name(const NotaEngine* e, int32_t t) {static std::string s; s = e ? CENG(e)->rhythmKitName(t) : std::string{}; return s.c_str();}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex cf07a336..b07080c5 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -11280,6 +11280,23 @@ Console.WriteLine("-- Kit FX --");"Rhythm voices carry the kit's FX (kick Forge, snare Reverb, closed hat Delay)");int dev = re.RhythmAddVoiceDevice(rt, 6, 1); // a compressor on the tomCheck(dev == 0 && re.RhythmVoiceDeviceName(rt, 6, 0).Length > 0, "a device can be added to a voice");+ // Voice-device telemetry (what its pop-out card draws): a compressor on a playing voice+ // reports its own live levels.+ using (var te = new NotaEngine())+ {+ int tt = svc.CreateRhythmTrack(te, "kompakt", out _);+ te.InstrumentAction(tt, RhythmModel.A_ClearBank, 0, 0);+ int tc = te.RhythmAddVoiceDevice(tt, 6, 1);+ te.InstrumentAction(tt, RhythmModel.A_ToggleStep, 6 * 16, 0);+ te.InstrumentAction(tt, RhythmModel.A_SetVel, 6 * 16, 1f);+ te.Seek(0); te.Play();+ var tblk = new float[512 * 2];+ for (int done = 0; done < SR / 10; done += 512) te.RenderOffline(tblk, 512);+ te.StopTransport();+ var tsc = new float[14];+ int tn = te.RhythmVoiceDeviceScope(tt, 6, tc, tsc, tsc.Length);+ Check(tn == 14 && tsc[8] > 1000 && tsc[0] > 0.001f, $"a voice compressor's scope reports live levels (n {tn}, sr {tsc[8]:0}, in {tsc[0]:0.000})");+ }int thr = Enumerable.Range(0, re.RhythmVoiceDeviceParamCount(rt, 6, 0)).First(p => re.RhythmVoiceDeviceParamName(rt, 6, 0, p) == "Thresh");re.RhythmVoiceDeviceParamSet(rt, 6, 0, thr, -30f);re.RhythmSetVoiceDeviceBypassed(rt, 1, 0, true);