Home Units Hierarchy Routines All identifiers

Welcome to VC components documentation.

  1. Installing
  2. Getting Started
    1. Providers and consumers
    2. Recording and playing back audio
    3. Streaming audio over IP
  3. Advanced topics
  4. More information

Installing

Though it is possible to create any of VC components at run-time, it would be more convenient to have them available from Delphi/C++Builder IDE's Components/Tool Palette.

After downloading and unpacking the sources, please follow these steps to add VC components to Palette. This creates VC package files (for Delphi that would be vc2.bpl and vc2.dcp) which will be loaded into IDE when it starts, and makes all VC components available at design-time.

When installing a new update, old version of package must be removed from IDE first.

If you happen to open a project with VC components placed in design-time and do not have VC components installed in IDE, press Cancel and close the project without saving. Install components into IDE and re-open the project.

When compiling with run-time packages including VC package, Delphi/C++Builder will link units from .dcp file and your project will require .bpl file to run.

Since IDE is a 32-bit, design-time packages you create must also be a 32-bit (x86) binaries. If you need a x64 run-time package, compile it separately from command line with dcc64 command.

Getting Started

Providers and consumers

It is important to understand how data flows from one component to others.

Most of components have the consumer property. Using this property you specify (either at desing or run-time) which component will be a consumer of data "produced" by data provider component.

For example, a component which records audio from a sound card most likely will be a provider for the component which saves audio to a file. At design-time you select consumer from a drop-down list box, at run-time you assign consumer property:

	WaveIn.consumer := WaveRiff;

Linking two or more components into a dataflow chain allows you to build a data-processing modules with no lines of code. For example, the following chain is usually built when sending and receiving audio:

WaveIn -> WaveCodec -> IPClient -> WaveDecodec -> WaveOut

Not only data flows from provider to consumer. Provider can also assign audio format (if isFormatProvider property is True), and activate/close consumer (if autoActivate property is True).

One provider may have more than one consumer. This could be done at run-time using addConsumer() method.

Also, one component could be a consumer of many providers, like the WaveMixer component, which takes audio streams from several sources and mixes them into one stream.

There is a multi-consumer sample, which shows how to link one provider to several consumers at run-time.

Use removeConsumer() to unlink one component from another. If provider has only one consumer, you can simply set the consumer property to Nil.

Recording and playing back audio

Audio playback and recording is probably the most common task you do when building a project with VC compoents.

WaveIn component records live audio from specified sound card and passes uncompressed PCM stream to consumer(s).

WaveOut component receives uncompressed PCM audio from provider and plays it back on specified sound card.

The deviceId property specifies which sound card to use for recording or playback. Set this property to -1 to specify default device.

You can enumerate devices using enumWaveDevices() routine.

If you link these two components, you will get what is usually called a loopback. Audio, recorded from sound card will be immediately played back. There is a loopback sample included in demos.

pcm_bitsPerSample, pcm_numChannels and pcm_samplesPerSec properties specify PCM audio format to be assigned. Make sure both WaveIn and WaveOut componets has same audio format.

Streaming audio over IP

True power of VC components is enclosed in two network streaming components: IPReceiver and IPTransmitter. Using these components you can build a wide range of real-time audio streaming applications.

IPTransmitter can encode (compress) audio with specified codec, and IPReceiver can automatically decode (decompress) audio to uncompressed PCM format. Some codeds are built-in, other require additional .DLL(s).

You specify codec via SDP property. Make sure both sides are using same SDP setup.

Both components support RAW, RTP, RTSP and SHOUTcast protocols. For a simple P2P audio chat RTP is preffered streaming protocol. IPReceiver.URI and IPTransmitter.URI properties specify how packets are to be distributed.

Usually a host with IPTransmitter has public IP address and host with IPReceiver could "connect" to it from behind a firewall/NAT.

A full-duplex streaming could be build with IPDuplex component. It combines IPTransmitter and IPReceiver.

There are several IP streaming samples included in demos.

Advanced topics

More advanced topics will be covered here. Later.

More information

There is (much) more information available from developer of VC compoents. Please do not hesitate to contact him if you have more questions.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09