---
title: "AudioInput (_AudioInput class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/510591160/AudioInput%20(_AudioInput%20class)"
format: markdown
---
> Macro (toc)

---

# Capture 

The function starts to capture audio data from audio input to a WAV file. It returns the captureID, which can be used as a parameter of the Stop function to stop capture.  You can use the function <u>[PlayStream](/wiki/spaces/CVCHELP/pages/510591189/AudioOutput+AudioOutput+class#PlayStream)</u> to play a captured WAV file. 

#### Syntax 

```visualbasic
Function Capture(filename As Text) As Long
```

#### Parameters 

filename 

- <u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the pathname of the file with captured audio data in WAV format.

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is a captureid number or 0 if an error occurs. The function GetLastError returns the error number that occurred while executing the command. The following errors may occur: <u>[77](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#77)</u>, <u>[147](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#147)</u>. 

#### Example* *

```visualbasic
LIN1.Capture("/filestorage/rec1.wav")
```

# GetGain 

The function returns the gain of the audio input. Gain is in the range of 0 to 100. 

#### Syntax 

```visualbasic
Function GetGain() As Long
```

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is an actual gain of the audio input. 

# RedirectToOutput 

This function redirects the input signal to the required output. Only one redirection can be active at one time. If another redirection or capturing is active, the function returns False. This function doesn’t affect the play functions of audio output. Redirection is realized by analog loopback. If used for a built-in microphone, the signal is redirected just to the right output channel. This function allows using audio input and output for volume control. 

#### Syntax 

```visualbasic
Function RedirectToOutput(output As AddressOf _AudioOutput) As Boolean
```

#### Parameters 

output 

- It is the address of _AudioOutput.

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if some error occurs. The function GetLastError returns the error number that occurred while executing the command. The following errors may occur: <u>[147](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#147)</u>. 

#### Example 

```visualbasic
LIN1.RedirectToOutput(LOUT1) 
```

# SetGain 

The function sets audio input gain. Gain can be in the range of 0 to 100. 

#### Syntax 

```visualbasic
Function SetGain(gain As Long) 
```

# Stop 

The function stops capturing audio data from the audio input. 

#### Syntax 

```visualbasic
Function Stop(Optional captureid As Long:= 0)
```

#### Parameters 

captureid 

- <u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> Optional, defaults to 0.

# StopRedirectToOutput 

This function stops redirection to a given output. If the output isn’t specified, all redirections are stopped. 

#### Syntax 

```visualbasic
Function StopRedirectToOutput(Optional output As AddressOf _AudioOutput := Nothing)
```

#### Parameters 

output 

- It is the address of _AudioOutput. If Nothing is used, all redirections are stopped.