フィルターのクリア

VST creation: Index in position 1 is invalid

2 ビュー (過去 30 日間)
Tommaso
Tommaso 2023 年 8 月 15 日
編集済み: Walter Roberson 2023 年 8 月 16 日
Everything works properly in audioTestBench but I get "Index in position 1 is invalid" error when I try to export my audio plugin. Thanks for any help...
classdef reverser2 < audioPlugin
properties
dry = 0.5;
wet = 0.5;
size = 1;
twriteBuffer = 1; % start writing from buffer 1 (and reading on buffer 2)
end
properties (Access = private)
tBuffera = zeros(176400,2);
tBufferb = zeros(176400,2);
BufferIndex = 1;
NSamples = 44100;
end
properties (Constant)
PluginInterface = audioPluginInterface(...
audioPluginParameter('dry',...
'DisplayName','Dry',...
'Mapping',{'lin',0,1}),...
audioPluginParameter('wet',...
'DisplayName','Wet',...
'Mapping',{'lin',0,1}),...
audioPluginParameter('size',...
'DisplayName','Buffer size',...
'Mapping',{'lin',0.1,4},...
'Label','seconds'))
end
methods
function out = process(plugin, in)
out = zeros(size(in));
writeIndex = plugin.BufferIndex; % set writing point (last sample read)
readIndex = plugin.NSamples - writeIndex; % set reading point (mirrored point of the writing)
who = plugin.twriteBuffer;
% plugin.CircularBuffer=flipud(plugin.CircularBuffer);
if readIndex <= 0
readIndex = readIndex + plugin.NSamples;
end
for i = 1:size(in,1)
if who == 1
plugin.tBuffera(writeIndex,:) = in(i,:);
reverse = plugin.tBufferb(readIndex,:);
else
plugin.tBufferb(writeIndex,:) = in(i,:);
reverse = plugin.tBuffera(readIndex,:);
end
out(i,:) = in(i,:)*plugin.dry + reverse*plugin.wet;
writeIndex = writeIndex + 1; % move forward the writing point
if writeIndex > plugin.NSamples
writeIndex = 1;
end
readIndex = readIndex - 1; % move backward the reading point
if readIndex <= 0
readIndex = plugin.NSamples;
if who == 1
who = 2;
else
who = 1;
end
end
end
plugin.BufferIndex = writeIndex;
plugin.twriteBuffer = who;
end
function set.size(plugin, val)
plugin.size = val;
plugin.NSamples = floor(getSampleRate(plugin)*val);
end
end
end
  2 件のコメント
Florian Bidaud
Florian Bidaud 2023 年 8 月 15 日
On which line do you get this error ?
Tommaso
Tommaso 2023 年 8 月 15 日
is there a way to know it?
Because I get it when I click on export as a generic dialog window.

サインインしてコメントする。

回答 (1 件)

jibrahim
jibrahim 2023 年 8 月 16 日
I assume you get an error when you attempt to generate an audio plugin.
I can reproduce your error if I validate the audio plugin:
validateAudioPlugin reverser2
You will see the error coming from line 41. The index readIndex is negative.
You should be able to debug your code by following the errors from validateAudioPlugin. Use common debugging tools to put breakpoints on the offending line of your code.
  1 件のコメント
Tommaso
Tommaso 2023 年 8 月 16 日
thanks for the advice in debugging. Still struggling on why a got a negative index value.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAudio Plugin Creation and Hosting についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by