예제 #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);
        }
예제 #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"));
        }
예제 #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);
        }
예제 #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);
    }
예제 #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);
        }
    }
예제 #6
0
 public static void Write(MvLoggerEventArgs ea, MvLoggerEnumLevel _level)
 {
     ea.Level = _level;
     DefaultLogger.Write(ea, _level);
 }
예제 #7
0
 public static void Write(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea);
 }
예제 #8
0
 public static void Warn(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Warn);
 }
예제 #9
0
 public static void Warn(string msg, params object[] args)
 {
     DefaultLogger.Write(string.Format(msg, args), MvLoggerEnumLevel.Warn);
 }
예제 #10
0
 public static void Verbose(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Verbose);
 }
예제 #11
0
 public static void Info(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Info);
 }
예제 #12
0
 public static void Fatal(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Fatal);
 }
예제 #13
0
 public static void Error(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Error);
 }
예제 #14
0
 public static void Debug(MvLoggerEventArgs ea)
 {
     DefaultLogger.Write(ea, MvLoggerEnumLevel.Debug);
 }
예제 #15
0
 public static void Verbose(string msg, params object[] args)
 {
     DefaultLogger.Write(string.Format(msg, args), MvaLoggerEnumLevel.Verbose);
 }
예제 #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);
 }