Audio Processor

This demo converts stereo to mono.  If the input is mono it is left as is, if the input is stereo it is converted to mono.

  • This demo accepts 16 bps input.
  • In order to use AudioProcessor component you should set its OnGeData event handler at least.
  • In this demo we also set OnGetChannels event handler.
  • Don’t forget to assign WaveIn1’s FileName property.
Summary
Audio ProcessorThis demo converts stereo to mono.
Functions
FormCloseThis OnClose event prevents exceptions if he form is closed while playing.
Variables
BuffersWe assume the input is 16 bits per sample.
Get DataA all to Input.GetData(Buffer, Bytes) retrieves a part of the input component’s buffer (pointed to by Buffer) that contains The number of bytes returned in Bytes.
FillBufferEndOfInput is set to True when FillBuffer has encountered the end of data in AudioProcessor1.Input.

Functions

FormClose

procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction)

This OnClose event prevents exceptions if he form is closed while playing.

Variables

Buffers

We assume the input is 16 bits per sample.

PS16: PStereoBuffer16pointer to a buffer for stereo data
P16: PBuffer16pointer to a buffer for mono data.

Get Data

A all to Input.GetData(Buffer, Bytes) retrieves a part of the input component’s buffer (pointed to by Buffer) that contains The number of bytes returned in Bytes.

See the Component Writer’s Guide on more detail about how GetData() operates.

FillBuffer

EndOfInput is set to True when FillBuffer has encountered the end of data in AudioProcessor1.Input.  There still may be some data in the input, but the next time this method is called we should return nil.

procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction)
This OnClose event prevents exceptions if he form is closed while playing.
This tutorial will teach you how to write input and output components for the NewAC components suite.
Close