You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: audioOutIn.m
    path of file: ./repos/A-Lab/include/General Methods
    
    the code of the file until where you have to start completion: function [Outs,Ins] = audioOutIn(app,SignalOut,OutCh,InCh,Calibration)
% Copyright (C) Jose M. Requena Plens 
% joreple@upv.es - jmrplens.github.io

% Refresh hardware
audiodevreset;

% Hardware
Device = app.Device;
SamplesPerFrame = app.SamplesPerFrame;
SampleRate = app.SampleRate;
BitDepth = app.BitDepth;
inputsChannels = InCh;
outputsChannels = OutCh;

% Signal
signal = SignalOut;

% Info audio status
app.ExtUI.InfoAudioError.Text = '';
app.ExtUI.InfoAudioErrorLabel.Text = '';
app.ExtUI.InfoAudioError.BackgroundColor = 'none';
app.ExtUI.InfoAudioErrorLabel.BackgroundColor = 'none';
app.ExtUI.InfoAudioError.FontColor = [0 0 0];
app.ExtUI.InfoAudioErrorLabel.FontColor = [0 0 0];
drawnow

% =============================================================================================
% Try audio out/in 5 times before stop/return error
for retry = 1:6

    % ===============================================
    try
        
        % Buffers to read and write blocks (frames) of input and output samples,

    
function [Outs,Ins] = audioOutIn(app,SignalOut,OutCh,InCh,Calibration)
% Copyright (C) Jose M. Requena Plens 
% joreple@upv.es - jmrplens.github.io

% Refresh hardware
audiodevreset;

% Hardware
Device = app.Device;
SamplesPerFrame = app.SamplesPerFrame;
SampleRate = app.SampleRate;
BitDepth = app.BitDepth;
inputsChannels = InCh;
outputsChannels = OutCh;

% Signal
signal = SignalOut;

% Info audio status
app.ExtUI.InfoAudioError.Text = '';
app.ExtUI.InfoAudioErrorLabel.Text = '';
app.ExtUI.InfoAudioError.BackgroundColor = 'none';
app.ExtUI.InfoAudioErrorLabel.BackgroundColor = 'none';
app.ExtUI.InfoAudioError.FontColor = [0 0 0];
app.ExtUI.InfoAudioErrorLabel.FontColor = [0 0 0];
drawnow

% =============================================================================================
% Try audio out/in 5 times before stop/return error
for retry = 1:6

    % ===============================================
    try
        
        % Buffers to read and write blocks (frames) of input and output samples,
        % respectively
        toOutBuffer = dsp.AsyncBuffer(length(signal));
        toInBuffer = dsp.AsyncBuffer(length(signal));
        write(toOutBuffer,signal);
        
        % Sound card interface for synchronous playback and recording
        aPR = audioPlayerRecorder('Device',Device,...
            'SampleRate',SampleRate,...
            'BitDepth',BitDepth,...
            'PlayerChannelMapping',outputsChannels,...
            'RecorderChannelMapping',inputsChannels);
        
        % Streaming playback and acquisition
        % Loop ensures internal queues are never saturated
        nUnderruns = 0;
        nOverruns = 0;
        while toOutBuffer.NumUnreadSamples >= SamplesPerFrame
            % Get a block of input samples
            frameOut = read(toOutBuffer,SamplesPerFrame);
            
            % Playback and record
            [frameIn,nUnderrunsaux,nOverrunsaux] = aPR(frameOut);
            
            % Store a block of output samples
            write(toInBuffer,frameIn);
            
            % Check no blocks were dropped in either direction
            if nUnderrunsaux > 0
                nUnderruns = nUnderruns + nUnderrunsaux;
            end