Exemplo n.º 1
0
        /// <summary>
        /// このインスタンスと,指定したVibratoBPListのインスタンスが等しいかどうかを調べます
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool equals(VibratoBPList item)
        {
            if (item == null)
            {
                return(false);
            }
            int size = this.m_list.Count;

            if (size != item.m_list.Count)
            {
                return(false);
            }
            for (int i = 0; i < size; i++)
            {
                VibratoBPPair p0 = this.m_list[i];
                VibratoBPPair p1 = item.m_list[i];
                if (p0.X != p1.X)
                {
                    return(false);
                }
                if (p0.Y != p1.Y)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool equals(VsqEvent item)
        {
            if (this.Clock != item.Clock)
            {
                return(false);
            }
            if (this.ID.type != item.ID.type)
            {
                return(false);
            }
            if (this.ID.type == VsqIDType.Anote)
            {
                #region 音符の比較
                if (this.ID.Note != item.ID.Note)
                {
                    return(false);
                }
                if (this.ID.getLength() != item.ID.getLength())
                {
                    return(false);
                }
                if (this.ID.d4mean != item.ID.d4mean)
                {
                    return(false);
                }
                if (this.ID.DEMaccent != item.ID.DEMaccent)
                {
                    return(false);
                }
                if (this.ID.DEMdecGainRate != item.ID.DEMdecGainRate)
                {
                    return(false);
                }
                if (this.ID.Dynamics != item.ID.Dynamics)
                {
                    return(false);
                }
                if (this.ID.LyricHandle == null && item.ID.LyricHandle != null)
                {
                    return(false);
                }
                if (this.ID.LyricHandle != null && item.ID.LyricHandle == null)
                {
                    return(false);
                }
                if (this.ID.LyricHandle != null && item.ID.LyricHandle != null)
                {
                    if (!this.ID.LyricHandle.L0.equalsForSynth(item.ID.LyricHandle.L0))
                    {
                        return(false);
                    }
                    int count = this.ID.LyricHandle.Trailing.Count;
                    if (count != item.ID.LyricHandle.Trailing.Count)
                    {
                        return(false);
                    }
                    for (int k = 0; k < count; k++)
                    {
                        if (!this.ID.LyricHandle.Trailing[k].equalsForSynth(item.ID.LyricHandle.Trailing[k]))
                        {
                            return(false);
                        }
                    }
                }
                if (this.ID.NoteHeadHandle == null && item.ID.NoteHeadHandle != null)
                {
                    return(false);
                }
                if (this.ID.NoteHeadHandle != null && item.ID.NoteHeadHandle == null)
                {
                    return(false);
                }
                if (this.ID.NoteHeadHandle != null && item.ID.NoteHeadHandle != null)
                {
                    if (!this.ID.NoteHeadHandle.IconID.Equals(item.ID.NoteHeadHandle.IconID))
                    {
                        return(false);
                    }
                    if (this.ID.NoteHeadHandle.getDepth() != item.ID.NoteHeadHandle.getDepth())
                    {
                        return(false);
                    }
                    if (this.ID.NoteHeadHandle.getDuration() != item.ID.NoteHeadHandle.getDuration())
                    {
                        return(false);
                    }
                    if (this.ID.NoteHeadHandle.getLength() != item.ID.NoteHeadHandle.getLength())
                    {
                        return(false);
                    }
                }
                if (this.ID.PMBendDepth != item.ID.PMBendDepth)
                {
                    return(false);
                }
                if (this.ID.PMBendLength != item.ID.PMBendLength)
                {
                    return(false);
                }
                if (this.ID.PMbPortamentoUse != item.ID.PMbPortamentoUse)
                {
                    return(false);
                }
                if (this.ID.pMeanEndingNote != item.ID.pMeanEndingNote)
                {
                    return(false);
                }
                if (this.ID.pMeanOnsetFirstNote != item.ID.pMeanOnsetFirstNote)
                {
                    return(false);
                }
                VibratoHandle hVibratoThis = this.ID.VibratoHandle;
                VibratoHandle hVibratoItem = item.ID.VibratoHandle;
                if (hVibratoThis == null && hVibratoItem != null)
                {
                    return(false);
                }
                if (hVibratoThis != null && hVibratoItem == null)
                {
                    return(false);
                }
                if (hVibratoThis != null && hVibratoItem != null)
                {
                    if (this.ID.VibratoDelay != item.ID.VibratoDelay)
                    {
                        return(false);
                    }
                    if (!hVibratoThis.IconID.Equals(hVibratoItem.IconID))
                    {
                        return(false);
                    }
                    if (hVibratoThis.getStartDepth() != hVibratoItem.getStartDepth())
                    {
                        return(false);
                    }
                    if (hVibratoThis.getStartRate() != hVibratoItem.getStartRate())
                    {
                        return(false);
                    }
                    VibratoBPList vibRateThis = hVibratoThis.getRateBP();
                    VibratoBPList vibRateItem = hVibratoItem.getRateBP();
                    if (vibRateThis == null && vibRateItem != null)
                    {
                        return(false);
                    }
                    if (vibRateThis != null && vibRateItem == null)
                    {
                        return(false);
                    }
                    if (vibRateThis != null && vibRateItem != null)
                    {
                        int numRateCount = vibRateThis.getCount();
                        if (numRateCount != vibRateItem.getCount())
                        {
                            return(false);
                        }
                        for (int k = 0; k < numRateCount; k++)
                        {
                            VibratoBPPair pThis = vibRateThis.getElement(k);
                            VibratoBPPair pItem = vibRateItem.getElement(k);
                            if (pThis.X != pItem.X)
                            {
                                return(false);
                            }
                            if (pThis.Y != pItem.Y)
                            {
                                return(false);
                            }
                        }
                    }
                    VibratoBPList vibDepthThis = hVibratoThis.getDepthBP();
                    VibratoBPList vibDepthItem = hVibratoItem.getDepthBP();
                    if (vibDepthThis == null && vibDepthItem != null)
                    {
                        return(false);
                    }
                    if (vibDepthThis != null && vibDepthItem == null)
                    {
                        return(false);
                    }
                    if (vibDepthThis != null && vibDepthItem != null)
                    {
                        int numDepthCount = vibDepthThis.getCount();
                        if (numDepthCount != vibDepthItem.getCount())
                        {
                            return(false);
                        }
                        for (int k = 0; k < numDepthCount; k++)
                        {
                            VibratoBPPair pThis = vibDepthThis.getElement(k);
                            VibratoBPPair pItem = vibDepthItem.getElement(k);
                            if (pThis.X != pItem.X)
                            {
                                return(false);
                            }
                            if (pThis.Y != pItem.Y)
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (this.ID.vMeanNoteTransition != item.ID.vMeanNoteTransition)
                {
                    return(false);
                }
                #endregion
            }
            else if (this.ID.type == VsqIDType.Singer)
            {
                #region シンガーイベントの比較
                if (this.ID.IconHandle.Program != item.ID.IconHandle.Program)
                {
                    return(false);
                }
                #endregion
            }
            else if (this.ID.type == VsqIDType.Aicon)
            {
                if (!this.ID.IconDynamicsHandle.IconID.Equals(item.ID.IconDynamicsHandle.IconID))
                {
                    return(false);
                }
                if (this.ID.IconDynamicsHandle.isDynaffType())
                {
                    // 強弱記号
                }
                else
                {
                    // クレッシェンド・デクレッシェンド
                    if (this.ID.getLength() != item.ID.getLength())
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// クレッシェンド,デクレッシェンド,および強弱記号をダイナミクスカーブに反映させます.
        /// この操作によって,ダイナミクスカーブに設定されたデータは全て削除されます.
        /// </summary>
        public void reflectDynamics()
        {
            VsqBPList dyn = getCurve("dyn");

            dyn.clear();
            for (Iterator <VsqEvent> itr = getDynamicsEventIterator(); itr.hasNext();)
            {
                VsqEvent           item   = itr.next();
                IconDynamicsHandle handle = item.ID.IconDynamicsHandle;
                if (handle == null)
                {
                    continue;
                }
                int clock  = item.Clock;
                int length = item.ID.getLength();

                if (handle.isDynaffType())
                {
                    // 強弱記号
                    dyn.add(clock, handle.getStartDyn());
                }
                else
                {
                    // クレッシェンド,デクレッシェンド
                    int start_dyn = dyn.getValue(clock);

                    // 範囲内のアイテムを削除
                    int count = dyn.size();
                    for (int i = count - 1; i >= 0; i--)
                    {
                        int c = dyn.getKeyClock(i);
                        if (clock <= c && c <= clock + length)
                        {
                            dyn.removeElementAt(i);
                        }
                        else if (c < clock)
                        {
                            break;
                        }
                    }

                    VibratoBPList bplist = handle.getDynBP();
                    if (bplist == null || (bplist != null && bplist.getCount() <= 0))
                    {
                        // カーブデータが無い場合
                        double a = 0.0;
                        if (length > 0)
                        {
                            a = (handle.getEndDyn() - handle.getStartDyn()) / (double)length;
                        }
                        int last_val = start_dyn;
                        for (int i = clock; i < clock + length; i++)
                        {
                            int val = start_dyn + (int)(a * (i - clock));
                            if (val < dyn.getMinimum())
                            {
                                val = dyn.getMinimum();
                            }
                            else if (dyn.getMaximum() < val)
                            {
                                val = dyn.getMaximum();
                            }
                            if (last_val != val)
                            {
                                dyn.add(i, val);
                                last_val = val;
                            }
                        }
                    }
                    else
                    {
                        // カーブデータがある場合
                        int last_val   = handle.getStartDyn();
                        int last_clock = clock;
                        int bpnum      = bplist.getCount();
                        int last       = start_dyn;

                        // bplistに指定されている分のデータ点を追加
                        for (int i = 0; i < bpnum; i++)
                        {
                            VibratoBPPair point      = bplist.getElement(i);
                            int           pointClock = clock + (int)(length * point.X);
                            if (pointClock <= last_clock)
                            {
                                continue;
                            }
                            int    pointValue = point.Y;
                            double a          = (pointValue - last_val) / (double)(pointClock - last_clock);
                            for (int j = last_clock; j <= pointClock; j++)
                            {
                                int val = start_dyn + (int)((j - last_clock) * a);
                                if (val < dyn.getMinimum())
                                {
                                    val = dyn.getMinimum();
                                }
                                else if (dyn.getMaximum() < val)
                                {
                                    val = dyn.getMaximum();
                                }
                                if (val != last)
                                {
                                    dyn.add(j, val);
                                    last = val;
                                }
                            }
                            last_val   = point.Y;
                            last_clock = pointClock;
                        }

                        // bplistの末尾から,clock => clock + lengthまでのデータ点を追加
                        int last2 = last;
                        if (last_clock < clock + length)
                        {
                            double a = (handle.getEndDyn() - last_val) / (double)(clock + length - last_clock);
                            for (int j = last_clock; j < clock + length; j++)
                            {
                                int val = last2 + (int)((j - last_clock) * a);
                                if (val < dyn.getMinimum())
                                {
                                    val = dyn.getMinimum();
                                }
                                else if (dyn.getMaximum() < val)
                                {
                                    val = dyn.getMaximum();
                                }
                                if (val != last)
                                {
                                    dyn.add(j, val);
                                    last = val;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 public void setElement(int index, VibratoBPPair value)
 {
     m_list[index] = value;
 }