mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Voice, decompress
This commit is contained in:
parent
865f85bc53
commit
e70f1b738b
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@ -110,5 +111,35 @@ internal unsafe void Update()
|
||||
IsRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe bool Decompress( byte[] input, int inputoffset, int inputsize, MemoryStream output, uint samepleRate = 0 )
|
||||
{
|
||||
if ( samepleRate == 0 )
|
||||
samepleRate = OptimalSampleRate;
|
||||
|
||||
//
|
||||
// Guessing the uncompressed size cuz we're dicks
|
||||
//
|
||||
{
|
||||
var targetBufferSize = inputsize * 10;
|
||||
|
||||
if ( output.Capacity < targetBufferSize )
|
||||
output.Capacity = targetBufferSize;
|
||||
|
||||
output.SetLength( targetBufferSize );
|
||||
}
|
||||
|
||||
fixed ( byte* pout = output.GetBuffer() )
|
||||
fixed ( byte* p = input )
|
||||
{
|
||||
uint bytesOut = 0;
|
||||
var result = (Valve.Steamworks.EVoiceResult) client.native.user.DecompressVoice( (IntPtr)( p + inputoffset ), (uint) inputsize, (IntPtr) pout, (uint) output.Length, ref bytesOut, (uint)samepleRate );
|
||||
|
||||
if ( bytesOut > 0 )
|
||||
output.SetLength( bytesOut );
|
||||
|
||||
return result == Valve.Steamworks.EVoiceResult.k_EVoiceResultOK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,7 +117,6 @@
|
||||
<Compile Include="Client.Overlay.cs" />
|
||||
<Compile Include="Client.ServerList.cs" />
|
||||
<Compile Include="Client.ServerList.Request.cs" />
|
||||
<Compile Include="Client.Voice.cs" />
|
||||
<Compile Include="Client.Auth.cs" />
|
||||
<Compile Include="Client.cs" />
|
||||
<Compile Include="Client\App.cs" />
|
||||
@ -125,6 +124,7 @@
|
||||
<Compile Include="Client\Image.cs" />
|
||||
<Compile Include="Client\Inventory.cs" />
|
||||
<Compile Include="Client\Stats.cs" />
|
||||
<Compile Include="Client\Voice.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="steam_api_interop.cs" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user