Exemplo n.º 1
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[1].getEventCount(); i++)
         {
             cadencii.vsq.VsqEvent item = Vsq.Track[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);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 4
0
 public static bool Edit(cadencii.vsq.VsqFile Vsq)
 {
     for (int i = 1; i < Vsq.Track.Count; i++)
     {
         for (int j = 0; j < Vsq.Track[i].getEventCount(); j++)
         {
             cadencii.vsq.VsqEvent item = Vsq.Track[i].getEvent(j);
             if (item.ID.type == cadencii.vsq.VsqIDType.Anote)
             {
                 // 32分音符の長さは,クロック数に直すと60クロック
                 if (item.ID.Length > 60)
                 {
                     item.ID.Length -= 60;
                 }
             }
         }
     }
     return(true);
 }
 public static bool Edit(cadencii.vsq.VsqFile vsq)
 {
     vsq.Track.get(1).printMetaText(@"c:\meta_text.txt", "Shift_JIS");
     return(true);
 }
Exemplo n.º 6
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;
                }
            }
        }
    }