File: DrawObject.cs

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 35,764 kB
  • ctags: 26,929
  • sloc: cs: 160,836; java: 42,449; cpp: 7,605; ansic: 1,728; perl: 1,087; makefile: 236; php: 142; xml: 117; sh: 21
file content (157 lines) | stat: -rw-r--r-- 5,800 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * DrawObject.cs
 * Copyright © 2008-2011 kbinani
 *
 * This file is part of org.kbinani.cadencii.
 *
 * org.kbinani.cadencii is free software; you can redistribute it and/or
 * modify it under the terms of the GPLv3 License.
 *
 * org.kbinani.cadencii is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#if JAVA
package org.kbinani.cadencii;

import org.kbinani.vsq.*;
import java.awt.*;
#else
using System;
using org.kbinani.vsq;
using org.kbinani.java.awt;

namespace org.kbinani.cadencii {
    using boolean = System.Boolean;
#endif

    /// <summary>
    /// 画面に描画するアイテムを表します
    /// </summary>
#if JAVA
    public class DrawObject implements Comparable<DrawObject>{
#else
    public class DrawObject : IComparable<DrawObject> {
#endif
        public Rectangle mRectangleInPixel;
        public String mText;
        public int mAccent;
        public int mDecay;
        public int mVelocity;
        public int mInternalID;
        /// <summary>
        /// 音符の先頭から,ビブラート開始位置までの長さ(単位:ピクセル)
        /// </summary>
        public int mVibratoDelayInPixel;
        /// <summary>
        /// このアイテムが他のアイテムと再生時にオーバーラップするかどうかを表すフラグ
        /// </summary>
        public boolean mIsOverlapped;
        public boolean mIsSymbolProtected;
        public int mNote;
        public UstEnvelope mUstEnvelope;
        /// <summary>
        /// 音符の長さ(クロック)
        /// </summary>
        public int mLength;
        /// <summary>
        /// アイテムの位置
        /// </summary>
        public int mClock;
        public DrawObjectType mType;
        /// <summary>
        /// UTAUモードにて、歌詞から*.wavを引き当てられたかどうか。
        /// これがfalseのとき、ピアノロール上で警告色で描かれる
        /// </summary>
        public boolean mIsValidForUtau = false;
        /// <summary>
        /// Straight x UTAUモードにて、歌詞からanalyzed\*.stfを引き当てられたかどうか。
        /// これがfalseのとき、ピアノロール上で警告色で描かれる
        /// </summary>
        public boolean mIsValidForStraight = false;
        public int mVibDelay = 0;
        /// <summary>
        /// ビブラートによるピッチカーブ。
        /// 単位はノート、配列のインデックスがクロックに相当する。
        /// </summary>
        public float[] mVibratoPit = null;
        /// <summary>
        /// UTAUの音量
        /// </summary>
        public int mIntensity = 100;

        public DrawObject( DrawObjectType type,
                           VsqFileEx vsq,
                           Rectangle rect, 
                           String text_,
                           int accent_,
                           int decay,
                           int velocity,
                           int internal_id,
                           int vibrato_delay,
                           boolean overwrapped, 
                           boolean symbol_protected,
                           VibratoBPList vib_rate,
                           VibratoBPList vib_depth,
                           int vib_start_rate,
                           int vib_start_depth,
                           int note_,
                           UstEnvelope ust_envelope,
                           int length,
                           int clock,
                           boolean is_valid_for_utau,
                           boolean is_valid_for_straight,
                           int vib_delay,
                           int intensity ) {
            this.mType = type;
            mRectangleInPixel = rect;
            mText = text_;
            mAccent = accent_;
            mDecay = decay;
            mVelocity = velocity;
            mInternalID = internal_id;
            mVibratoDelayInPixel = vibrato_delay;
            mIsOverlapped = overwrapped;
            mIsSymbolProtected = symbol_protected;
            mIntensity = intensity;

            mNote = note_;
            mUstEnvelope = ust_envelope;
            this.mLength = length;
            this.mClock = clock;
            this.mIsValidForUtau = is_valid_for_utau;
            this.mIsValidForStraight = is_valid_for_straight;
            this.mVibDelay = vib_delay;

            int viblength = length - vib_delay;
            if ( viblength > 0 && vib_rate != null && vib_depth != null ) {
                VibratoPointIteratorByClock itr =
                    new VibratoPointIteratorByClock( vsq,
                                                     vib_rate, vib_start_rate,
                                                     vib_depth, vib_start_depth,
                                                     clock + vib_delay, viblength );
                mVibratoPit = new float[viblength];
                for ( int i = 0; i < viblength; i++ ) {
                    if ( !itr.hasNext() ) {
                        break;
                    }
                    double v = itr.next();
                    mVibratoPit[i] = (float)v;
                }
            }
        }

        public int compareTo( DrawObject item ) {
            return mRectangleInPixel.x - item.mRectangleInPixel.x;
        }

#if !JAVA
        public int CompareTo( DrawObject item ){
            return compareTo( item );
        }
#endif
    }

#if !JAVA
}
#endif