2 using System.Collections.Generic;
6 using SharpDX.Direct3D9;
8 using System.Diagnostics;
12 internal class CAct演奏AVI : CActivity
14 private long n移動開始時刻ms;
15 private int n画像側開始位置X;
16 private int n画像側開始位置Y;
17 private int n画像側終了位置X;
18 private int n画像側終了位置Y;
24 private int n表示側開始位置X;
25 private int n表示側開始位置Y;
26 private int n表示側終了位置X;
27 private int n表示側終了位置Y;
28 private CDTX.CAVI rAVI;
29 private CTexture tx描画用;
35 /// On活性化()の前にフラグ操作すること。(活性化中に、本フラグを見て動作を変える部分があるため)
37 public bool bIsPreviewMovie
41 return _bIsPreviewMovie;
45 _bIsPreviewMovie = value;
48 this.bFullScreenMovieCentering = true;
52 private bool _bIsPreviewMovie;
60 public bool bFullScreenMovie
65 public bool bFullScreenMovieCentering
70 public int nFullScreenMovieX
75 public int nFullScreenMovieY
82 public void PrepareProperSizeTexture(int width, int height)
86 if (this.tx描画用 != null && (this.tx描画用.szテクスチャサイズ.Width != width || this.tx描画用.szテクスチャサイズ.Height != height))
91 if (this.tx描画用 == null)
94 if ( width % 32 != 0 )
100 this.tx描画用 = new CTexture(
101 CDTXMania.Instance.Device, width, height,
102 CDTXMania.Instance.GraphicsDeviceManager.CurrentSettings.BackBufferFormat,
103 Pool.Default, Usage.Dynamic );
105 this.tx描画用 = new CTexture(
106 CDTXMania.Instance.Device, width, height,
107 CDTXMania.Instance.GraphicsDeviceManager.CurrentSettings.BackBufferFormat,
112 catch (CTextureCreateFailedException e)
114 Trace.TraceError("CActAVI: OnManagedリソースの作成(): " + e.Message);
119 public void Start(EChannel nチャンネル番号, CDTX.CAVI rAVI, int n開始サイズW, int n開始サイズH, int n終了サイズW, int n終了サイズH, int n画像側開始位置X, int n画像側開始位置Y, int n画像側終了位置X, int n画像側終了位置Y, int n表示側開始位置X, int n表示側開始位置Y, int n表示側終了位置X, int n表示側終了位置Y, int n総移動時間ms, int n移動開始時刻ms)
121 if (nチャンネル番号 == EChannel.Movie || nチャンネル番号 == EChannel.MovieFull)
124 this.n開始サイズW = n開始サイズW;
125 this.n開始サイズH = n開始サイズH;
126 this.n終了サイズW = n終了サイズW;
127 this.n終了サイズH = n終了サイズH;
128 this.n画像側開始位置X = n画像側開始位置X;
129 this.n画像側開始位置Y = n画像側開始位置Y;
130 this.n画像側終了位置X = n画像側終了位置X;
131 this.n画像側終了位置Y = n画像側終了位置Y;
132 this.n表示側開始位置X = n表示側開始位置X * 2;
133 this.n表示側開始位置Y = n表示側開始位置Y * 2;
134 this.n表示側終了位置X = n表示側終了位置X * 2;
135 this.n表示側終了位置Y = n表示側終了位置Y * 2;
136 this.n総移動時間ms = n総移動時間ms;
137 this.PrepareProperSizeTexture((int)this.rAVI.avi.nフレーム幅, (int)this.rAVI.avi.nフレーム高さ);
138 this.n移動開始時刻ms = (n移動開始時刻ms != -1) ? n移動開始時刻ms : CSound管理.rc演奏用タイマ.n現在時刻;
142 public void SkipStart(int n移動開始時刻ms)
144 foreach (CChip chip in CDTXMania.Instance.DTX.listChip)
146 if (chip.n発声時刻ms > n移動開始時刻ms)
154 if (chip.rAVI != null)
156 if (this.rAVI == null)
158 this.rAVI = chip.rAVI; // DTXVモードで、最初に途中再生で起動したときに、ここに来る
160 this.bFullScreenMovie = (chip.eチャンネル番号 == EChannel.MovieFull || CDTXMania.Instance.ConfigIni.bFullAVI); // DTXVモードで、最初に途中再生で起動したときのために必要
161 this.rAVI.avi.Seek(n移動開始時刻ms - chip.n発声時刻ms);
162 //this.Start( chip.eチャンネル番号, chip.rAVI, SampleFramework.GameWindowSize.Width, SampleFramework.GameWindowSize.Height, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chip.n発声時刻ms );
163 this.Start( chip.eチャンネル番号, chip.rAVI, (int)chip.rAVI.avi.nフレーム幅, (int)chip.rAVI.avi.nフレーム高さ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chip.n発声時刻ms );
167 case EAVIType.AVIPAN:
169 if (chip.rAVIPan != null)
171 if (this.rAVI == null)
173 this.rAVI = chip.rAVI; // DTXVモードで、最初に途中再生で起動したときに、ここに来る
175 this.bFullScreenMovie = (chip.eチャンネル番号 == EChannel.MovieFull || CDTXMania.Instance.ConfigIni.bFullAVI); // DTXVモードで、最初に途中再生で起動したときのために必要
176 this.rAVI.avi.Seek(n移動開始時刻ms - chip.n発声時刻ms);
177 this.Start(chip.eチャンネル番号, chip.rAVI, chip.rAVIPan.sz開始サイズ.Width, chip.rAVIPan.sz開始サイズ.Height, chip.rAVIPan.sz終了サイズ.Width, chip.rAVIPan.sz終了サイズ.Height, chip.rAVIPan.pt動画側開始位置.X, chip.rAVIPan.pt動画側開始位置.Y, chip.rAVIPan.pt動画側終了位置.X, chip.rAVIPan.pt動画側終了位置.Y, chip.rAVIPan.pt表示側開始位置.X, chip.rAVIPan.pt表示側開始位置.Y, chip.rAVIPan.pt表示側終了位置.X, chip.rAVIPan.pt表示側終了位置.Y, chip.n総移動時間, chip.n発声時刻ms);
186 if ((this.rAVI != null) && (this.rAVI.avi != null))
192 public void Cont(int n再開時刻ms)
194 if ((this.rAVI != null) && (this.rAVI.avi != null))
196 this.n移動開始時刻ms = n再開時刻ms;
201 /// この関数は AVI 再生のために使用できません。かわりに座標と大きさ指定可能な描画関数を使用してください。
203 /// <returns></returns>
204 public override int On進行描画()
209 public int t進行描画(int x, int y, int w, int h)
212 CDTXMania.Instance.ConfigIni.bAVI &&
213 !CDTXMania.Instance.ConfigIni.bStoicMode)
215 if (((this.n移動開始時刻ms == -1) || (this.rAVI == null)) || (this.rAVI.avi == null))
219 if (this.tx描画用 == null)
223 int time = (int)((CSound管理.rc演奏用タイマ.n現在時刻 - this.n移動開始時刻ms) * (((double)CDTXMania.Instance.ConfigIni.nPlaySpeed) / 20.0));
224 if ((this.n総移動時間ms != 0) && (this.n総移動時間ms < time))
230 if ((this.n総移動時間ms == 0) && time >= this.rAVI.avi.GetDuration())
232 if (!bIsPreviewMovie)
237 // PREVIEW時はループ再生する。移動開始時刻msを現時刻にして(=AVIを最初に巻き戻して)、ここまでに行った計算をやり直す。
238 this.n移動開始時刻ms = CSound管理.rc演奏用タイマ.n現在時刻;
239 time = (int)((CSound管理.rc演奏用タイマ.n現在時刻 - this.n移動開始時刻ms) * (((double)CDTXMania.Instance.ConfigIni.nPlaySpeed) / 20.0));
240 this.rAVI.avi.Seek(0);
243 if ((this.tx描画用 != null) && (this.n総移動時間ms != -1))
245 this.rAVI.avi.tGetBitmap(CDTXMania.Instance.Device, this.tx描画用, time);
246 // 旧動画 (278x355以下)の場合と、それ以上の場合とで、拡大/表示位置補正ロジックを変えること。
247 // 旧動画の場合は、「278x355の領域に表示される」ことを踏まえて扱う必要あり。
248 // 例: 上半分だけ動画表示するような場合は・・・「上半分だけ」という表示意図を維持すべきか?それとも無視して全画面拡大すべきか??
249 // chnmr0 : プレビューの場合表示領域いっぱいにアス比保持で拡縮します。
250 // プレビューでない場合単純に縦横2倍、位置変更なしで表示します。
251 // yyagi: BGAの有無を見ないで、単純にFullScreenMovieならアス比保持で拡縮、そうでないなら縦横2倍+位置変更なし。
252 // chnmr0 : 従来の大きさ以上のプレビュー動画で不都合が起きますのでここは常にアス比保持でフィッティングします。
255 float magX = 2, magY = 2;
256 if ( CDTXMania.Instance.DTX != null && CDTXMania.Instance.DTX.bUse556x710BGAAVI )
261 //if (bFullScreenMovie || bIsPreviewMovie) // #37227 2017.5.29 yyagi: 動画表示の拡縮を、右横ウインドウ表示での動画再生にも適用
263 CPreviewMagnifier.EPreviewType e = CPreviewMagnifier.EPreviewType.PlayingFront;
264 if ( bFullScreenMovie ) e = CPreviewMagnifier.EPreviewType.PlayingBackground;
265 if ( bIsPreviewMovie ) e = CPreviewMagnifier.EPreviewType.MusicSelect;
267 CPreviewMagnifier cmg = new CPreviewMagnifier( e, xx, yy );
269 (int) this.rAVI.avi.nフレーム幅,
270 (int) this.rAVI.avi.nフレーム高さ,
276 if (bFullScreenMovieCentering)
283 xx = nFullScreenMovieX;
284 yy = nFullScreenMovieY;
288 this.tx描画用.vc拡大縮小倍率.X = magX;
289 this.tx描画用.vc拡大縮小倍率.Y = magY;
290 this.tx描画用.vc拡大縮小倍率.Z = 1.0f;
291 this.tx描画用.bFlipY = true;
292 this.tx描画用.t2D描画(CDTXMania.Instance.Device, xx, yy);
298 public override void On活性化()
304 this.bHasBGA = false;
305 this.bFullScreenMovie = false;
310 public override void OnManagedリソースの作成()
315 this.PrepareProperSizeTexture(
316 ( bIsPreviewMovie ) ? 204 : SampleFramework.GameWindowSize.Width,
317 ( bIsPreviewMovie ) ? 269 : SampleFramework.GameWindowSize.Height
320 this.PrepareProperSizeTexture(
321 (bIsPreviewMovie) ? 204 : SampleFramework.GameWindowSize.Width,
322 (bIsPreviewMovie) ? 269 : SampleFramework.GameWindowSize.Height
325 this.tx描画用.vc拡大縮小倍率 = new Vector3(Scale.X, Scale.Y, 1f);
326 base.OnManagedリソースの作成();
329 public override void OnManagedリソースの解放()
333 if (this.tx描画用 != null)
335 this.tx描画用.Dispose();
338 base.OnManagedリソースの解放();