Esempio n. 1
0
        public static float AdjustPitch(AudioClip song, int sampleKey)
        {
            int key = KeyFinder.KeyFind(song);

            Log.Write("the key of song is " + key);

            //int sampleKey = 21; //GMinor

            int minMajDiff = (sampleKey % 2 == 0) ? -3 : 3;

            minMajDiff = ((key % 2) == (sampleKey % 2)) ? 0 : minMajDiff;

            Log.Write("minMajDiff is " + minMajDiff);

            int diff = ((int)(key - sampleKey) / 2 + minMajDiff + 24) % 12;

            float pitch = 1f;

            if (diff <= 7)
            {
                for (int i = 0; i < diff; i++)
                {
                    pitch *= SEMITONE;
                }
            }
            else
            {
                for (int i = 0; i < 12 - diff; i++)
                {
                    pitch /= SEMITONE;
                }
            }

            return(pitch);
        }
Esempio n. 2
0
        public void Write_LogLevelGreaterThanConfigured_MessageWritten()
        {
            var sink   = new FakeLoggingSink();
            var logger = new DefaultLogger(sink);

            DefaultLogger.LogLevel = LogLevel.Info;
            logger.Write(LogLevel.Warning, "some message");

            Assert.That(sink.LastEntry.Message, Is.EqualTo("some message"));
        }
Esempio n. 3
0
        public void Write_LogLevelLessThanConfigured_NoMessageWritten()
        {
            var sink   = new FakeLoggingSink();
            var logger = new DefaultLogger(sink);

            DefaultLogger.LogLevel = LogLevel.Warning;
            logger.Write(LogLevel.Info, "some message");

            Assert.That(sink.LastEntry, Is.Null);
        }
Esempio n. 4
0
    public async UniTask <AudioClip> LoadAudioClipWithWebRequest(string filename, AudioType audioType = AudioType.OGGVORBIS)
    {
        Log.Write("LoadAudioClipWithWebRequest Start");

        using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + filename, audioType))
        {
            await www.SendWebRequest(); // must wait

            originalClip = clip = DownloadHandlerAudioClip.GetContent(www);
        }

        //Log.Write("loadState = " + clip.loadState);
        //Log.Write("loadType = " + clip.loadType);

        //Log.Write("Clip Load Success");

        return(originalClip);
    }
Esempio n. 5
0
    // Start is called before the first frame update
    async void Start()
    {
        string customLevelPath = "D:\\ProgramFiles\\Steam\\steamapps\\common\\Beat Saber\\Beat Saber_Data\\CustomLevels\\";

        cutEffectPlayer.Init(gameObject);

        string cutEffectMapPath = customLevelPath + "2a7 (Night of Nights - squeaksies)\\ExpertPlusEffect.dat";

        if (forPlay)
        {
            await cutEffectPlayer.TryLoadCutEffectMap(cutEffectMapPath);

            mapPlayer.OnSendNote.AddListener(cutEffectPlayer.Play);
        }
        if (forEdit)
        {
            await cutEffectPlayer.TryLoadCutEffects();
        }

        string songPath = customLevelPath + "2a7 (Night of Nights - squeaksies)\\Night of Nights (Flowering nights remix).egg";
        string mapPath  = customLevelPath + "2a7 (Night of Nights - squeaksies)\\ExpertPlus.dat";

        bool mapPlayerInited = await mapPlayer.TryInit(songPath, mapPath, gameObject);

        if (mapPlayerInited)
        {
            //if (forEdit) mapPlayer.InitCutEffectMapForEdit();
            AdjustTapKey(mapPlayer.AudioManager_Song.GetAudioClip(), cutEffectPlayer); //必要なのはEditのときだけでは?
            mapPlayer.Play();
        }
        else
        {
            Log.Write("mapPlayer is not Inited");
            return;
        }

        if (pitchController != null)
        {
            pitchController.Init(CutEffectPlayer.TAP_NUM, cutEffectPlayer);
            mapPlayer.OnSendNote.AddListener(pitchController.ShowNote);
        }
    }
Esempio n. 6
0
 public static void Write(MvLoggerEventArgs ea, MvLoggerEnumLevel _level)
 {
     ea.Level = _level;
     DefaultLogger.Write(ea, _level);
 }
Esempio n. 7
0
 public static void Write(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea);
 }
Esempio n. 8
0
 public static void Warn(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Warn);
 }
Esempio n. 9
0
 public static void Warn(string msg, params object[] args)
 {
     DefaultLogger.Write(string.Format(msg, args), MvLoggerEnumLevel.Warn);
 }
Esempio n. 10
0
 public static void Verbose(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Verbose);
 }
Esempio n. 11
0
 public static void Info(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Info);
 }
Esempio n. 12
0
 public static void Fatal(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Fatal);
 }
Esempio n. 13
0
 public static void Error(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Error);
 }
Esempio n. 14
0
 public static void Debug(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Debug);
 }
Esempio n. 15
0
 public static void Verbose(string msg, params object[] args)
 {
     DefaultLogger.Write(string.Format(msg, args), MvaLoggerEnumLevel.Verbose);
 }
Esempio n. 16
0
 /// <summary>
 /// Event handler for the game exiting.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 protected override void OnExiting(object sender, System.EventArgs args)
 {
     DefaultLogger.Write(MessageType.Information, "Shutting engine down normally ....", 1);
     DefaultLogger.Close();
     base.OnExiting(sender, args);
 }