Ejemplo n.º 1
0
    private void MakeChartProcess()
    {
        //音楽ファイルの確認
        //※ファイルの有無はそのままのパス。
        //ただし、読み込み時は"file:"を付けローカルファイルの指定とする必要がある。

        GameMusic.Instance.LoadAndFunction(
            currentFilePath,
            //読み込み終了後の処理
            () =>
        {
            bpm = (uint)UniBpmAnalyzer.AnalyzeBpm(GameMusic.Instance.Clip);
            //MusicEngine 生成
            musicEngineObj  = Instantiate(Resources.Load <GameObject>("Prefab/MusicEngine"));
            var musicEngine = musicEngineObj.GetComponent <Music>();
            //MusicEngineの動的設定
            Music.CurrentSource.clip = GameMusic.Instance.Clip;
            var sec         = Music.GetSection(0);
            sec.Tempo       = bpm;
            sec.UnitPerBar  = int.Parse(unitPerBar.text);
            sec.UnitPerBeat = int.Parse(unitPerBeat.text);
            musicEngine.Setup();
            //audio
            GameMusic.Instance.Source = Music.CurrentSource;
            GameMusic.Instance.Source.Play();
            isExecute = true;
            //buttons
            mute.isEnabled    = true;
            execute.isEnabled = false;
            cancel.isEnabled  = true;
            //param
            executeFilePath = currentFilePath;
        }
            );
    }
Ejemplo n.º 2
0
    private void Start()
    {
        int bpm = UniBpmAnalyzer.AnalyzeBpm(targetClip);

        if (bpm < 0)
        {
            Debug.LogError("AudioClip is null.");
            return;
        }
    }
Ejemplo n.º 3
0
 private void Start()
 {
     currentBPM = UniBpmAnalyzer.AnalyzeBpm(targetClip);
     if (currentBPM <= 0)
     {
         Debug.LogError("AudioClip is null.");
         return;
     }
     StartBeat(currentBPM);
 }
Ejemplo n.º 4
0
    void Start()
    {
        source = GetComponent <AudioSource>();
        int bpm = UniBpmAnalyzer.AnalyzeBpm(source.clip);

        key_create_time = 30.0f / bpm;
        start_time      = Time.time;

        //保存ファイルの名付け
        fileName = "Resources/CSV/" + line_quantity.ToString() + "/" + source.clip.ToString();

        Debug.Log(source.clip.name + "--------------------" + "BPM" + bpm);
    }
Ejemplo n.º 5
0
    public void importSong2()
    {
        songListContainer = GameObject.FindGameObjectWithTag("ContentList");
        songbutton        = Resources.Load <GameObject>("Prefabs/Song");
        title             = songbutton.transform.GetChild(0).GetComponentInChildren <Text>();
        bpm = songbutton.transform.GetChild(1).GetComponentInChildren <Text>();

        songnum = songbutton.transform.GetChild(2).GetComponentInChildren <Text>();
        played  = songbutton.transform.GetChild(3).GetComponentInChildren <Text>();
        score   = songbutton.transform.GetChild(4).GetComponentInChildren <Text>();
        hit     = songbutton.transform.GetChild(5).GetComponentInChildren <Text>();
        missed  = songbutton.transform.GetChild(6).GetComponentInChildren <Text>();



        AudioSource audio = songbutton.GetComponent <AudioSource>();

        audio.clip = theMusic.clip;
        title.text = songName;

        BPM      = UniBpmAnalyzer.AnalyzeBpm(audio.clip);
        bpm.text = /*"bpm: " +*/ BPM.ToString();
        songNum++;
        songnum.text = songNum.ToString();

        if (allImportedSongNames.Contains(title.text))
        {
            // print("double " + title.text);
        }
        else
        {
            Instantiate(songbutton, songListContainer.transform);

            //save song
            loadInSaveFile.AddToList(songName, url /*, songNum*/);
            songNum++;
            allImportedSongNames.Add(title.text);

            browser.gameObject.SetActive(false);
            loadInSaveFile.SaveSongs();
        }
    }
