WebRTCでやれよ!と言われそうなところですが、 WebSocket+WebAudioの組み合わせで音声ストリーミングをシンプルに構成する方法を紹介してみます。
サーバーサイドは何でも良いのですが、
とりあえずNode.jsでtest.mp3
というサンプルファイルをpcmモジュールでデコードし、
wsでクライアントに垂れ流す作りにしておきます。
Shader "Distortion" | |
{ | |
Properties | |
{ | |
_Refraction ("Refraction", Range (0.00, 10.0)) = 1.0 | |
_Power ("Power", Range (1.00, 10.0)) = 1.0 | |
_AlphaPower ("Vertex Alpha Power", Range (1.00, 10.0)) = 1.0 | |
_BumpMap( "Normal Map", 2D ) = "bump" {} | |
_Cull ( "Face Culling", Int ) = 2 |
/// <summary> | |
/// Computes a point for a gun to aim at in order to hit a target using linear prediction. | |
/// Assumes a bullet with no gravity or drag. I.e. A bullet that maintains a constant. | |
/// velocity after it's been fired. | |
/// </summary> | |
public static Vector3 ComputeGunLead(Vector3 targetPos, Vector3 targetVel, Vector3 ownPos, Vector3 ownVel, float muzzleVelocity) | |
{ | |
// Extremely low muzzle velocities are unlikely to ever hit. This also prevents a | |
// possible division by zero if the muzzle velocity is zero for whatever reason. | |
if (muzzleVelocity < 1f) |
public static class DebugUtil | |
{ | |
public static void DumpRenderTexture(RenderTexture rt, string pngOutPath) | |
{ | |
var oldRT = RenderTexture.active; | |
var tex = new Texture2D(rt.width, rt.height); | |
RenderTexture.active = rt; | |
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); |
#include "UnityCG.cginc" | |
#pragma vertex vert | |
#pragma fragment frag | |
// in practice: only compile for gles2,gles3,metal | |
#pragma only_renderers framebufferfetch | |
struct appdata_t { | |
float4 vertex : POSITION; | |
float2 texcoord : TEXCOORD0; | |
}; |
// Developed by Tom Kail at Inkle | |
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT | |
// Must be placed within a folder named "Editor" | |
using System; | |
using System.Reflection; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; |
#pragma kernel Downscale | |
#pragma kernel GaussianBlurVertical | |
#pragma kernel GaussianBlurHorizontal | |
#pragma kernel BoxBlur | |
Texture2D<float4> _Source; | |
RWTexture2D<float4> _Dest; | |
float _Amount; | |
float2 _Size; |
// https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ | |
/* | |
** Photoshop & misc math | |
** Blending modes, RGB/HSL/Contrast/Desaturate | |
** | |
** Romain Dura | Romz | |
** Blog: http://blog.mouaif.org | |
** Post: http://blog.mouaif.org/?p=94 | |
*/ |
using UnityEditor; | |
using UnityEngine; | |
using System.Linq; | |
using UnityEditor.Callbacks; | |
namespace Ashkatchap { | |
public static class DefineSymbolUtil { | |
static readonly (string, string)[] TypeAndSymbol = new[] { | |
("UltEvents.UltEventBase, UltEvents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "USE_ULTEVENTS"), | |
}; |
To be able to make all procedures without pain you should have physical keyboard or just install ssh server and connect to your device shell from computer.
Folow this guide to setup ssh server.