Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MrHangover/WAVES
Browse files Browse the repository at this point in the history
  • Loading branch information
tdbe committed Jan 22, 2017
2 parents 51e7652 + 52c0b10 commit 0dce6a1
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 6 deletions.
Binary file added Assets/Prefabs/Level.prefab
Binary file not shown.
Binary file removed Assets/Prefabs/LevelAssests (1).prefab
Binary file not shown.
Binary file modified Assets/Prefabs/LevelPrefabs/Player.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/MenuCanvas.prefab
Binary file not shown.
Binary file modified Assets/Scenes/TheLevel.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Scripts/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class Menu : MonoBehaviour {

[SerializeField] GameObject barParent;
[SerializeField] GameObject barText;
[SerializeField] Toggle avgToggle;



// Use this for initialization
void Start () {
Expand All @@ -44,6 +47,11 @@ void Update () {
if (Input.GetKeyDown (KeyCode.F)) {
ShowHideBars ();
}

if (Input.GetKeyDown (KeyCode.A)) {
WaveManager.instance.useAvg = !WaveManager.instance.useAvg;
avgToggle.isOn = WaveManager.instance.useAvg;
}

}

Expand Down
13 changes: 10 additions & 3 deletions Assets/Scripts/WaveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public class WaveManager : MonoBehaviour {
public bool isMakingWaves = true;

public float amplitudeModifier = 2f;
public float mapMin = -25f;
public float mapMin = -27f;
public float mapMax = 10f;
public bool useAvg = true;

//Privates
List<WaveObject> colliderPillars;
Expand Down Expand Up @@ -99,14 +100,20 @@ void FixedUpdate () {
{
if (FrequencyAnalysis.instance != null) {
//freq = MapToCalibration((FrequencyAnalysis.instance.MapToCalibration(frequencyAndAmp[0].Key)));
freq = TotalMap(FrequencyAnalysis.instance.avgFreq);
if(useAvg){
freq = TotalMap(FrequencyAnalysis.instance.avgFreq);
}
else{
freq = TotalMap(FrequencyAnalysis.instance.frequencyAndAmp[0].Key);
}

amp = Mathf.Clamp (frequencyAndAmp [0].Value * amplitudeModifier, 0, 10f);
}

}
if (FrequencyAnalysis.instance != null) {
//float hejmartin = FrequencyAnalysis.instance.MapToCalibration(frequencyAndAmp[0].Key);
Debug.Log("FREQ: " +frequencyAndAmp[0].Key +" "+ freq+" AMP: "+amp);
//Debug.Log("FREQ: " +frequencyAndAmp[0].Key +" "+ freq+" AMP: "+amp);
}

//Moving the physical pillars
Expand Down
9 changes: 6 additions & 3 deletions Assets/Scripts/soundscripts/FrequencyAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ void Start() {
print (Microphone.devices.Length);
aso.clip = Microphone.Start (Microphone.devices[microphoneNr], true, 1, 44100);
while (!(Microphone.GetPosition(null) > 0)){}
aso.Play ();
aso.loop = true;

aso.Play ();




numberleft = new float[numSamples];
volumeSamples = new float[numSamples];

Expand All @@ -100,9 +104,7 @@ void Start() {
// Update is called once per frame
void Update () {
numberleft = new float[numSamples];

aso.GetSpectrumData (numberleft, 0,FFTWindow.BlackmanHarris);

// 22050/samplenumber = 10.7
// TO FIND ELEMENT IN ARRAY:
// FrequencyYouWant / 10.7(result from last)
Expand Down Expand Up @@ -223,6 +225,7 @@ void Update () {
avgFreq /= frequencyAndAmp.Count;
//print ("----------------------------");
//print (avgFreq);

}


Expand Down
Binary file added Assets/mic.mixer
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/mic.mixer.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Assets/minotaurDestroy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class minotaurDestroy : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnCollisionEnter2D(Collision2D other)
{
Destroy(gameObject);
}
}

0 comments on commit 0dce6a1

Please sign in to comment.