Beispiel #1
0
 public static bool Edit( cadencii.vsq.VsqFile vsq ) {
     using ( Hamori d = new Hamori() ) {
         if ( d.ShowDialog() != System.Windows.Forms.DialogResult.OK ) {
             return false;
         } else {
             hamori( vsq, d.cbbBaseCode.SelectedIndex, d.cbbSlide.SelectedIndex );
             return true;
         }
     }
 }
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     for ( int i = 1; i < Vsq.Track.size(); i++ ) {
         for ( int j = 0; j < Vsq.Track.get( i ).getEventCount(); j++ ) {
             cadencii.vsq.VsqEvent item = Vsq.Track.get( i ).getEvent( j );
             if ( item.ID.type == cadencii.vsq.VsqIDType.Anote ) {
                 if ( item.ID.Note < 127 ) {
                     item.ID.Note++;
                 }
             }
         }
     }
     return true;
 }
Beispiel #3
0
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     for ( int i = 1; i < Vsq.Track.size(); i++ ) {
         for ( int j = 0; j < Vsq.Track.get( i ).getEventCount(); j++ ) {
             cadencii.vsq.VsqEvent item = Vsq.Track.get( i ).getEvent( j );
             if ( item.ID.type == cadencii.vsq.VsqIDType.Anote ) {
                 // 32分音符の長さは,クロック数に直すと60クロック
                 if ( item.ID.Length > 60 ) {
                     item.ID.Length -= 60;
                 }
             }
         }
     }
     return true;
 }
Beispiel #4
0
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     System.IO.StreamWriter sw = null;
     try {
         sw = new System.IO.StreamWriter( @"c:\lyrics.txt" );
         for ( int i = 0; i < Vsq.Track.get( 1 ).getEventCount(); i++ ) {
             cadencii.vsq.VsqEvent item = Vsq.Track.get( 1 ).getEvent( i );
             if ( item.ID.type == cadencii.vsq.VsqIDType.Anote ) {
                 int clStart = item.Clock;
                 int clEnd = clStart + item.ID.Length;
                 double secStart = Vsq.getSecFromClock( clStart );
                 double secEnd = Vsq.getSecFromClock( clEnd );
                 sw.WriteLine( secStart + "\t" + secEnd + "\t" + item.ID.LyricHandle.L0.Phrase + "\t" + item.ID.LyricHandle.L0.getPhoneticSymbol() );
             }
         }
     } catch {
         return false;
     } finally {
         if ( sw != null ) {
             sw.Close();
         }
     }
     return true;
 }
Beispiel #5
0
    public static bool Edit( cadencii.vsq.VsqFile vsq ) {
        // 選択されているアイテム(のInternalID)をリストアップ
        System.Collections.Generic.List<int> ids = new System.Collections.Generic.List<int>();
        for ( Iterator<SelectedEventEntry> itr = AppManager.itemSelection.getEventIterator(); itr.hasNext(); ){
            SelectedEventEntry entry = itr.next();
            ids.Add( entry.original.InternalID );
        }

        cadencii.vsq.VsqTrack track = vsq.Track.get( AppManager.getSelected() );

        // コントロールカーブの時間方向の解像度を,Cadenciiの設定値から取得
        int resol = AppManager.editorConfig.getControlCurveResolutionValue();
        for ( int i = 0; i < ids.Count; i++ ) {
            int internal_id = ids[i];

            for ( Iterator<VsqEvent> itr = track.getNoteEventIterator(); itr.hasNext(); ) {
                cadencii.vsq.VsqEvent item = itr.next();
                // 指定されたInternalIDと同じなら,編集する
                if ( item.InternalID == internal_id ) {
                    // Brightnessカーブを取得
                    cadencii.vsq.VsqBPList bri = track.getCurve( "BRI" );

                    // 音符の最後の位置でのBRIを取得.処理の最後で追加
                    int value_at_end = bri.getValue( item.Clock + item.ID.Length );

                    // これから編集しようとしている範囲にすでに値がある場合,邪魔なので削除する
                    for ( Iterator<int> itr2 = bri.keyClockIterator(); itr.hasNext(); ){
                        int clock = itr2.next();
                        System.Console.WriteLine( "clock=" + clock );
                        if ( item.Clock <= clock && clock <= item.Clock + item.ID.Length ) {
                            itr2.remove();
                        }
                    }

                    // 直前に指定したBRI値.最初はありえない値にしておく
                    int last_v = -1;

                    // 時間方向解像度(resol)ごとのクロックに対して,順次BRIを設定
                    for ( int clock = item.Clock; clock <= item.Clock + item.ID.Length; clock += resol ) {
                        // BRIを取得.x=0が音符の先頭,x=1が音符の末尾.getCurve関数は,この仕様を満たすようにBRIを返すように,お好みで定義
                        float x = (clock - item.Clock) / (float)item.ID.Length;
                        int v = getCurve( x );

                        if ( last_v != v ) {
                            // 直前に指定した値と違うときだけ追加.
                            bri.add( clock, v );
                        }

                        // 「直前の値」を更新
                        last_v = v;
                    }

                    // 音符末尾の位置のBRIを強制的に元の値に戻す.これをやらないと,
                    // その音符の末尾以降のBRIがそのまま編集の影響を受けてしまう
                    bri.add( item.Clock + item.ID.Length, value_at_end );
                    break;
                }
            }
        }
        return true;
    }
