public Question_Model generateNextQuestion(EInstrument instrument)
        {
            while(true)
            {
                var useSharpNotation = random.Next(0, 2) == 1 ? true : false;
                var scale = getRandomScale();
                var ascending = random.Next(0, 2) == 1 ? true : false;
                var directionDescription = getDirectionDescription(ascending);
                var rootNote = getRandomRootNote();
                var octave = random.Next(1, 5);
                var startNote = getRandomStartNote(scale, rootNote);
                var scaleNotes = new List<Tuple<Note, int>>();

                if(soundLogic.getScaleNotes(instrument, scale, rootNote, octave, startNote, directionDescription == "Ascending", ref scaleNotes))
                {
                    var scaleDescription = getScaleDescription(scale);

                    var rootNoteDescription = rootNote.GetNoteName(useSharpNotation);

                    var octaveDescription = getRandomOctaveDescription(octave);

                    var startNoteDescription = startNote.GetNoteName(useSharpNotation);

                    return new Question_Model(scale, ascending, rootNote, octave, startNote, scaleDescription, directionDescription, rootNoteDescription, octaveDescription, startNoteDescription, useSharpNotation);
                }
            }
        }
Ejemplo n.º 2
0
 public void ActivateInstrument(EInstrument instru)
 {
     for (int i = 0; i < instruments.Count; i++)
     {
         instruments[i].GOInstrument.SetActive(instruments[i].instrumentType == instru);
     }
 }
        //public List<Tuple<Note, int>> getSubsequentScaleNotes(bool isUprightBass, EScale scale, bool ascending, Note root, Note startNote, int octave)
        //{
        //    var resList = new List<Tuple<Note,int>>();
        //    var succ = soundLogic.getScaleNotes(true, scale, root, octave, startNote, ascending, ref resList);
        //    return resList;
        //}
        public List<Tuple<Note, int>> getSubsequentScaleNotes(EInstrument instrument, EScale scale, bool ascending, Note root, Note startNote, int rootOctave)
        {
            var result = new List<Tuple<Note, int>>();

            var res = soundLogic.getScaleNotes(instrument, scale, root, rootOctave, startNote, ascending, ref result);

            return result;
        }
Ejemplo n.º 4
0
 public static AudioClip[] GetScaleAudio(EKey _key, EMode _mode, EInstrument _instrument)
 {
     AudioClip[] scaleTones = new AudioClip[7];
     scaleTones[0] = GetAudioClipInstrument(_key, _mode, _instrument, 1);
     for (int i = 1; i < 7; i++)
     {
         scaleTones[i] = GetAudioClipInstrument(_key, _mode, _instrument, i + 1);
     }
     return(scaleTones);
 }
        public InputMonitor(EInstrument instrument)
        {
            var dupa = new FMOD.Debug();

            FMOD.Debug.Initialize(DEBUG_FLAGS.ERROR | DEBUG_FLAGS.WARNING | DEBUG_FLAGS.LOG, DEBUG_MODE.FILE, null, "D:\\dupa.txt");

            this.OnInstrumentChanged(instrument);

            this.InitializeFmod(true);
        }
Ejemplo n.º 6
0
        public bool getScaleNotes(EInstrument instrument, EScale scale, Note root, int startOctave, Note startNote,
            bool ascending, ref List<Tuple<Note, int>> result)
        {
            var scaleNotes = getScaleNotes(scale, root);

            var currentIndex = scaleNotes.FindIndex(x => x == startNote);
            var currentOctave = startOctave;
            var previousNote = scaleNotes[currentIndex];
            var cNote = new Note(new List<string>() {"C"});
            var previousIndex = currentIndex;

            for (var i = 0; i < scaleNotes.Count(); ++i)
            {
                var noteToAdd = scaleNotes[currentIndex];

                if (previousNote < cNote && noteToAdd >= cNote && ascending == true)
                {
                    currentOctave++;
                }
                else if (previousNote >= cNote && noteToAdd < cNote && ascending == false)
                {
                    currentOctave--;
                }

                previousNote = noteToAdd;

                var toAdd = new Tuple<Note, int>(noteToAdd, currentOctave);

                result.Add(toAdd);

                currentIndex += ascending ? 1 : -1;

                if (currentIndex < 0 || currentIndex >= scaleNotes.Count())
                {
                    currentIndex = ascending ? 0 : scaleNotes.Count() - 1;
                }
            }

            foreach (var element in result)
            {
                if (doesInstrumentSupportNoteAndOctave(instrument, element.Item1, element.Item2) == false)
                {
                    return false;
                }
            }

            return true;
        }
