void AssignCurrentSong() { currentSong = songs[activeSongCounter]; songObjectScript = currentSong.GetComponent <SongObjectScript>(); songObjectScript.setupSong(); songNameText.text = songObjectScript.GetSongName(); }
public void CalculateFinalScore() { CompletionScript completionScript = GameObject.Find("CompletionUI").GetComponent <CompletionScript>(); SongObjectScript songObjectScript = (SongObjectScript)FindObjectOfType(typeof(SongObjectScript)); currentHighScore = completionScript.getHighScore(); userScore = completionScript.getUserScore(); songName = songObjectScript.GetSongName(); }
// Start is called before the first frame update void Start() { try { song = FindObjectOfType <SongObjectScript>(); songName = song.GetSongName(); } catch (System.Exception e) { // Catch for when song doesn't load, spawn objects with no sound (testing purposes only) songName = "test"; } }
void Start() { SongObjectScript song = findSong(); audioSource = song.GetAudioSource(); Debug.Log(song.GetBPM()); song.PlayAudio(); // Process audio as it plays if (realTimeSamples) { realTimeSpectrum = new float[1024]; realTimeSpectralFluxAnalyzer = new SpectralFluxAnalyzer(); realTimePlotController = GameObject.Find("RealtimePlot").GetComponent <NoteGenerator> (); this.sampleRate = AudioSettings.outputSampleRate; } // Preprocess entire audio file upfront if (preProcessSamples) { preProcessedSpectralFluxAnalyzer = new SpectralFluxAnalyzer(); preProcessedPlotController = GameObject.Find("PreprocessedPlot").GetComponent <NoteGenerator>(); // Need all audio samples. If in stereo, samples will return with left and right channels interweaved // [L,R,L,R,L,R] multiChannelSamples = new float[audioSource.clip.samples * audioSource.clip.channels]; numChannels = audioSource.clip.channels; numTotalSamples = audioSource.clip.samples; clipLength = audioSource.clip.length; // We are not evaluating the audio as it is being played by Unity, so we need the clip's sampling rate this.sampleRate = audioSource.clip.frequency; audioSource.clip.GetData(multiChannelSamples, 0); Debug.Log("GetData done"); Thread bgThread = new Thread(this.getFullSpectrumThreaded); Debug.Log("Starting Background Thread"); bgThread.Start(); } }
// Start is called before the first frame update void Start() { try { song = findSong(); // Finds SongObject in scene BPM = song.GetBPM(); // Gets selected Song's BPM songLength = song.GetAudioLength(); // Gets the song's length in seconds secondsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; startDelay = song.GetStartDelay(); difficultyMultiplier = song.GetDifficultyMultiplier(); Debug.Log("START A"); } catch (System.Exception e) { // Catch for when song doesn't load, spawn objects with no sound (testing purposes only) BPM = 60f; songLength = 60f; secondsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; difficultyMultiplier = 4; Debug.Log("START B"); } plotPoints = new List <Transform>(); float localWidth = transform.Find("Point/BasePoint").localScale.x; // -n/2...0...n/2 for (int i = 0; i < displayWindowSize; i++) { //Instantiate point Transform t = (Instantiate(Resources.Load("Prefabs/Point"), transform) as GameObject).transform; // Set position float pointX = (displayWindowSize / 2) * -1 * localWidth + i * localWidth; t.localPosition = new Vector3(pointX, t.localPosition.y, t.localPosition.z); plotPoints.Add(t); } }
// Start is called before the first frame update void Start() { try { song = findSong(); BPM = song.GetBPM(); // Gets selected Song's BPM Debug.Log(BPM); songLength = song.GetAudioLength(); // Gets the song's length in seconds Debug.Log(songLength); secsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; startDelay = song.GetStartDelay(); difficultyMultiplier = song.GetDifficultyMultiplier(); song.PlayAudio(); StartCoroutine(SpawnNote()); // Starts spawning Method } catch (Exception e) { // Catch for when song doesn't load, spawn objects with no sound (testing purposes only) BPM = 60f; songLength = 60f; secsPerBeat = 60f / BPM; // Calculates Seconds per Beat noteSpawnPositions = new Vector3[] { noteOneSpawn, noteTwoSpawn, noteThreeSpawn }; difficultyMultiplier = 4; StartCoroutine(SpawnNote()); // Starts spawning Method } }
private void FindHighScore() { song = (SongObjectScript)FindObjectOfType(typeof(SongObjectScript)); highScore = song.GetSongHighScore(); }
void Start() { song = findSong(); }