Beispiel #1
0
        public async Task <IActionResult> PutMusicKey(int id, MusicKey musicKey)
        {
            if (id != musicKey.Id)
            {
                return(BadRequest());
            }

            _context.Entry(musicKey).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MusicKeyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <ActionResult <MusicKey> > PostMusicKey(MusicKey musicKey)
        {
            _context.MusicKeys.Add(musicKey);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMusicKey", new { id = musicKey.Id }, musicKey));
        }
        // 主調musicKeyと内部調の調名chordKeyのペアから内属記号を得る。
        public static KeyRelation MainKeynameAndChordKeynametoKeyRelation(MusicKey mainKey, MusicKey chordKey)
        {
            System.Diagnostics.Debug.Assert(mainKey != MusicKey.Invalid);
            System.Diagnostics.Debug.Assert(chordKey != MusicKey.Invalid);

            return(mainKeyInternalKeyToKeyRelation[(int)mainKey * (int)MusicKey.NUM + (int)chordKey]);
        }
 public void SetRelatedKeys(MusicKey k2, MusicKey k3, MusicKey k4, MusicKey k5, MusicKey k6, MusicKey k7)
 {
     relatedKeys[1] = k2;
     relatedKeys[2] = k3;
     relatedKeys[3] = k4;
     relatedKeys[4] = k5;
     relatedKeys[5] = k6;
     relatedKeys[6] = k7;
 }
 public void SetParallelRelatedKeys(MusicKey parallelKey, MusicKey k2, MusicKey k3, MusicKey k4, MusicKey k5, MusicKey k6, MusicKey k7)
 {
     parallelRelatedKeys[0] = parallelKey;
     parallelRelatedKeys[1] = k2;
     parallelRelatedKeys[2] = k3;
     parallelRelatedKeys[3] = k4;
     parallelRelatedKeys[4] = k5;
     parallelRelatedKeys[5] = k6;
     parallelRelatedKeys[6] = k7;
 }
        // 主調mainKeyと内属記号keyRelationのペアから調keyを決定する
        public static MusicKey MainKeyAndKeyRelationToKey(MusicKey mainKey, KeyRelation keyRelation)
        {
            for (int internalKey = 0; internalKey < (int)MusicKey.NUM; ++internalKey)
            {
                if (keyRelation == mainKeyInternalKeyToKeyRelation[(int)mainKey * (int)MusicKey.NUM + internalKey])
                {
                    return((MusicKey)internalKey);
                }
            }

            System.Console.WriteLine("MainKeyAndKeyRelationToKey not found {0} {1}", mainKey, keyRelation);
            return(MusicKey.Invalid);
        }
        public void Init(MusicKey key, LN ln1, string name, Mode mode, int flatNum, int sharpNum)
        {
            this.relatedKeys         = new MusicKey[7];
            this.parallelRelatedKeys = new MusicKey[7];
            this.lns = new LN[7];

            this.key      = key;
            this.lns[0]   = ln1;
            this.name     = name;
            this.mode     = mode;
            this.flatNum  = flatNum;
            this.sharpNum = sharpNum;

            this.relatedKeys[0] = key;
        }
        public static KeyRelation MusicKeyAndChordDegreeToKeyRelation(MusicKey key, CD chordDegree)
        {
            MusicKeyInfo mki = new MusicKeyInfo(key, KeyRelation.I調);

            KeyRelation kr = KeyRelation.Unknown;

            switch (chordDegree)
            {
            case CD.I: kr = KeyRelation.I調; break;

            case CD.II: /* 長調の時はII調、短調の時はない。 */
                if (mki.IsMajor())
                {
                    kr = KeyRelation.II調;
                }
                break;

            case CD.III: kr = KeyRelation.III調; break;

            case CD.IV: kr = KeyRelation.IV調; break;

            case CD.V: kr = KeyRelation.V調; break;

            case CD.VI: kr = KeyRelation.VI調; break;

            case CD.VII: /* 短調の時はVII調、長調の時はない。*/
                if (mki.IsMinor())
                {
                    kr = KeyRelation.VII調;
                }
                break;

            case CD.V_V:/* 長調のV調のV調は+II調、短調のV調のV調は△II調 */
                if (mki.IsMajor())
                {
                    kr = KeyRelation.PII調;
                }
                else
                {
                    kr = KeyRelation.TII調;
                }
                break;

            default: System.Diagnostics.Debug.Assert(false); break;
            }
            return(kr);
        }
Beispiel #9
0
        public void ChangeMusic(MusicKey key)
        {
            CheckDisposed();

            if (m_currentMusic != null)
            {
                m_currentMusic.Stop(AudioStopOptions.AsAuthored);
                m_currentMusic.Dispose();
                m_currentMusic = null;
            }

            if (key != MusicKey.None)
            {
                m_currentMusic = m_soundBank.GetCue(key.ToString());
                m_currentMusic.Play();
            }
        }
Beispiel #10
0
        /// <summary>
        /// 和音の属する内部調と、和音の音度から、その和音がIの和音である調を得る。
        /// </summary>
        public static MusicKey MusicKeyAndChordDegreeToInternalKey(MusicKey key, CD chordDegree)
        {
            System.Diagnostics.Debug.Assert(key != MusicKey.Invalid);

            KeyRelation desirableKR = MusicKeyAndChordDegreeToKeyRelation(key, chordDegree);

            MusicKey result = MusicKey.Invalid;

            for (int internalKey = 0; internalKey < (int)MusicKey.NUM; ++internalKey)
            {
                if (desirableKR == mainKeyInternalKeyToKeyRelation[(int)key * (int)MusicKey.NUM + internalKey])
                {
                    result = (MusicKey)internalKey;
                    break;
                }
            }

            return(result);
        }
 public KeyAndName(MusicKey aK, string aName)
 {
     k    = aK;
     name = aName;
 }
Beispiel #12
0
 /// <summary>
 /// こちらのctorはあまり用いない方が良い。
 /// </summary>
 public MusicKeyInfo(MusicKey mainKey, KeyRelation keyRelation)
 {
     this.mainKey     = mainKey;
     this.internalKey = MainKeyAndKeyRelationToKey(mainKey, keyRelation);
 }
Beispiel #13
0
 public MusicKeyInfo(MusicKey mainKey, MusicKey internalKey)
 {
     this.mainKey     = mainKey;
     this.internalKey = internalKey;
 }