Copyright © 2005-2018 MultiMedia Soft

CastingCreateFromWasapiLoopback method

Previous pageReturn to chapter overviewNext page

Remarks

 

Creates a casting session that will output sound from the given WASAPI loopback device.

The usage of this method allows sending to a streaming server any sound being played through an audio endpoint device by any application running inside the system.

 

After creating the casting session, you can start it through the CastingStart method.

 

This method is only intended for usage with Windows Vista and later versions.

 

Further information about management of casting sessions can be found inside the How to use the control as a source for streaming servers like SHOUTcast tutorial.

For further details about the use of WASAPI see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial

 

 

Syntax

 

[Visual Basic]

Public Function CastingCreateFromWasapiLoopback (

nDeviceIndex as Int16,

strServer as String,

strPassword as String,

strIcecastMountName as String,

nEncodeFormat as enumEncodingFormats,

strName as String,

strURL as String,

strGenre as String,

strHeaders as String,

strIcecastDescription as String,

nEncodeMode as enumCastEncodeModes,

fEncodeValue as Single,

nResampleFrequency as Int32,

nChannels as Int16

) as Int32


 

[C#]

public Int32 CastingCreateFromWasapiLoopback (

Int16 nDeviceIndex,

string strServer,

string strPassword,

string strIcecastMountName,

enumEncodingFormats nEncodeFormat,

string strName,

string strURL,

string strGenre,

string strHeaders,

string strIcecastDescription,

enumCastEncodeModes nEncodeMode,

float fEncodeValue,

Int32 nResampleFrequency,

Int16 nChannels

);


 

[C++]

public: Int32 CastingCreateFromWasapiLoopback (

Int16 nDeviceIndex,

string strServer,

string strPassword,

string strIcecastMountName,

enumEncodingFormats nEncodeFormat,

string strName,

string strURL,

string strGenre,

string strHeaders,

string strIcecastDescription,

enumCastEncodeModes nEncodeMode,

float fEncodeValue,

Int32 nResampleFrequency,

Int16 nChannels

);


 

 

Parameter

Description

 

 

nDeviceIndex

Number representing the zero-based index of the WASAPI loopback device of interest. The total number of available WASAPI devices can be obtained using the WASAPI.DeviceGetCount method having the nDeviceType parameter set to WASAPI_DEVICE_TYPE_LOOPBACK.

strServer

Address of the cast server.

When connecting to a ShoutCAST Version 1 server or to an IceCast server, the address is in the format "address:port", for example "http://192.168.0.1:80"

When connecting to a ShoutCAST Version 2 server, which can manage more audio streams at the same time, the address is in the format "address:port,strid" where "strid" represents the identifier of the audio stream, for example "http://192.168.0.1:80,1234

strPassword

Password of the cast server

strIcecastMountName

Icecast mount name (for use with Icecast servers only)

nEncodeFormat

Encoding format

Supported values are the following:

Mnemonic constant

Value

Meaning

ENCODING_FORMAT_MP3

2

MP3 format

ENCODING_FORMAT_OGG

4

OGG Vorbis format

ENCODING_FORMAT_AAC_PLUS

22

AAC+ (HE-AAC)

strName

Stream name

strURL

URL of the radio station

strGenre

Genre of the stream

strHeaders

Additional headers to send to the server

strIcecastDescription

Further description for Icecast streams (for use with Icecast servers only)

nEncodeMode

Encode mode

Supported values are the following:

Mnemonic constant

Value

Meaning

CAST_ENCODE_QUALITY

0

Casting is based upon Quality

CAST_ENCODE_BITRATE

1

Casting is based upon Bitrate

fEncodeValue

Value related to the chosen encode mode (ignored when the nEncodeFormat parameter is set to ENCODING_FORMAT_AAC_PLUS):

if the value of the nEncodeMode parameter is set to CAST_ENCODE_QUALITY this parameter can assume the following range of values:

     - if the value of the nEncodeFormat parameter is set to ENCODING_FORMAT_MP3 can be from 0 (high quality but slow) to 9 (poor quality but faster)

     - if the value of the nEncodeFormat parameter is set to ENCODING_FORMAT_OGG can be from 0 (poor quality) to 10 (high quality)

if the value of the nEncodeMode parameter is set to CAST_ENCODE_BITRATE the passed value represents the bitrate in kbps (kilo bits per second)

nResampleFrequency

Resample frequency

nChannels

Number of channels

 

 

 

Return value

 

Value

Meaning

 

 

> 0

Numeric value representing the unique identifier of the casting session: this unique identifier will be used in order to invoke further methods related to the use of the casting session itself

Negative value

An error occurred: see the LastError property for further error details or for a list of the possible error values.