Split voice classes out to their own library
This commit is contained in:
52
LibreMetaverse.Voice/LibreMetaverse.Voice.csproj
Normal file
52
LibreMetaverse.Voice/LibreMetaverse.Voice.csproj
Normal file
@@ -0,0 +1,52 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>LibreMetaverse.Voice</AssemblyName>
|
||||
<PackageId>LibreMetaverse.Voice</PackageId>
|
||||
<Description>Library interface for Vivox voice client</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>LibreMetaverse</RootNamespace>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<NoWarn>0419,1574,1591</NoWarn>
|
||||
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
|
||||
<Platforms>x64;x86;AnyCPU</Platforms>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibreMetaverse\LibreMetaverse.csproj" />
|
||||
<ProjectReference Include="..\LibreMetaverse.StructuredData\LibreMetaverse.StructuredData.csproj" />
|
||||
<ProjectReference Include="..\LibreMetaverse.Types\LibreMetaverse.Types.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE.txt" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\data\logo.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -29,7 +29,7 @@ using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public class TCPPipe
|
||||
{
|
||||
@@ -1,80 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021-2022, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to login a specific user account(s). It may only be called after
|
||||
/// Connector initialization has completed successfully
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="AccountName">User's account name</param>
|
||||
/// <param name="AccountPassword">User's account password</param>
|
||||
/// <param name="AudioSessionAnswerMode">Values may be “AutoAnswer” or “VerifyAnswer”</param>
|
||||
/// <param name="AccountURI">""</param>
|
||||
/// <param name="ParticipantPropertyFrequency">This is an integer that specifies how often
|
||||
/// the daemon will send participant property events while in a channel. If this is not set
|
||||
/// the default will be “on state change”, which means that the events will be sent when
|
||||
/// the participant starts talking, stops talking, is muted, is unmuted.
|
||||
/// The valid values are:
|
||||
/// 0 – Never
|
||||
/// 5 – 10 times per second
|
||||
/// 10 – 5 times per second
|
||||
/// 50 – 1 time per second
|
||||
/// 100 – on participant state change (this is the default)</param>
|
||||
/// <param name="EnableBuddiesAndPresence">false</param>
|
||||
/// <returns></returns>
|
||||
public int AccountLogin(string ConnectorHandle, string AccountName, string AccountPassword, string AudioSessionAnswerMode, string AccountURI, int ParticipantPropertyFrequency, bool EnableBuddiesAndPresence)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountName", AccountName));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountPassword", AccountPassword));
|
||||
sb.Append(VoiceGateway.MakeXML("AudioSessionAnswerMode", AudioSessionAnswerMode));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountURI", AccountURI));
|
||||
sb.Append(VoiceGateway.MakeXML("ParticipantPropertyFrequency", ParticipantPropertyFrequency.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("EnableBuddiesAndPresence", EnableBuddiesAndPresence ? "true" : "false"));
|
||||
sb.Append(VoiceGateway.MakeXML("BuddyManagementMode", "Application"));
|
||||
return Request("Account.Login.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to logout a user session. It should only be called with a valid AccountHandle.
|
||||
/// </summary>
|
||||
/// <param name="AccountHandle">Handle returned from successful Connector ‘login’ request</param>
|
||||
/// <returns></returns>
|
||||
public int AccountLogout(string AccountHandle)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("AccountHandle", AccountHandle);
|
||||
return Request("Account.Logout.1", RequestXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021-2022, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to login a specific user account(s). It may only be called after
|
||||
/// Connector initialization has completed successfully
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="AccountName">User's account name</param>
|
||||
/// <param name="AccountPassword">User's account password</param>
|
||||
/// <param name="AudioSessionAnswerMode">Values may be “AutoAnswer” or “VerifyAnswer”</param>
|
||||
/// <param name="AccountURI">""</param>
|
||||
/// <param name="ParticipantPropertyFrequency">This is an integer that specifies how often
|
||||
/// the daemon will send participant property events while in a channel. If this is not set
|
||||
/// the default will be “on state change”, which means that the events will be sent when
|
||||
/// the participant starts talking, stops talking, is muted, is unmuted.
|
||||
/// The valid values are:
|
||||
/// 0 – Never
|
||||
/// 5 – 10 times per second
|
||||
/// 10 – 5 times per second
|
||||
/// 50 – 1 time per second
|
||||
/// 100 – on participant state change (this is the default)</param>
|
||||
/// <param name="EnableBuddiesAndPresence">false</param>
|
||||
/// <returns></returns>
|
||||
public int AccountLogin(string ConnectorHandle, string AccountName, string AccountPassword, string AudioSessionAnswerMode, string AccountURI, int ParticipantPropertyFrequency, bool EnableBuddiesAndPresence)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountName", AccountName));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountPassword", AccountPassword));
|
||||
sb.Append(VoiceGateway.MakeXML("AudioSessionAnswerMode", AudioSessionAnswerMode));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountURI", AccountURI));
|
||||
sb.Append(VoiceGateway.MakeXML("ParticipantPropertyFrequency", ParticipantPropertyFrequency.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("EnableBuddiesAndPresence", EnableBuddiesAndPresence ? "true" : "false"));
|
||||
sb.Append(VoiceGateway.MakeXML("BuddyManagementMode", "Application"));
|
||||
return Request("Account.Login.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to logout a user session. It should only be called with a valid AccountHandle.
|
||||
/// </summary>
|
||||
/// <param name="AccountHandle">Handle returned from successful Connector ‘login’ request</param>
|
||||
/// <returns></returns>
|
||||
public int AccountLogout(string AccountHandle)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("AccountHandle", AccountHandle);
|
||||
return Request("Account.Logout.1", RequestXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to get a list of audio devices that can be used for capture (input) of voice.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int AuxGetCaptureDevices()
|
||||
{
|
||||
return Request("Aux.GetCaptureDevices.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to get a list of audio devices that can be used for render (playback) of voice.
|
||||
/// </summary>
|
||||
public int AuxGetRenderDevices()
|
||||
{
|
||||
return Request("Aux.GetRenderDevices.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to select the render device.
|
||||
/// </summary>
|
||||
/// <param name="RenderDeviceSpecifier">The name of the device as returned by the Aux.GetRenderDevices command.</param>
|
||||
public int AuxSetRenderDevice(string RenderDeviceSpecifier)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("RenderDeviceSpecifier", RenderDeviceSpecifier);
|
||||
return Request("Aux.SetRenderDevice.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to select the capture device.
|
||||
/// </summary>
|
||||
/// <param name="CaptureDeviceSpecifier">The name of the device as returned by the Aux.GetCaptureDevices command.</param>
|
||||
public int AuxSetCaptureDevice(string CaptureDeviceSpecifier)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("CaptureDeviceSpecifier", CaptureDeviceSpecifier);
|
||||
return Request("Aux.SetCaptureDevice.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to start the audio capture process which will cause
|
||||
/// AuxAudioProperty Events to be raised. These events can be used to display a
|
||||
/// microphone VU meter for the currently selected capture device. This command
|
||||
/// should not be issued if the user is on a call.
|
||||
/// </summary>
|
||||
/// <param name="Duration">(unused but required)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxCaptureAudioStart(int Duration)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Duration", Duration.ToString());
|
||||
return Request("Aux.CaptureAudioStart.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to stop the audio capture process.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int AuxCaptureAudioStop()
|
||||
{
|
||||
return Request("Aux.CaptureAudioStop.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to set the mic volume while in the audio tuning process.
|
||||
/// Once an acceptable mic level is attained, the application must issue a
|
||||
/// connector set mic volume command to have that level be used while on voice
|
||||
/// calls.
|
||||
/// </summary>
|
||||
/// <param name="Level">the microphone volume (-100 to 100 inclusive)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxSetMicLevel(int Level)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Level", Level.ToString());
|
||||
return Request("Aux.SetMicLevel.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to set the speaker volume while in the audio tuning
|
||||
/// process. Once an acceptable speaker level is attained, the application must
|
||||
/// issue a connector set speaker volume command to have that level be used while
|
||||
/// on voice calls.
|
||||
/// </summary>
|
||||
/// <param name="Level">the speaker volume (-100 to 100 inclusive)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxSetSpeakerLevel(int Level)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Level", Level.ToString());
|
||||
return Request("Aux.SetSpeakerLevel.1", RequestXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021-2022, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to get a list of audio devices that can be used for capture (input) of voice.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int AuxGetCaptureDevices()
|
||||
{
|
||||
return Request("Aux.GetCaptureDevices.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to get a list of audio devices that can be used for render (playback) of voice.
|
||||
/// </summary>
|
||||
public int AuxGetRenderDevices()
|
||||
{
|
||||
return Request("Aux.GetRenderDevices.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to select the render device.
|
||||
/// </summary>
|
||||
/// <param name="RenderDeviceSpecifier">The name of the device as returned by the Aux.GetRenderDevices command.</param>
|
||||
public int AuxSetRenderDevice(string RenderDeviceSpecifier)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("RenderDeviceSpecifier", RenderDeviceSpecifier);
|
||||
return Request("Aux.SetRenderDevice.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to select the capture device.
|
||||
/// </summary>
|
||||
/// <param name="CaptureDeviceSpecifier">The name of the device as returned by the Aux.GetCaptureDevices command.</param>
|
||||
public int AuxSetCaptureDevice(string CaptureDeviceSpecifier)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("CaptureDeviceSpecifier", CaptureDeviceSpecifier);
|
||||
return Request("Aux.SetCaptureDevice.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to start the audio capture process which will cause
|
||||
/// AuxAudioProperty Events to be raised. These events can be used to display a
|
||||
/// microphone VU meter for the currently selected capture device. This command
|
||||
/// should not be issued if the user is on a call.
|
||||
/// </summary>
|
||||
/// <param name="Duration">(unused but required)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxCaptureAudioStart(int Duration)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Duration", Duration.ToString());
|
||||
return Request("Aux.CaptureAudioStart.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to stop the audio capture process.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int AuxCaptureAudioStop()
|
||||
{
|
||||
return Request("Aux.CaptureAudioStop.1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to set the mic volume while in the audio tuning process.
|
||||
/// Once an acceptable mic level is attained, the application must issue a
|
||||
/// connector set mic volume command to have that level be used while on voice
|
||||
/// calls.
|
||||
/// </summary>
|
||||
/// <param name="Level">the microphone volume (-100 to 100 inclusive)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxSetMicLevel(int Level)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Level", Level.ToString());
|
||||
return Request("Aux.SetMicLevel.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This command is used to set the speaker volume while in the audio tuning
|
||||
/// process. Once an acceptable speaker level is attained, the application must
|
||||
/// issue a connector set speaker volume command to have that level be used while
|
||||
/// on voice calls.
|
||||
/// </summary>
|
||||
/// <param name="Level">the speaker volume (-100 to 100 inclusive)</param>
|
||||
/// <returns></returns>
|
||||
public int AuxSetSpeakerLevel(int Level)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("Level", Level.ToString());
|
||||
return Request("Aux.SetSpeakerLevel.1", RequestXML);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to initialize and stop the Connector as a whole. The Connector
|
||||
/// Create call must be completed successfully before any other requests are made
|
||||
/// (typically during application initialization). The shutdown should be called
|
||||
/// when the application is shutting down to gracefully release resources
|
||||
/// </summary>
|
||||
/// <param name="ClientName">A string value indicting the Application name</param>
|
||||
/// <param name="AccountManagementServer">URL for the management server</param>
|
||||
/// <param name="Logging">LoggingSettings</param>
|
||||
/// <param name="MaximumPort"></param>
|
||||
/// <param name="MinimumPort"></param>
|
||||
public int ConnectorCreate(string ClientName, string AccountManagementServer, ushort MinimumPort,
|
||||
ushort MaximumPort, VoiceLoggingSettings Logging)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ClientName", ClientName));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountManagementServer", AccountManagementServer));
|
||||
sb.Append(VoiceGateway.MakeXML("MinimumPort", MinimumPort.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("MaximumPort", MaximumPort.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("Mode", "Normal"));
|
||||
sb.Append("<Logging>");
|
||||
sb.Append(VoiceGateway.MakeXML("Enabled", Logging.Enabled ? "true" : "false"));
|
||||
sb.Append(VoiceGateway.MakeXML("Folder", Logging.Folder));
|
||||
sb.Append(VoiceGateway.MakeXML("FileNamePrefix", Logging.FileNamePrefix));
|
||||
sb.Append(VoiceGateway.MakeXML("FileNameSuffix", Logging.FileNameSuffix));
|
||||
sb.Append(VoiceGateway.MakeXML("LogLevel", Logging.LogLevel.ToString()));
|
||||
sb.Append("</Logging>");
|
||||
return Request("Connector.Create.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shutdown Connector -- Should be called when the application is shutting down
|
||||
/// to gracefully release resources
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
public int ConnectorInitiateShutdown(string ConnectorHandle)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle);
|
||||
return Request("Connector.InitiateShutdown.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mute or unmute the microphone
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Mute">true (mute) or false (unmute)</param>
|
||||
public int ConnectorMuteLocalMic(string ConnectorHandle, bool Mute)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Mute ? "true" : "false"));
|
||||
return Request("Connector.MuteLocalMic.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mute or unmute the speaker
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Mute">true (mute) or false (unmute)</param>
|
||||
public int ConnectorMuteLocalSpeaker(string ConnectorHandle, bool Mute)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Mute ? "true" : "false"));
|
||||
return Request("Connector.MuteLocalSpeaker.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set microphone volume
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Value">The level of the audio, a number between -100 and 100 where
|
||||
/// 0 represents ‘normal’ speaking volume</param>
|
||||
public int ConnectorSetLocalMicVolume(string ConnectorHandle, int Value)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Value.ToString()));
|
||||
return Request("Connector.SetLocalMicVolume.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set local speaker volume
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Value">The level of the audio, a number between -100 and 100 where
|
||||
/// 0 represents ‘normal’ speaking volume</param>
|
||||
public int ConnectorSetLocalSpeakerVolume(string ConnectorHandle, int Value)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Value.ToString()));
|
||||
return Request("Connector.SetLocalSpeakerVolume.1", sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021-2022, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to initialize and stop the Connector as a whole. The Connector
|
||||
/// Create call must be completed successfully before any other requests are made
|
||||
/// (typically during application initialization). The shutdown should be called
|
||||
/// when the application is shutting down to gracefully release resources
|
||||
/// </summary>
|
||||
/// <param name="ClientName">A string value indicting the Application name</param>
|
||||
/// <param name="AccountManagementServer">URL for the management server</param>
|
||||
/// <param name="Logging">LoggingSettings</param>
|
||||
/// <param name="MaximumPort"></param>
|
||||
/// <param name="MinimumPort"></param>
|
||||
public int ConnectorCreate(string ClientName, string AccountManagementServer, ushort MinimumPort,
|
||||
ushort MaximumPort, VoiceLoggingSettings Logging)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ClientName", ClientName));
|
||||
sb.Append(VoiceGateway.MakeXML("AccountManagementServer", AccountManagementServer));
|
||||
sb.Append(VoiceGateway.MakeXML("MinimumPort", MinimumPort.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("MaximumPort", MaximumPort.ToString()));
|
||||
sb.Append(VoiceGateway.MakeXML("Mode", "Normal"));
|
||||
sb.Append("<Logging>");
|
||||
sb.Append(VoiceGateway.MakeXML("Enabled", Logging.Enabled ? "true" : "false"));
|
||||
sb.Append(VoiceGateway.MakeXML("Folder", Logging.Folder));
|
||||
sb.Append(VoiceGateway.MakeXML("FileNamePrefix", Logging.FileNamePrefix));
|
||||
sb.Append(VoiceGateway.MakeXML("FileNameSuffix", Logging.FileNameSuffix));
|
||||
sb.Append(VoiceGateway.MakeXML("LogLevel", Logging.LogLevel.ToString()));
|
||||
sb.Append("</Logging>");
|
||||
return Request("Connector.Create.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shutdown Connector -- Should be called when the application is shutting down
|
||||
/// to gracefully release resources
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
public int ConnectorInitiateShutdown(string ConnectorHandle)
|
||||
{
|
||||
string RequestXML = VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle);
|
||||
return Request("Connector.InitiateShutdown.1", RequestXML);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mute or unmute the microphone
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Mute">true (mute) or false (unmute)</param>
|
||||
public int ConnectorMuteLocalMic(string ConnectorHandle, bool Mute)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Mute ? "true" : "false"));
|
||||
return Request("Connector.MuteLocalMic.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mute or unmute the speaker
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Mute">true (mute) or false (unmute)</param>
|
||||
public int ConnectorMuteLocalSpeaker(string ConnectorHandle, bool Mute)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Mute ? "true" : "false"));
|
||||
return Request("Connector.MuteLocalSpeaker.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set microphone volume
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Value">The level of the audio, a number between -100 and 100 where
|
||||
/// 0 represents ‘normal’ speaking volume</param>
|
||||
public int ConnectorSetLocalMicVolume(string ConnectorHandle, int Value)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Value.ToString()));
|
||||
return Request("Connector.SetLocalMicVolume.1", sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set local speaker volume
|
||||
/// </summary>
|
||||
/// <param name="ConnectorHandle">Handle returned from successful Connector ‘create’ request</param>
|
||||
/// <param name="Value">The level of the audio, a number between -100 and 100 where
|
||||
/// 0 represents ‘normal’ speaking volume</param>
|
||||
public int ConnectorSetLocalSpeakerVolume(string ConnectorHandle, int Value)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(VoiceGateway.MakeXML("ConnectorHandle", ConnectorHandle));
|
||||
sb.Append(VoiceGateway.MakeXML("Value", Value.ToString()));
|
||||
return Request("Connector.SetLocalSpeakerVolume.1", sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,10 +31,11 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Http;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway : IDisposable
|
||||
{
|
||||
@@ -28,8 +28,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
@@ -32,8 +32,9 @@ using System.Net.Sockets;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceGateway
|
||||
{
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,143 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenMetaverse.Utilities
|
||||
{
|
||||
public partial class VoiceManager
|
||||
{
|
||||
/// <summary>Amount of time to wait for the voice daemon to respond.
|
||||
/// The value needs to stay relatively high because some of the calls
|
||||
/// require the voice daemon to make remote queries before replying</summary>
|
||||
public int BlockingTimeout = 30 * 1000;
|
||||
|
||||
protected Dictionary<int, AutoResetEvent> Events = new Dictionary<int, AutoResetEvent>();
|
||||
|
||||
public List<string> CaptureDevices()
|
||||
{
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestCaptureDevices() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return evt.WaitOne(BlockingTimeout, false) ? CurrentCaptureDevices() : new List<string>();
|
||||
}
|
||||
|
||||
public List<string> RenderDevices()
|
||||
{
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestRenderDevices() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return evt.WaitOne(BlockingTimeout, false) ? CurrentRenderDevices() : new List<string>();
|
||||
}
|
||||
|
||||
public string CreateConnector(out int status)
|
||||
{
|
||||
status = 0;
|
||||
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestCreateConnector() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var success = evt.WaitOne(BlockingTimeout, false);
|
||||
status = statusCode;
|
||||
|
||||
return success && statusCode == 0 ? connectorHandle : string.Empty;
|
||||
}
|
||||
|
||||
public string Login(string accountName, string password, string connectorHandle, out int status)
|
||||
{
|
||||
status = 0;
|
||||
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestLogin(accountName, password, connectorHandle) == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var success = evt.WaitOne(BlockingTimeout, false);
|
||||
status = statusCode;
|
||||
|
||||
return success && statusCode == 0 ? accountHandle : string.Empty;
|
||||
}
|
||||
|
||||
protected void RegisterCallbacks()
|
||||
{
|
||||
OnCaptureDevices += VoiceManager_OnCaptureDevices;
|
||||
OnRenderDevices += VoiceManager_OnRenderDevices;
|
||||
OnConnectorCreated += VoiceManager_OnConnectorCreated;
|
||||
OnLogin += VoiceManager_OnLogin;
|
||||
}
|
||||
|
||||
#region Callbacks
|
||||
|
||||
private void VoiceManager_OnCaptureDevices(int cookie, int statusCode, string statusString, string currentDevice)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnRenderDevices(int cookie, int statusCode, string statusString, string currentDevice)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnConnectorCreated(int cookie, int statusCode, string statusString, string connectorHandle)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnLogin(int cookie, int statusCode, string statusString, string accountHandle)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
#endregion Callbacks
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021-2022, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.co nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public partial class VoiceManager
|
||||
{
|
||||
/// <summary>Amount of time to wait for the voice daemon to respond.
|
||||
/// The value needs to stay relatively high because some of the calls
|
||||
/// require the voice daemon to make remote queries before replying</summary>
|
||||
public int BlockingTimeout = 30 * 1000;
|
||||
|
||||
protected Dictionary<int, AutoResetEvent> Events = new Dictionary<int, AutoResetEvent>();
|
||||
|
||||
public List<string> CaptureDevices()
|
||||
{
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestCaptureDevices() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return evt.WaitOne(BlockingTimeout, false) ? CurrentCaptureDevices() : new List<string>();
|
||||
}
|
||||
|
||||
public List<string> RenderDevices()
|
||||
{
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestRenderDevices() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return evt.WaitOne(BlockingTimeout, false) ? CurrentRenderDevices() : new List<string>();
|
||||
}
|
||||
|
||||
public string CreateConnector(out int status)
|
||||
{
|
||||
status = 0;
|
||||
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestCreateConnector() == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var success = evt.WaitOne(BlockingTimeout, false);
|
||||
status = statusCode;
|
||||
|
||||
return success && statusCode == 0 ? connectorHandle : string.Empty;
|
||||
}
|
||||
|
||||
public string Login(string accountName, string password, string connectorHandle, out int status)
|
||||
{
|
||||
status = 0;
|
||||
|
||||
var evt = new AutoResetEvent(false);
|
||||
Events[_CommandCookie] = evt;
|
||||
|
||||
if (RequestLogin(accountName, password, connectorHandle) == -1)
|
||||
{
|
||||
Events.Remove(_CommandCookie);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var success = evt.WaitOne(BlockingTimeout, false);
|
||||
status = statusCode;
|
||||
|
||||
return success && statusCode == 0 ? accountHandle : string.Empty;
|
||||
}
|
||||
|
||||
protected void RegisterCallbacks()
|
||||
{
|
||||
OnCaptureDevices += VoiceManager_OnCaptureDevices;
|
||||
OnRenderDevices += VoiceManager_OnRenderDevices;
|
||||
OnConnectorCreated += VoiceManager_OnConnectorCreated;
|
||||
OnLogin += VoiceManager_OnLogin;
|
||||
}
|
||||
|
||||
#region Callbacks
|
||||
|
||||
private void VoiceManager_OnCaptureDevices(int cookie, int statusCode, string statusString, string currentDevice)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnRenderDevices(int cookie, int statusCode, string statusString, string currentDevice)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnConnectorCreated(int cookie, int statusCode, string statusString, string connectorHandle)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
private void VoiceManager_OnLogin(int cookie, int statusCode, string statusString, string accountHandle)
|
||||
{
|
||||
if (Events.ContainsKey(cookie))
|
||||
Events[cookie].Set();
|
||||
}
|
||||
|
||||
#endregion Callbacks
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,9 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
public class VoiceParticipant
|
||||
{
|
||||
@@ -29,7 +29,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenMetaverse.Voice
|
||||
namespace LibreMetaverse.Voice
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single Voice Session to the Vivox service.
|
||||
@@ -56,6 +56,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GridAccountant", "Programs\
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.LslTools", "LibreMetaverse.LslTools\LibreMetaverse.LslTools.csproj", "{989E5E15-D99B-4CF1-AF64-90C568FC979A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.Voice", "LibreMetaverse.Voice\LibreMetaverse.Voice.csproj", "{FB07C6DE-F791-4336-B6E2-B32EEAC34792}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -381,6 +383,24 @@ Global
|
||||
{989E5E15-D99B-4CF1-AF64-90C568FC979A}.ReleaseNoGui|x64.Build.0 = Release|Any CPU
|
||||
{989E5E15-D99B-4CF1-AF64-90C568FC979A}.ReleaseNoGui|x86.ActiveCfg = Release|Any CPU
|
||||
{989E5E15-D99B-4CF1-AF64-90C568FC979A}.ReleaseNoGui|x86.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|x64.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|x64.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|x64.Build.0 = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|x86.ActiveCfg = Release|Any CPU
|
||||
{FB07C6DE-F791-4336-B6E2-B32EEAC34792}.ReleaseNoGui|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -28,7 +28,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Utilities;
|
||||
using LibreMetaverse.Voice;
|
||||
|
||||
namespace VoiceTest
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\LibreMetaverse\LibreMetaverse.csproj" />
|
||||
<ProjectReference Include="..\..\LibreMetaverse.Types\LibreMetaverse.Types.csproj" />
|
||||
<ProjectReference Include="..\..\LibreMetaverse.Utilities\LibreMetaverse.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\LibreMetaverse.Voice\LibreMetaverse.Voice.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="\" />
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenMetaverse.Utilities;
|
||||
using LibreMetaverse.Voice;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<ProjectReference Include="..\..\..\LibreMetaverse\LibreMetaverse.csproj" />
|
||||
<ProjectReference Include="..\..\..\LibreMetaverse.StructuredData\LibreMetaverse.StructuredData.csproj" />
|
||||
<ProjectReference Include="..\..\..\LibreMetaverse.Types\LibreMetaverse.Types.csproj" />
|
||||
<ProjectReference Include="..\..\..\LibreMetaverse.Utilities\LibreMetaverse.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\..\LibreMetaverse.Voice\LibreMetaverse.Voice.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||
|
||||
Reference in New Issue
Block a user