Exemple #1
0
        public void mk_ext(int i)           //連符の作成
        {
            if (extend == 1 || length % extend != 0 || length <= gWork.LimitExCounter)
            {
                extend = 1; return;
            }                                  //連符なしならリターン

            int ln = length / extend;
            int y;

            int[] n = new int[DEF.MAXEXTEND], o = new int[DEF.MAXEXTEND], l = new int[DEF.MAXEXTEND];
            n[0] = note; o[0] = octave; l[0] = ln;
            for (y = 1; y < extend; y++)                //あらかじめ連符の内容を作っておく
            {
                m98.newrnte(ref n[y], ref o[y], i);
                if (m98.nao2key(n[y], o[y]) == m98.nao2key(n[y - 1], o[y - 1]))
                {                //もし前と同じkeyだったら
                    l[y - 1] += ln;
                    extend--;
                    y--;
                }
                else
                {
                    l[y] = ln;
                }
            }

            length = l[0];
            TONE p, q;

            p      = new TONE(flag.OFF, m98);
            extadr = p;
            for (y = 1; y < extend; y++)
            {
                q = new TONE(flag.OFF, m98);

                p.note   = n[y];
                p.octave = o[y];
                p.length = l[y];
                if (p.qtz > 0 && p.qtz < 192)
                {
                    p.qtz = qtz / extend;
                }
                else
                {
                    p.qtz = qtz;
                }
                p.volume = volume;
                p.voice  = voice;
                p.ptm    = 0;
                p.tie    = 0;
                p.macro  = 0;
                p.pan    = pan;
                p.clock  = clock;
                p.ksift  = ksift;
                p.extend = 1;
                p.extadr = q;
                p        = q;
            }
        }
Exemple #2
0
        //------------------------------------------------------------------
        //各要素のシフト
        private void siftprg()
        {
            if (gWork.com.pnum == 0)
            {
                return;
            }
            //qsort(com.prm,com.pnum,sizeof(int),		//com.prmを小から昇順に
            //(int(*)(const void *,const void *)) cmpi);	//クイックソートする
            //int smin=com.prm[0];int smax=com.prm[1];int sabun=0;
            //if(smin<0){sabun=0-smin;smin=smin+sabun;smax=smax+sabun;}

            for (int i = 0; i <= gWork.TNUM; i++)
            {
                if (gWork.atr.fnte == flag.ON && gWork.cpyt[i].getnte() != DEF.REST)
                {                           //ノートの絶対シフト
                    //ノート部分
                    int n = gWork.cpyt[i].getnte();
                    int o = gWork.cpyt[i].getoct();
                    int k = m98.nao2key(n, o);
                    //k=k+((random((smax-smin)+1)+smin)-sabun);
                    int rs = gWork.com.prm[0][gWork.random.Next(gWork.com.pnum)];
                    k = k + rs;
                    if (k > 95 || k < 0)
                    {
                        k = 36;
                    }
                    m98.key2nao(k, out n, out o);
                    gWork.cpyt[i].putnte(n);
                    gWork.cpyt[i].putoct(o);
                    //ポルタメント部分
                    k  = rs;
                    k += gWork.cpyt[i].getptm();
                    if (k > 95 || k < 0)
                    {
                        gWork.cpyt[i].putptm(0);                                     //ポルタメント消去
                    }
                    else
                    {
                        gWork.cpyt[i].putptm(k);
                    }
                    //連符部分
                    if (gWork.cpyt[i].getext() != 1)
                    {
                        TONE p;
                        p = gWork.cpyt[i].extadr;
                        for (int y = 1; y < gWork.cpyt[i].getext(); y++)
                        {
                            n  = p.getnte();
                            o  = p.getoct();
                            k  = m98.nao2key(n, o);
                            k += gWork.com.prm[0][gWork.random.Next(gWork.com.pnum)];
                            if (k > 95 || k < 0)
                            {
                                k = 36;
                            }
                            m98.key2nao(k, out n, out o);
                            p.putnte(n);
                            p.putoct(o);
                            p = p.extadr;
                        }
                    }
                }
                if (gWork.atr.fkst == flag.ON)                 //キーシフトの絶対シフト
                {
                    gWork.cpyt[i].putkst(gWork.cpyt[i].getkst() + gWork.com.prm[0][gWork.random.Next(gWork.com.pnum)]);
                }
                if (gWork.atr.fmac == flag.ON)                 //マクロの絶対シフト
                {
                    gWork.cpyt[i].putmac(gWork.cpyt[i].getmac() + gWork.com.prm[0][gWork.random.Next(gWork.com.pnum)]);
                }
            }
        }