Esempio n. 1
0
    /// <summary>
    /// Create holograms representing sounds in real world based on information from microphones
    /// </summary>
    public void generateSoundObjects()
    {
        //If there are objects to parse, then we continue
        if (objs != null)
        {
            //lists of all sounds, loudness values, and first frame IDs
            List <Vector3> soundLocations = objs.getPositions();
            List <double>  loudnessValues = objs.getLoudness();
            List <int>     firstFrameIDs  = objs.getFirstFrameIDs();

            //Loop through all sounds and loudness values
            for (int i = 0; i < soundLocations.Count; i++)
            {
                Vector3 pos          = soundLocations[i];
                double  loudness     = loudnessValues[i];
                int     firstFrameID = firstFrameIDs[i];
                //A sphere will not be created unless there is enough noise coming from that position
                if (loudness > soundThreshold)
                {
                    if (!checkForSound(firstFrameID))
                    {
                        createSphere(pos, firstFrameID);
                    }
                }
            }
            //Remove all elements in the JSON list
            objs = null;
        }
    }