Beispiel #6
0
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     for ( int i = 1; i < Vsq.Track.size(); i++ ) {
         for ( Iterator<VsqEvent> itr = Vsq.Track.get( i ).getNoteEventIterator(); itr.hasNext(); ) {
             cadencii.vsq.VsqEvent item = itr.next();
             // 32分音符の長さは,クロック数に直すと60クロック
             if ( item.ID.Length > 60 ) {
                 item.ID.Length -= 60;
             }
         }
     }
     return true;
 }
Beispiel #7
0
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     for ( int i = 1; i < Vsq.Track.size(); i++ ) {
         for ( Iterator<VsqEvent> itr = Vsq.Track.get( i ).getNoteEventIterator(); itr.hasNext(); ) {
             cadencii.vsq.VsqEvent item = itr.next();
             if ( item.ID.Note < 127 ) {
                 item.ID.Note++;
             }
         }
     }
     return true;
 }
Beispiel #8
0
 public static bool Edit( cadencii.vsq.VsqFile Vsq ) {
     System.IO.StreamWriter sw = null;
     try {
         sw = new System.IO.StreamWriter( @"c:\lyrics.txt" );
         for ( Iterator<VsqEvent> itr = Vsq.Track.get( 1 ).getNoteEventIterator(); itr.hasNext(); ) {
             cadencii.vsq.VsqEvent item = itr.next();
             int clStart = item.Clock;
             int clEnd = clStart + item.ID.Length;
             double secStart = Vsq.getSecFromClock( clStart );
             double secEnd = Vsq.getSecFromClock( clEnd );
             sw.WriteLine( secStart + "\t" + secEnd + "\t" + item.ID.LyricHandle.L0.Phrase + "\t" + item.ID.LyricHandle.L0.PhoneticSymbol );
         }
     } catch {
         return false;
     } finally {
         if ( sw != null ) {
             sw.Close();
         }
     }
     return true;
 }
Beispiel #9
0
 public static bool Edit( cadencii.vsq.VsqFile vsq ) {
     vsq.Track.get( 1 ).printMetaText( @"c:\meta_text.txt", "Shift_JIS" );
     return true;
 }
Beispiel #10
0
 public void drawImage( cadencii.java.awt.Image img, int x, int y, object obs ) {
     if ( img == null ) {
         return;
     }
     drawImage(img.image, x, y, obs);
 }
Beispiel #11
0
    private static void hamori( cadencii.vsq.VsqFile vsq, int basecode, int opt ) {
        // opt : 0 -> 3度上, 1 -> 5度上, 2 -> 4度下
        //            4(or 3)     7           -5
        // 3度上(Cmaj)
        // C     D     E  F     G     A     B
        // 4, 4, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3
        int step = (new int[] { 4, 7, -5 })[opt];

        int note;
        Dictionary<int, int> target_ids = new Dictionary<int, int>();
        for ( cadencii.java.util.Iterator<SelectedEventEntry> itr = AppManager.itemSelection.getEventIterator(); itr.hasNext(); ){
            SelectedEventEntry see = itr.next();
            target_ids.Add( see.original.InternalID, 0 );
        }
        int track = AppManager.getSelected();
        int tmp;
        if ( opt == 0 ) {
            for ( int j = 0; j < vsq.Track.get( track ).getEventCount(); j++ ) {
                cadencii.vsq.VsqEvent item = vsq.Track.get( track ).getEvent( j );
                if ( item.ID.type == cadencii.vsq.VsqIDType.Anote && target_ids.ContainsKey( item.InternalID ) ) {
                    tmp = (item.ID.Note + 12 - basecode) % 12;
                    step = ((1 < tmp && tmp < 5) || 8 < tmp) ? 3 : 4;
                    note = item.ID.Note + step;
                    if ( note < 0 )
                        note = 0;
                    if ( 127 < note )
                        note = 127;
                    item.ID.Note = note;
                }
            }
        } else {
            for ( int j = 0; j < vsq.Track.get( track ).getEventCount(); j++ ) {
                cadencii.vsq.VsqEvent item = vsq.Track.get( track ).getEvent( j );
                if ( item.ID.type == cadencii.vsq.VsqIDType.Anote && target_ids.ContainsKey( item.InternalID ) ) {
                    tmp = (item.ID.Note + 12 - basecode) % 12;
                    tmp = tmp == 11 ? step - 1 : step;
                    note = item.ID.Note + tmp;
                    if ( note < 0 )
                        note = 0;
                    if ( 127 < note )
                        note = 127;
                    item.ID.Note = note;
                }
            }
        }
    }