I am triggering ftloadk to load tables from txt files (with unlatched button). The loading is done within an always on instrument separate from the audio generating instrument(s).
I am getting audio dropouts when I load a table and when sound is playing.
This is happening also if I use a dummy table (csd below), which is not used in the actual sound generating instrument. Noticeable with VST3 inside DAWs at lower buffer sizes (Live, Reaper) but not in Cabbage IDE (at buffer size the same as in DAW). I have also tried a version with ftload and reinit with the same results. The dropout threshold depends on table size and how much is happening in the plugin. In the example below I need quite large tables to notice the problem.
An obvious solution seems to be to load all tables at the init stage or pack all the values inside a single txt file / table and then virtually switch tables by appropriate indexing.
I am curious if anyone had similar experiences or has any suggestions how to avoid dropouts when loading txt files to tables while sound is playing. Why is this happening? I was assuming the audio thread would be independent from reading tables? I am probably missing something and there is likely a better way of handling tables than in my example below?
<Cabbage>
form caption("test instrument") size(370, 280) colour(58, 110, 182) pluginId("tins") guiMode("queue")
button bounds(84, 78, 40, 30) channel("Set") text("SET", "SET") latched(0) corners(2) colour:0(100, 80, 0, 255) colour:1(255, 255, 0, 255) fontColour:1(0, 0, 0, 255) _toSL(1) _MAP(1)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-d -n -+rtmidi=null -M0 -m0d
</CsOptions>
<CsInstruments>
ksmps = 16
nchnls = 2
0dbfs = 1
giTable ftgen 0, 0, 2^16, -2, 0
instr 1
Spath = sprintf("%s/%s", chnget:S("CSD_PATH"), "table.txt")
ftsave Spath, 1, giTable ; save a dummy table
kSet, kSetChanged cabbageGetValue "Set"
ftloadk Spath, kSet*kSetChanged, 1, giTable ; press SET to load
endin
instr 888
a1 poscil .02, 440
gaL += a1
gaR += a1
endin
instr 999
outs gaL, gaR
clear gaL, gaR
endin
</CsInstruments>
<CsScore>
i1 0 z
i 888 0 -1
i 999 0 -1
</CsScore>
</CsoundSynthesizer>