필터 지우기
필터 지우기

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 CenterFile Exchange에서 Audio 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