Remarks
Occurs during a casting session previously created by one between the CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods.
This event replaces the usage of the CallbackForCastingEvents delegate and is only intended for usage with applications developed using Visual Basic 6 (which results unreliable when dealing with delegates and callbacks) and, in order to be enabled, requires a call to the COMEventEnable method with the nEventType parameter set to EVENT_TYPE_CASTING.
For further details about callback delegates see the How to synchronize the container application with the API tutorial.
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 loopback devices see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial
Syntax
[Visual Basic 6]
Private Sub DjStudioApi_OnCastingEvents ( _
ByVal nEvent as enumCastingEvents, _
ByVal nCastingUniqueId as Int32, _
ByVal nData1 as Int32, _
ByVal nData2 as Int32, _
ByVal pBufferUnicode as IntPtr, _
ByVal nBufferLength as Int32 _
)
where "DjStudioApi" is declared in Visual Basic 6 code as:
Dim WithEvents DjStudioApi As AudioDjStudioApi.AudioDjStudioApiObj
|
|
Event Data
Parameter
|
Description
|
|
|
nEvent
|
The type of event.
Supported values, with related parameters, are the following:
Mnemonic constant
|
Value
|
Meaning
|
EV_CASTING_PLAYER_START
|
1
|
Occurs when a player, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods.
Involved data parameters: none
|
EV_CASTING_PLAYER_PERC
|
2
|
Occurs during a player-based casting session to inform about the advancement percentage.
Involved data parameters:
nData1: Advancement of the casting session expressed in percentage
|
EV_CASTING_PLAYER_DONE
|
3
|
Occurs when a player completes a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code.
|
EV_CASTING_STREAM_MIXER_START
|
4
|
Occurs when a stream mixer, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods.
|
EV_CASTING_STREAM_MIXER_STOP
|
5
|
Occurs when a stream mixer, through a call to the the CastingStop method, stops a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
This event may also occur if the connection with the server should die for external reasons: in this case the error code would be reported inside the nData1 parameter.
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code. In case this parameter should indicate that an error occurred, be sure to close the casting session by calling the CastingStop method.
|
EV_CASTING_WMA_CLIENT_CONNECT
|
6
|
Occurs when a client is connected/disconnected on a WMA network session created through a call to CastingWmaNetworkOpenForStreamMixer or CastingWmaNetworkOpenForPlayer methods.
Involved data parameters:
nData1: Boolean value that specifies if the client was connected or disconnected.
Supported values are the following:
Value
|
Meaning
|
0
|
The client was disconnected
|
1
|
The client was connected
|
pBufferUnicode: String representing the IP address of the connected client.
|
EV_CASTING_LOOPBACK_START
|
7
|
Occurs when a WASAPI loopack device, through a call to the the CastingStart method, starts a casting session previously created by one between the CastingCreateFromWasapiLoopback, CastingWmaPubPointOpenFromWasapiLoopback or CastingWmaNetworkOpenFromWasapiLoopback methods.
This event is only intended for usage with Windows Vista and later versions.
|
EV_CASTING_LOOPBACK_STOP
|
8
|
Occurs when a WASAPI loopack device, through a call to the the CastingStop method, stops a casting session previously created by one between the CastingCreateFromStreamMixer, CastingWmaPubPointOpenForStreamMixer or CastingWmaNetworkOpenForStreamMixer methods and started through the CastingStart method .
This event may also occur if the connection with the server should die for external reasons: in this case the error code would be reported inside the nResult parameter.
Involved data parameters:
nData1: The result of the operation. See the LastError property for details about the returned result code. In case this parameter should indicate that an error occurred, be sure to close the casting session by calling the CastingStop method.
This event is only intended for usage with Windows Vista and later versions.
|
|
nCastingUniqueId
|
Unique identifier of the casting session returned by a previous call to CastingCreateFromPlayer, CastingWmaPubPointOpenForPlayer or CastingWmaNetworkOpenForPlayer methods.
|
nData1
|
Number representing the first parameter related to the event (see the events table above for details)
|
nData2
|
Number representing the second parameter related to the event (see the events table above for details)
|
pBufferUnicode
|
Pointer to a buffer containing a string of Unicode characters with text information about the event. Below a couple of snippets that show how to convert the buffer contents into a .NET string through marshaling:
Visual Basic .NET
|
Imports System.Runtime.InteropServices
Dim strInfo As String = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength)
strInfo = strInfo.Trim()
|
Visual C#
|
using System.Runtime.InteropServices;
string strInfo = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength);
strInfo = strInfo.Trim();
|
Visual C++ with MFC (Unmanaged)
|
CString strInfo;
strInfo.Format (L"Connection from IP %s", pBufferUnicode);
|
Visual Basic 6
|
Dim strInfo As String
strInfo = StrFromPtr (pBufferUnicode, nBufferLength)
|
|
nBufferLength
|
The length in characters of the buffer above
|