MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等
Revision | c701ef24464dec0d6505c55d8dfc6d9db4c8dbb3 (tree) |
---|---|
Time | 2023-08-06 14:38:45 |
Author | yoshy <yoshy@user...> |
Commiter | yoshy |
[WORKING] PianoRollRingシーンのノートボックスオブジェクトをMod化
@@ -197,6 +197,7 @@ | ||
197 | 197 | <ResourceCompile Include="MIDITrail.rc" /> |
198 | 198 | </ItemGroup> |
199 | 199 | <ItemGroup> |
200 | + <ClCompile Include="MTNoteBoxRingMod.cpp" /> | |
200 | 201 | <ClCompile Include="MTNoteDesignRingMod.cpp" /> |
201 | 202 | <ClCompile Include="MTNoteRippleRingMod.cpp" /> |
202 | 203 | <ClCompile Include="MTGridRingMod.cpp" /> |
@@ -289,6 +290,7 @@ | ||
289 | 290 | </ClCompile> |
290 | 291 | </ItemGroup> |
291 | 292 | <ItemGroup> |
293 | + <ClInclude Include="MTNoteBoxRingMod.h" /> | |
292 | 294 | <ClInclude Include="MTNoteDesignRingMod.h" /> |
293 | 295 | <ClInclude Include="MTNoteRippleRingMod.h" /> |
294 | 296 | <ClInclude Include="MTGridRingMod.h" /> |
@@ -305,6 +305,9 @@ | ||
305 | 305 | <ClCompile Include="MTNoteDesignRingMod.cpp"> |
306 | 306 | <Filter>Sources\SceneObject</Filter> |
307 | 307 | </ClCompile> |
308 | + <ClCompile Include="MTNoteBoxRingMod.cpp"> | |
309 | + <Filter>Sources\SceneObject</Filter> | |
310 | + </ClCompile> | |
308 | 311 | </ItemGroup> |
309 | 312 | <ItemGroup> |
310 | 313 | <ClInclude Include="MIDITrailApp.h"> |
@@ -574,5 +577,8 @@ | ||
574 | 577 | <ClInclude Include="MTNoteDesignRingMod.h"> |
575 | 578 | <Filter>Sources\SceneObject</Filter> |
576 | 579 | </ClInclude> |
580 | + <ClInclude Include="MTNoteBoxRingMod.h"> | |
581 | + <Filter>Sources\SceneObject</Filter> | |
582 | + </ClInclude> | |
577 | 583 | </ItemGroup> |
578 | 584 | </Project> |
\ No newline at end of file |
@@ -29,6 +29,7 @@ using namespace YNBaseLib; | ||
29 | 29 | //****************************************************************************** |
30 | 30 | MTNoteBoxMod::MTNoteBoxMod(void) : MTNoteBox() |
31 | 31 | { |
32 | + m_pNoteDesignMod = NULL; | |
32 | 33 | m_pNoteStatusMod = NULL; |
33 | 34 | ZeroMemory(m_KeyDownRate, sizeof(float) * MT_NOTEBOX_MAX_PORT_NUM * SM_MAX_CH_NUM * SM_MAX_NOTE_NUM); |
34 | 35 | } |
@@ -60,10 +61,6 @@ int MTNoteBoxMod::Create( | ||
60 | 61 | result = MTNoteBox::Create(pD3DDevice, pSceneName, pSeqData, pNotePitchBend); |
61 | 62 | if (result != 0) goto EXIT; |
62 | 63 | |
63 | - //ノートデザインModオブジェクト初期化 | |
64 | - result = m_NoteDesignMod.Initialize(pSceneName, pSeqData); | |
65 | - if (result != 0) goto EXIT; | |
66 | - | |
67 | 64 | //トラック取得 |
68 | 65 | result = pSeqData->GetMergedTrack(&track); |
69 | 66 | if (result != 0) goto EXIT; |
@@ -77,6 +74,26 @@ EXIT:; | ||
77 | 74 | } |
78 | 75 | |
79 | 76 | //****************************************************************************** |
77 | +// ノートデザイン生成 | |
78 | +//****************************************************************************** | |
79 | +int MTNoteBoxMod::_CreateNoteDesign() | |
80 | +{ | |
81 | + int result = 0; | |
82 | + | |
83 | + try { | |
84 | + m_pNoteDesignMod = new MTNoteDesignMod(); | |
85 | + m_pNoteDesign = m_pNoteDesignMod; | |
86 | + } | |
87 | + catch (std::bad_alloc) { | |
88 | + result = YN_SET_ERR("Could not allocate memory.", 0, 0); | |
89 | + goto EXIT; | |
90 | + } | |
91 | + | |
92 | +EXIT:; | |
93 | + return result; | |
94 | +} | |
95 | + | |
96 | +//****************************************************************************** | |
80 | 97 | // ノート情報配列生成 |
81 | 98 | //****************************************************************************** |
82 | 99 | int MTNoteBoxMod::_CreateNoteStatus() |
@@ -162,8 +179,8 @@ int MTNoteBoxMod::_UpdateStatusOfActiveNotes( | ||
162 | 179 | SMNote note; |
163 | 180 | |
164 | 181 | //波紋ディケイ・リリース時間(msec) |
165 | - unsigned long decayDuration = m_NoteDesignMod.GetRippleDecayDuration(); | |
166 | - unsigned long releaseDuration = m_NoteDesignMod.GetRippleReleaseDuration(); | |
182 | + unsigned long decayDuration = m_pNoteDesignMod->GetRippleDecayDuration(); | |
183 | + unsigned long releaseDuration = m_pNoteDesignMod->GetRippleReleaseDuration(); | |
167 | 184 | |
168 | 185 | //ノート情報を更新する |
169 | 186 | for (i = 0; i < MTNOTEBOX_MAX_ACTIVENOTE_NUM; i++) { |
@@ -393,8 +410,14 @@ EXIT:; | ||
393 | 410 | //****************************************************************************** |
394 | 411 | void MTNoteBoxMod::Release() |
395 | 412 | { |
413 | + delete m_pNoteDesignMod; | |
414 | + m_pNoteDesignMod = NULL; | |
415 | + m_pNoteDesign = NULL; | |
416 | + | |
396 | 417 | delete [] m_pNoteStatusMod; |
397 | 418 | m_pNoteStatusMod = NULL; |
419 | + | |
420 | + MTNoteBox::Release(); | |
398 | 421 | } |
399 | 422 | |
400 | 423 | //****************************************************************************** |
@@ -439,7 +462,7 @@ int MTNoteBoxMod::_CreateVertexOfNote( | ||
439 | 462 | //ノートボックス頂点座標取得 |
440 | 463 | if (keyDownRate == 0.0f) { |
441 | 464 | //通常ノートの場合 |
442 | - m_NoteDesignMod.GetNoteBoxVirtexPos( | |
465 | + m_pNoteDesignMod->GetNoteBoxVirtexPos( | |
443 | 466 | note.startTime, |
444 | 467 | note.portNo, |
445 | 468 | note.chNo, |
@@ -451,7 +474,7 @@ int MTNoteBoxMod::_CreateVertexOfNote( | ||
451 | 474 | pitchBendValue, |
452 | 475 | pitchBendSensitivity |
453 | 476 | ); |
454 | - m_NoteDesignMod.GetNoteBoxVirtexPos( | |
477 | + m_pNoteDesignMod->GetNoteBoxVirtexPos( | |
455 | 478 | note.endTime, |
456 | 479 | note.portNo, |
457 | 480 | note.chNo, |
@@ -466,7 +489,7 @@ int MTNoteBoxMod::_CreateVertexOfNote( | ||
466 | 489 | } |
467 | 490 | else { |
468 | 491 | //発音中ノートの場合:キー押し下げ率でサイズが変化する |
469 | - m_NoteDesignMod.GetActiveNoteBoxVirtexPos( | |
492 | + m_pNoteDesignMod->GetActiveNoteBoxVirtexPos( | |
470 | 493 | note.startTime, |
471 | 494 | note.portNo, |
472 | 495 | note.chNo, |
@@ -479,7 +502,7 @@ int MTNoteBoxMod::_CreateVertexOfNote( | ||
479 | 502 | pitchBendSensitivity, |
480 | 503 | keyDownRate |
481 | 504 | ); |
482 | - m_NoteDesignMod.GetActiveNoteBoxVirtexPos( | |
505 | + m_pNoteDesignMod->GetActiveNoteBoxVirtexPos( | |
483 | 506 | note.endTime, |
484 | 507 | note.portNo, |
485 | 508 | note.chNo, |
@@ -560,11 +583,11 @@ int MTNoteBoxMod::_CreateVertexOfNote( | ||
560 | 583 | |
561 | 584 | //各頂点のディフューズ色 |
562 | 585 | if (keyDownRate == 0.0f) { |
563 | - color = m_NoteDesignMod.GetNoteBoxColor(note.portNo, note.chNo, note.noteNo); | |
586 | + color = m_pNoteDesignMod->GetNoteBoxColor(note.portNo, note.chNo, note.noteNo); | |
564 | 587 | } |
565 | 588 | else { |
566 | 589 | //発音中はキー押し下げ率によって色が変化する |
567 | - color = m_NoteDesignMod.GetActiveNoteBoxColor(note.portNo, note.chNo, note.noteNo, keyDownRate); | |
590 | + color = m_pNoteDesignMod->GetActiveNoteBoxColor(note.portNo, note.chNo, note.noteNo, keyDownRate); | |
568 | 591 | } |
569 | 592 | |
570 | 593 | //頂点の色設定完了 |
@@ -52,7 +52,7 @@ public: | ||
52 | 52 | //リセット |
53 | 53 | virtual void Reset(); |
54 | 54 | |
55 | -private: | |
55 | +protected: | |
56 | 56 | |
57 | 57 | //キー状態 |
58 | 58 | enum KeyStatus { |
@@ -70,16 +70,6 @@ private: | ||
70 | 70 | float keyDownRate; |
71 | 71 | }; |
72 | 72 | |
73 | -protected: | |
74 | - | |
75 | - virtual int _UpdateStatusOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice); | |
76 | - virtual int _UpdateVertexOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice); | |
77 | - | |
78 | -private: | |
79 | - | |
80 | - //ノートデザイン | |
81 | - MTNoteDesignMod m_NoteDesignMod; | |
82 | - | |
83 | 73 | //ノートリスト |
84 | 74 | SMNoteList m_NoteListRT; |
85 | 75 |
@@ -87,9 +77,16 @@ private: | ||
87 | 77 | unsigned long m_PlayTimeMSec; |
88 | 78 | float m_KeyDownRate[MT_NOTEBOX_MAX_PORT_NUM][SM_MAX_CH_NUM][SM_MAX_NOTE_NUM]; |
89 | 79 | |
80 | + //ノートデザイン | |
81 | + MTNoteDesignMod *m_pNoteDesignMod; | |
82 | + | |
90 | 83 | //ノート発音状態情報 |
91 | 84 | NoteStatusMod* m_pNoteStatusMod; |
92 | 85 | |
86 | + virtual int _UpdateStatusOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice); | |
87 | + virtual int _UpdateVertexOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice); | |
88 | + | |
89 | + virtual int _CreateNoteDesign(); | |
93 | 90 | virtual int _CreateNoteStatus(); |
94 | 91 | |
95 | 92 | int _CreateVertexOfNote( |
@@ -0,0 +1,51 @@ | ||
1 | +//****************************************************************************** | |
2 | +// | |
3 | +// MIDITrail / MTNoteBoxRingMod | |
4 | +// | |
5 | +// ノートボックスリング描画Modクラス | |
6 | +// | |
7 | +// Copyright (C) 2019 Yossiepon Oniichan. All Rights Reserved. | |
8 | +// | |
9 | +//****************************************************************************** | |
10 | + | |
11 | +#include "StdAfx.h" | |
12 | +#include "YNBaseLib.h" | |
13 | +#include "MTNoteDesignRingMod.h" | |
14 | +#include "MTNoteBoxRingMod.h" | |
15 | + | |
16 | +using namespace YNBaseLib; | |
17 | + | |
18 | + | |
19 | +//****************************************************************************** | |
20 | +// コンストラクタ | |
21 | +//****************************************************************************** | |
22 | +MTNoteBoxRingMod::MTNoteBoxRingMod(void) | |
23 | +{ | |
24 | +} | |
25 | + | |
26 | +//****************************************************************************** | |
27 | +// デストラクタ | |
28 | +//****************************************************************************** | |
29 | +MTNoteBoxRingMod::~MTNoteBoxRingMod(void) | |
30 | +{ | |
31 | +} | |
32 | + | |
33 | +//****************************************************************************** | |
34 | +// ノートデザイン生成 | |
35 | +//****************************************************************************** | |
36 | +int MTNoteBoxRingMod::_CreateNoteDesign() | |
37 | +{ | |
38 | + int result = 0; | |
39 | + | |
40 | + try { | |
41 | + m_pNoteDesignMod = new MTNoteDesignRingMod(); | |
42 | + m_pNoteDesign = m_pNoteDesignMod; | |
43 | + } | |
44 | + catch (std::bad_alloc) { | |
45 | + result = YN_SET_ERR("Could not allocate memory.", 0, 0); | |
46 | + goto EXIT; | |
47 | + } | |
48 | + | |
49 | +EXIT:; | |
50 | + return result; | |
51 | +} |
@@ -0,0 +1,33 @@ | ||
1 | +//****************************************************************************** | |
2 | +// | |
3 | +// MIDITrail / MTNoteBoxRingMod | |
4 | +// | |
5 | +// ノートボックスリング描画Modクラス | |
6 | +// | |
7 | +// Copyright (C) 2019 Yossiepon Oniichan. All Rights Reserved. | |
8 | +// | |
9 | +//****************************************************************************** | |
10 | + | |
11 | +#pragma once | |
12 | + | |
13 | +#include "MTNoteBoxMod.h" | |
14 | + | |
15 | + | |
16 | +//****************************************************************************** | |
17 | +// ノートボックスリング描画クラス | |
18 | +//****************************************************************************** | |
19 | +class MTNoteBoxRingMod : public MTNoteBoxMod | |
20 | +{ | |
21 | +public: | |
22 | + | |
23 | + //コンストラクタ/デストラクタ | |
24 | + MTNoteBoxRingMod(void); | |
25 | + virtual ~MTNoteBoxRingMod(void); | |
26 | + | |
27 | +private: | |
28 | + | |
29 | + virtual int _CreateNoteDesign(); | |
30 | + | |
31 | +}; | |
32 | + | |
33 | + |
@@ -54,14 +54,6 @@ public: | ||
54 | 54 | |
55 | 55 | protected: |
56 | 56 | |
57 | - virtual int _CreateNoteStatus(); | |
58 | - virtual int _CreateVertex(LPDIRECT3DDEVICE9 pD3DDevice); | |
59 | - virtual void _MakeMaterial(D3DMATERIAL9* pMaterial); | |
60 | - virtual int _TransformRipple(LPDIRECT3DDEVICE9 pD3DDevice); | |
61 | - virtual int _UpdateVertexOfRipple(LPDIRECT3DDEVICE9 pD3DDevice); | |
62 | - | |
63 | -private: | |
64 | - | |
65 | 57 | //ノート発音状態構造体 |
66 | 58 | //キー状態 |
67 | 59 | enum KeyStatus { |
@@ -78,13 +70,6 @@ private: | ||
78 | 70 | float keyDownRate; |
79 | 71 | }; |
80 | 72 | |
81 | -protected: | |
82 | - | |
83 | - //ノートデザイン | |
84 | - MTNoteDesignMod *m_pNoteDesignMod; | |
85 | - | |
86 | -private: | |
87 | - | |
88 | 73 | //ノートリスト |
89 | 74 | SMNoteList m_NoteListRT; |
90 | 75 |
@@ -93,9 +78,18 @@ private: | ||
93 | 78 | unsigned long m_CurNoteIndex; |
94 | 79 | float m_KeyDownRate[MTNOTERIPPLE_MAX_PORT_NUM][SM_MAX_CH_NUM][SM_MAX_NOTE_NUM]; |
95 | 80 | |
81 | + //ノートデザイン | |
82 | + MTNoteDesignMod *m_pNoteDesignMod; | |
83 | + | |
96 | 84 | //ノート発音状態情報 |
97 | 85 | NoteStatusMod* m_pNoteStatusMod; |
98 | 86 | |
87 | + virtual int _CreateNoteStatus(); | |
88 | + virtual int _CreateVertex(LPDIRECT3DDEVICE9 pD3DDevice); | |
89 | + virtual void _MakeMaterial(D3DMATERIAL9* pMaterial); | |
90 | + virtual int _TransformRipple(LPDIRECT3DDEVICE9 pD3DDevice); | |
91 | + virtual int _UpdateVertexOfRipple(LPDIRECT3DDEVICE9 pD3DDevice); | |
92 | + | |
99 | 93 | virtual int _CreateNoteDesign(); |
100 | 94 | |
101 | 95 | int _SetVertexPosition( |
@@ -63,6 +63,10 @@ int MTScenePianoRollRingMod::Create( | ||
63 | 63 | //---------------------------------- |
64 | 64 | // 描画オブジェクト |
65 | 65 | //---------------------------------- |
66 | + //ノートボックス生成 | |
67 | + result = m_NoteBoxMod.Create(pD3DDevice, GetName(), pSeqData, &m_NotePitchBend); | |
68 | + if (result != 0) goto EXIT; | |
69 | + | |
66 | 70 | //ノート波紋生成 |
67 | 71 | result = m_NoteRippleMod.Create(pD3DDevice, GetName(), pSeqData, &m_NotePitchBend); |
68 | 72 | if (result != 0) goto EXIT; |
@@ -100,6 +104,10 @@ int MTScenePianoRollRingMod::Transform( | ||
100 | 104 | //回転角度取得 |
101 | 105 | rollAngle = m_FirstPersonCam.GetManualRollAngle(); |
102 | 106 | |
107 | + //ノートボックス更新 | |
108 | + result = m_NoteBoxMod.Transform(pD3DDevice, rollAngle); | |
109 | + if (result != 0) goto EXIT; | |
110 | + | |
103 | 111 | //グリッドリング更新 |
104 | 112 | result = m_GridRingMod.Transform(pD3DDevice, rollAngle); |
105 | 113 | if (result != 0) goto EXIT; |
@@ -143,7 +151,7 @@ int MTScenePianoRollRingMod::Draw( | ||
143 | 151 | if (result != 0) goto EXIT; |
144 | 152 | |
145 | 153 | //ノートボックス描画 |
146 | - result = m_NoteBox.Draw(pD3DDevice); | |
154 | + result = m_NoteBoxMod.Draw(pD3DDevice); | |
147 | 155 | if (result != 0) goto EXIT; |
148 | 156 | |
149 | 157 | //ピクチャボード描画 |
@@ -179,6 +187,7 @@ EXIT:; | ||
179 | 187 | //****************************************************************************** |
180 | 188 | void MTScenePianoRollRingMod::Release() |
181 | 189 | { |
190 | + m_NoteBoxMod.Release(); | |
182 | 191 | m_GridRingMod.Release(); |
183 | 192 | m_TimeIndicatorMod.Release(); |
184 | 193 | m_NoteRippleMod.Release(); |
@@ -219,7 +228,8 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg( | ||
219 | 228 | m_NoteRippleMod.SetPlayTimeMSec(parser.GetPlayTimeMSec()); |
220 | 229 | m_NoteRippleMod.SetCurTickTime(parser.GetPlayTickTime()); |
221 | 230 | m_PictBoard.SetCurTickTime(parser.GetPlayTickTime()); |
222 | - m_NoteBox.SetCurTickTime(parser.GetPlayTickTime()); | |
231 | + m_NoteBoxMod.SetPlayTimeMSec(parser.GetPlayTimeMSec()); | |
232 | + m_NoteBoxMod.SetCurTickTime(parser.GetPlayTickTime()); | |
223 | 233 | } |
224 | 234 | //テンポ変更通知 |
225 | 235 | else if (parser.GetMsg() == SMMsgParser::MsgTempo) { |
@@ -251,8 +261,8 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg( | ||
251 | 261 | if (parser.GetSkipStartDirection() == SMMsgParser::SkipBack) { |
252 | 262 | m_NotePitchBend.Reset(); |
253 | 263 | } |
254 | - m_NoteBox.Reset(); | |
255 | - m_NoteBox.SetSkipStatus(true); | |
264 | + m_NoteBoxMod.Reset(); | |
265 | + m_NoteBoxMod.SetSkipStatus(true); | |
256 | 266 | m_NoteRippleMod.Reset(); |
257 | 267 | m_NoteRippleMod.SetSkipStatus(true); |
258 | 268 | m_IsSkipping = true; |
@@ -260,7 +270,7 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg( | ||
260 | 270 | //スキップ終了通知 |
261 | 271 | else if (parser.GetMsg() == SMMsgParser::MsgSkipEnd) { |
262 | 272 | m_Dashboard.SetNotesCount(parser.GetSkipEndNotesCount()); |
263 | - m_NoteBox.SetSkipStatus(false); | |
273 | + m_NoteBoxMod.SetSkipStatus(false); | |
264 | 274 | m_NoteRippleMod.SetSkipStatus(false); |
265 | 275 | m_IsSkipping = false; |
266 | 276 | } |
@@ -277,6 +287,7 @@ void MTScenePianoRollRingMod::_Reset() | ||
277 | 287 | MTScenePianoRollRing::_Reset(); |
278 | 288 | |
279 | 289 | m_TimeIndicatorMod.Reset(); |
290 | + m_NoteBoxMod.Reset(); | |
280 | 291 | m_NoteRippleMod.Reset(); |
281 | 292 | } |
282 | 293 |
@@ -10,6 +10,7 @@ | ||
10 | 10 | |
11 | 11 | #pragma once |
12 | 12 | |
13 | +#include "MTNoteBoxRingMod.h" | |
13 | 14 | #include "MTNoteRippleRingMod.h" |
14 | 15 | #include "MTGridRingMod.h" |
15 | 16 | #include "MTTimeIndicatorRingMod.h" |
@@ -60,6 +61,7 @@ public: | ||
60 | 61 | protected: |
61 | 62 | |
62 | 63 | //描画オブジェクト |
64 | + MTNoteBoxRingMod m_NoteBoxMod; | |
63 | 65 | MTNoteRippleRingMod m_NoteRippleMod; |
64 | 66 | MTGridRingMod m_GridRingMod; |
65 | 67 | MTTimeIndicatorRingMod m_TimeIndicatorMod; |