예제 #1
0
        public static void Add(HiSample smpl)
        {
            HiSample c;

            try
            {
                if (!dicWave.TryGetValue(smpl.Name, out c))
                {
                    dicWave.Add(smpl.Name, smpl);
                }
            }
            catch (System.Exception ex)
            {
                MidiPlayerGlobal.ErrorDetail(ex);
            }
        }
예제 #2
0
        public static void LoadWave(HiSample smpl)
        {
            //Debug.Log("-------------------- " + smpl.Name);
            string    path = WavePath + "/" + Path.GetFileNameWithoutExtension(smpl.Name);// + ".wav";
            AudioClip ac   = Resources.Load <AudioClip>(path);

            if (ac != null)
            {
                float[] data = new float[ac.samples * ac.channels];
                if (ac.GetData(data, 0))
                {
                    //Debug.Log(smpl.Name + " " + factor);
                    smpl.Data = data;
                    DicAudioWave.Add(smpl);
                    //MPTK_CountWaveLoaded++;
                }
            }
            //else Debug.LogWarning("Sample " + smpl.WaveFile + " not found");
        }