Ejemplo n.º 7
0
    private static AudioClip GetAudioClipInstrument(EKey _key, EMode _mode, EInstrument _instrument, int _step)
    {
        string clipString = "";

        switch (_instrument)
        {
        case EInstrument.bassDrum:
            return(Resources.Load <AudioClip>("Audio/Music/Test/bassDrum"));

        case EInstrument.synthWarm:
            clipString += "synthWarm";
            break;
        }

        return(Resources.Load <AudioClip>("Audio/Music/Test/" + clipString));
    }
Ejemplo n.º 8
0
    public void AddScore(float time, EInstrument instrument)
    {
        Debug.Log(time);
        int tmp  = TimeToScore(time);
        int mult = currentMultiplier;

        if (time <= .5f)
        {
            mult += 1;
            nolimitMultiplier++;
        }
        else if (time > 1)
        {
            mult--;
            nolimitMultiplier++;
        }

        if (mult < 1)
        {
            mult = 1;
        }
        if (nolimitMultiplier < 1)
        {
            nolimitMultiplier = 1;
        }
        if (mult > 5)
        {
            mult = 5;
        }
        currentMultiplier = mult;

        displayTemp.text = "+" + tmp.ToString();
        displayTemp.rectTransform.anchoredPosition = tmpPosition;
        displayMult.text = "X" + mult.ToString();

        Score += mult * tmp;

        DisplayMessage.Instance.Display(instrument, nolimitMultiplier);

        StopAllCoroutines();
        if (mult != 4)
        {
            StartCoroutine(Fading(mult));
        }
    }
        public List<Tuple<NewNoteAndOctave, float>> GetInstrumentNotesWithFrequencies(EInstrument instrument)
        {
            switch (instrument)
            {
                case EInstrument.Guitar:
                {
                    return this.noteFrequencyList_Guitar;
                }

                case EInstrument.UprightBass:
                {
                    return this.noteFrequencyList_UprightBass;
                }

                default:
                {
                    throw new ArgumentException();
                }
            }
        }
Ejemplo n.º 10
0
    public void Display(EInstrument miniGame, int state)
    {
        if (state <= 5)
        {
            state = 1;
        }
        else if (state <= 10)
        {
            state = 2;
        }
        else if (state <= 19)
        {
            state = 3;
        }
        else
        {
            state = 4;
        }

        string message        = messages[miniGame][state - 1];
        Text   displayMessage = texts[miniGame];

        displayMessage.text = message;


        if (coroutines[miniGame] != null)
        {
            StopCoroutine(coroutines[miniGame]);
        }
        coroutines[miniGame] = StartCoroutine(Blink(displayMessage, state));

        if (miniGame == EInstrument.DRUM)
        {
            drummerCoroutine = StartCoroutine(Drummer(state));
        }
    }
Ejemplo n.º 11
0
        public bool doesInstrumentSupportNoteAndOctave(EInstrument instrument, Note note, int octave)
        {
            var noteAndOctave = new NewNoteAndOctave(note, octave);

            return new SoundKnowledge().GetInstrumentNotesWithFrequencies(instrument).Exists(x => x.Item1 == noteAndOctave);
        }
Ejemplo n.º 12
0
 public void FocusTarget(EInstrument instru)
 {
     targets.Find(tar => tar.instrument == instru).cam.GetFocus();
 }
        public void OnInstrumentChanged(EInstrument instrument)
        {
            this.instrumentFrequencyStart = new SoundKnowledge().GetInstrumentNotesWithFrequencies(instrument).First().Item2;
            this.instrumentFrequencyEnd = new SoundKnowledge().GetInstrumentNotesWithFrequencies(instrument).Last().Item2;

            this.instrumentFrequencyStart -= this.noteFrequencySpread;
            this.instrumentFrequencyEnd += this.noteFrequencySpread;
        }
        public void SelectedInstrumentChanged(string selectedInstrument)
        {
            this.instrument = selectedInstrument == "Guitar" ? EInstrument.Guitar : EInstrument.UprightBass;

            this.inputMonitor.OnInstrumentChanged(this.instrument);

            this.SetNextQuestion();
        }