aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs
diff options
context:
space:
mode:
authorSean Dague2008-03-13 12:29:56 +0000
committerSean Dague2008-03-13 12:29:56 +0000
commite7076d3d1598d32ce6fac56be766eadba24efd0e (patch)
tree6787fa41207d9fbdc2440752b34c172252b501a7 /OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs
parent* Change opensim.ini.example guidance on asset_database setting to be "local"... (diff)
downloadopensim-SC_OLD-e7076d3d1598d32ce6fac56be766eadba24efd0e.zip
opensim-SC_OLD-e7076d3d1598d32ce6fac56be766eadba24efd0e.tar.gz
opensim-SC_OLD-e7076d3d1598d32ce6fac56be766eadba24efd0e.tar.bz2
opensim-SC_OLD-e7076d3d1598d32ce6fac56be766eadba24efd0e.tar.xz
remove the rex based voice chat. No current client implements this,
and a seperate voice server approach compatible with SLVoice is needed here.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs85
1 files changed, 0 insertions, 85 deletions
diff --git a/OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs b/OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs
deleted file mode 100644
index 241d156..0000000
--- a/OpenSim/Region/Environment/Modules/VoiceChat/VoicePacket.cs
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenSim.Region.Environment.Modules.VoiceChat
34{
35 public enum VoiceCodec
36 {
37 None = 0,
38 PCM8 = 1 << 0,
39 PCM16 = 1 << 1,
40 PCM32 = 1 << 2,
41 Speex = 1 << 3,
42 }
43
44 public class VoicePacket
45 {
46 public LLUUID m_clientId;
47 byte[] m_audioData;
48 public int m_codec;
49
50 public VoicePacket(byte[] data)
51 {
52 int pos = 0;
53 m_codec = data[pos++];
54 m_codec |= data[pos++] << 8;
55 m_codec |= data[pos++] << 16;
56 m_codec |= data[pos++] << 24;
57
58 m_audioData = new byte[data.Length - pos];
59 Buffer.BlockCopy(data, pos, m_audioData, 0, data.Length - pos);
60 }
61
62 public byte[] GetBytes()
63 {
64 VoicePacketHeader header = new VoicePacketHeader();
65 byte[] bytes = new byte[5+16+4+m_audioData.Length];
66
67 header.length = bytes.Length-5;
68
69 //ToClient packets are type 2
70 header.type = 2;
71
72 int pos = 0;
73 header.CopyTo(bytes, pos); pos += 5;
74 m_clientId.GetBytes().CopyTo(bytes, pos); pos += 16;
75
76 bytes[pos++] = (byte)((m_codec) % 256);
77 bytes[pos++] = (byte)((m_codec << 8) % 256);
78 bytes[pos++] = (byte)((m_codec << 16) % 256);
79 bytes[pos++] = (byte)((m_codec << 24) % 256);
80
81 m_audioData.CopyTo(bytes, pos);
82 return bytes;
83 }
84 }
85}