Skip to content

Instantly share code, notes, and snippets.

View haydenjameslee's full-sized avatar

Hayden Lee haydenjameslee

View GitHub Profile
using UnityEngine;
public class PhotonNetworkManager : Photon.PunBehaviour
{
void Awake()
{
PhotonNetwork.autoJoinLobby = false;
}
void Start()
// Load required modules
var http = require("http"); // http server core module
var express = require("express"); // web framework external module
var serveStatic = require('serve-static'); // serve static files
var socketIo = require("socket.io"); // web socket external module
var easyrtc = require("easyrtc"); // EasyRTC external module
// Set process name
process.title = "node-easyrtc";
/* global define, module, require */
/*!
Script: easyrtc_lang.js
Provides lang file.
About: License
Copyright (c) 2016, Priologic Software Inc.
All rights reserved.
@haydenjameslee
haydenjameslee / easyrtc-1.1.0.js
Last active August 5, 2017 13:06
Copy of easyrtc 1.1.0
/* global define, module, require */
/*!
Script: easyrtc_lang.js
Provides lang file.
About: License
Copyright (c) 2016, Priologic Software Inc.
All rights reserved.
// Assuming you're following this template:
https://github.com/aframevr/aframe/blob/v0.5.0/examples/showcase/tracked-controls/index.html
// These are the hands:
<a-entity hand-controls="left" aabb-collider="objects: .cube;" grab></a-entity>
<a-entity hand-controls="right" aabb-collider="objects: .cube;" grab></a-entity>
// Add #id's to the hands:
using System;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(SteamVR_TrackedObject))]
public class ViveTouchpadScroll : MonoBehaviour
{
Vector2 scrollDelta = Vector2.zero;
Vector2 lastTouchpadPosition = Vector2.zero;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Assets.Scripts.Helpers
{
public class TransformLerp : MonoBehaviour
{
public float lerpSpeed = 1f;
public override bool GetAudioBytes(int streamId, int bufferSize, out byte[] bytes, out int receivedBytes)
{
//Debug.Log("Get coherent audio data. Bytes = " + bufferSize);
IntPtr audioBuffer = Marshal.AllocHGlobal(bufferSize);
// When you need more data to play for stream #streamID
//int timeout = 0; // A zero timeout means block until data is received
receivedBytes = m_View.GetAudioData(streamId, audioBuffer, bufferSize, 0);
if (receivedBytes <= 0)
public class FMODStreamPlayer
{
public PCMAudioProducer audioProducer;
public uint bufferSize = 8192;
public float gain = 0.5f;
public static int toneFrequency = 120;
FMOD.System fmodSystem;
Sound sound;
@haydenjameslee
haydenjameslee / CoherentWebAudioPlayer.cs
Created January 19, 2016 00:07
Gets PCM audio data from a CoherentUI browser in Unity3D and plays it through a Unity audio filter.
using UnityEngine;
using System.Collections;
using Coherent.UI;
using System.IO;
using System;
using System.Runtime.InteropServices;
[RequireComponent(typeof(CoherentUIView))]
[RequireComponent(typeof(AudioSource))]
unsafe public class CoherentAudioPlayerFilter : MonoBehaviour