Ejemplo n.º 6
0
    // Dont need to call this before calling getbpm/getbeattime
    // I did it anyway
    public void FindBpm()
    {
        //if (_audioSource.clip == null && _apm == null)
        //{
        //    //_audioSource = GetComponent<SongManager>().frontpeer.GetComponent<AudioSource>();
        //}

        //_audioSource = GetComponent<SongManager>().frontpeer.GetComponent<AudioSource>();

        if (_audioSource.clip == null)
        {
            if (_apm == null)
            {
                _bpm = UniBpmAnalyzer.AnalyzeBpm(GetComponent <SongManager>().frontpeer.GetComponent <AudioSource>().clip);
            }
            else
            {
                _bpm = UniBpmAnalyzer.AnalyzeBpm(_apm._sample2);
            }

            if (_bpm < 0)
            {
                Debug.LogError("AudioClip is null.");
                return;
            }

            _bpmTime = 60.0f / (float)_bpm;

            return;
        }

        _bpm = UniBpmAnalyzer.AnalyzeBpm(_audioSource.clip);

        if (_bpm < 0)
        {
            Debug.LogError("AudioClip is null.");
            return;
        }

        _bpmTime = 60.0f / (float)_bpm;
    }
Ejemplo n.º 7
0
    public void importload(int num)
    {
        songListContainer = GameObject.FindGameObjectWithTag("ContentList");
        songbutton        = Resources.Load <GameObject>("Prefabs/Song");

        title   = songbutton.transform.GetChild(0).GetComponent <Text>();
        bpm     = songbutton.transform.GetChild(1).GetComponent <Text>();
        songnum = songbutton.transform.GetChild(2).GetComponent <Text>();
        played  = songbutton.transform.GetChild(3).GetComponent <Text>();
        score   = songbutton.transform.GetChild(4).GetComponent <Text>();
        hit     = songbutton.transform.GetChild(5).GetComponent <Text>();
        missed  = songbutton.transform.GetChild(6).GetComponent <Text>();

        AudioSource audio = songbutton.GetComponent <AudioSource>();

        audio.clip = theMusic.clip;
        title.text = savedTitles[num];
        BPM        = UniBpmAnalyzer.AnalyzeBpm(audio.clip);
        bpm.text   = /*"bpm: " +*/ BPM.ToString();
        songNum++;
        songnum.text = songNum.ToString();


        played.text = "";
        score.text  = "";
        hit.text    = "";
        missed.text = "";

        /*if (loadInSaveFile.playedSongs.Contains(songNum)){
         *  for(int i = 0; i< loadInSaveFile.playedSongs.Count; i++){
         *      if(loadInSaveFile.playedSongs[i] == songNum){
         *          played.text = "true";
         *          score.text = "Score: " + loadInSaveFile.score[i];
         *          hit.text = "Hit: " + loadInSaveFile.hitNotes[i];
         *          missed.text = "Mis: " + loadInSaveFile.missedNotes[i];
         *      }
         *  }
         *
         * }
         * else
         * {
         *  played.text = "false";
         *  score.text = "Score: " + loadInSaveFile.score[songNum];
         *  hit.text = "Hit: " + loadInSaveFile.hitNotes[songNum];
         *  missed.text = "Mis: " + loadInSaveFile.missedNotes[songNum];
         *
         *
         * }*/

        if (allImportedSongNames.Contains(title.text))
        {
            //print("double " + title.text);
        }
        else
        {
            GameObject button = Instantiate(songbutton, songListContainer.transform);
            songbuttons.Add(button);
            loadInSaveFile.AddToList(savedTitles[num], savedUrls[num]);
            allImportedSongNames.Add(title.text);

            //print("num " + num + " saved titles: "+ savedTitles.Count);
            if (num < savedTitles.Count - 1)
            {
                importsave(num + 1);
            }
            else
            {
                //remove spinnning circle
                spinner.SetActive(false);
            }
        }
    }
Ejemplo n.º 8
0
 public void UpdateBPM()
 {
     _bpm = UniBpmAnalyzer.AnalyzeBpm(AudioSource.clip);
     Debug.Log(UniBpmAnalyzer.AnalyzeBpm(AudioSource.clip));
 }
Ejemplo n.º 9
0
 public void Execute()
 {
     Debug.Log("BPM = " + UniBpmAnalyzer.AnalyzeBpm(checkAudioClip));
 }
Ejemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     bpm = UniBpmAnalyzer.AnalyzeBpm(audioSource.clip);
 }