• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等


Commit MetaInfo

Revisionc701ef24464dec0d6505c55d8dfc6d9db4c8dbb3 (tree)
Time2023-08-06 14:38:45
Authoryoshy <yoshy@user...>
Commiteryoshy

Log Message

[WORKING] PianoRollRingシーンのノートボックスオブジェクトをMod化

Change Summary

Incremental Difference

--- a/MIDITrail/MIDITrail.vcxproj
+++ b/MIDITrail/MIDITrail.vcxproj
@@ -197,6 +197,7 @@
197197 <ResourceCompile Include="MIDITrail.rc" />
198198 </ItemGroup>
199199 <ItemGroup>
200+ <ClCompile Include="MTNoteBoxRingMod.cpp" />
200201 <ClCompile Include="MTNoteDesignRingMod.cpp" />
201202 <ClCompile Include="MTNoteRippleRingMod.cpp" />
202203 <ClCompile Include="MTGridRingMod.cpp" />
@@ -289,6 +290,7 @@
289290 </ClCompile>
290291 </ItemGroup>
291292 <ItemGroup>
293+ <ClInclude Include="MTNoteBoxRingMod.h" />
292294 <ClInclude Include="MTNoteDesignRingMod.h" />
293295 <ClInclude Include="MTNoteRippleRingMod.h" />
294296 <ClInclude Include="MTGridRingMod.h" />
--- a/MIDITrail/MIDITrail.vcxproj.filters
+++ b/MIDITrail/MIDITrail.vcxproj.filters
@@ -305,6 +305,9 @@
305305 <ClCompile Include="MTNoteDesignRingMod.cpp">
306306 <Filter>Sources\SceneObject</Filter>
307307 </ClCompile>
308+ <ClCompile Include="MTNoteBoxRingMod.cpp">
309+ <Filter>Sources\SceneObject</Filter>
310+ </ClCompile>
308311 </ItemGroup>
309312 <ItemGroup>
310313 <ClInclude Include="MIDITrailApp.h">
@@ -574,5 +577,8 @@
574577 <ClInclude Include="MTNoteDesignRingMod.h">
575578 <Filter>Sources\SceneObject</Filter>
576579 </ClInclude>
580+ <ClInclude Include="MTNoteBoxRingMod.h">
581+ <Filter>Sources\SceneObject</Filter>
582+ </ClInclude>
577583 </ItemGroup>
578584 </Project>
\ No newline at end of file
--- a/MIDITrail/MTNoteBoxMod.cpp
+++ b/MIDITrail/MTNoteBoxMod.cpp
@@ -29,6 +29,7 @@ using namespace YNBaseLib;
2929 //******************************************************************************
3030 MTNoteBoxMod::MTNoteBoxMod(void) : MTNoteBox()
3131 {
32+ m_pNoteDesignMod = NULL;
3233 m_pNoteStatusMod = NULL;
3334 ZeroMemory(m_KeyDownRate, sizeof(float) * MT_NOTEBOX_MAX_PORT_NUM * SM_MAX_CH_NUM * SM_MAX_NOTE_NUM);
3435 }
@@ -60,10 +61,6 @@ int MTNoteBoxMod::Create(
6061 result = MTNoteBox::Create(pD3DDevice, pSceneName, pSeqData, pNotePitchBend);
6162 if (result != 0) goto EXIT;
6263
63- //ノートデザインModオブジェクト初期化
64- result = m_NoteDesignMod.Initialize(pSceneName, pSeqData);
65- if (result != 0) goto EXIT;
66-
6764 //トラック取得
6865 result = pSeqData->GetMergedTrack(&track);
6966 if (result != 0) goto EXIT;
@@ -77,6 +74,26 @@ EXIT:;
7774 }
7875
7976 //******************************************************************************
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+//******************************************************************************
8097 // ノート情報配列生成
8198 //******************************************************************************
8299 int MTNoteBoxMod::_CreateNoteStatus()
@@ -162,8 +179,8 @@ int MTNoteBoxMod::_UpdateStatusOfActiveNotes(
162179 SMNote note;
163180
164181 //波紋ディケイ・リリース時間(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();
167184
168185 //ノート情報を更新する
169186 for (i = 0; i < MTNOTEBOX_MAX_ACTIVENOTE_NUM; i++) {
@@ -393,8 +410,14 @@ EXIT:;
393410 //******************************************************************************
394411 void MTNoteBoxMod::Release()
395412 {
413+ delete m_pNoteDesignMod;
414+ m_pNoteDesignMod = NULL;
415+ m_pNoteDesign = NULL;
416+
396417 delete [] m_pNoteStatusMod;
397418 m_pNoteStatusMod = NULL;
419+
420+ MTNoteBox::Release();
398421 }
399422
400423 //******************************************************************************
@@ -439,7 +462,7 @@ int MTNoteBoxMod::_CreateVertexOfNote(
439462 //ノートボックス頂点座標取得
440463 if (keyDownRate == 0.0f) {
441464 //通常ノートの場合
442- m_NoteDesignMod.GetNoteBoxVirtexPos(
465+ m_pNoteDesignMod->GetNoteBoxVirtexPos(
443466 note.startTime,
444467 note.portNo,
445468 note.chNo,
@@ -451,7 +474,7 @@ int MTNoteBoxMod::_CreateVertexOfNote(
451474 pitchBendValue,
452475 pitchBendSensitivity
453476 );
454- m_NoteDesignMod.GetNoteBoxVirtexPos(
477+ m_pNoteDesignMod->GetNoteBoxVirtexPos(
455478 note.endTime,
456479 note.portNo,
457480 note.chNo,
@@ -466,7 +489,7 @@ int MTNoteBoxMod::_CreateVertexOfNote(
466489 }
467490 else {
468491 //発音中ノートの場合:キー押し下げ率でサイズが変化する
469- m_NoteDesignMod.GetActiveNoteBoxVirtexPos(
492+ m_pNoteDesignMod->GetActiveNoteBoxVirtexPos(
470493 note.startTime,
471494 note.portNo,
472495 note.chNo,
@@ -479,7 +502,7 @@ int MTNoteBoxMod::_CreateVertexOfNote(
479502 pitchBendSensitivity,
480503 keyDownRate
481504 );
482- m_NoteDesignMod.GetActiveNoteBoxVirtexPos(
505+ m_pNoteDesignMod->GetActiveNoteBoxVirtexPos(
483506 note.endTime,
484507 note.portNo,
485508 note.chNo,
@@ -560,11 +583,11 @@ int MTNoteBoxMod::_CreateVertexOfNote(
560583
561584 //各頂点のディフューズ色
562585 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);
564587 }
565588 else {
566589 //発音中はキー押し下げ率によって色が変化する
567- color = m_NoteDesignMod.GetActiveNoteBoxColor(note.portNo, note.chNo, note.noteNo, keyDownRate);
590+ color = m_pNoteDesignMod->GetActiveNoteBoxColor(note.portNo, note.chNo, note.noteNo, keyDownRate);
568591 }
569592
570593 //頂点の色設定完了
--- a/MIDITrail/MTNoteBoxMod.h
+++ b/MIDITrail/MTNoteBoxMod.h
@@ -52,7 +52,7 @@ public:
5252 //リセット
5353 virtual void Reset();
5454
55-private:
55+protected:
5656
5757 //キー状態
5858 enum KeyStatus {
@@ -70,16 +70,6 @@ private:
7070 float keyDownRate;
7171 };
7272
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-
8373 //ノートリスト
8474 SMNoteList m_NoteListRT;
8575
@@ -87,9 +77,16 @@ private:
8777 unsigned long m_PlayTimeMSec;
8878 float m_KeyDownRate[MT_NOTEBOX_MAX_PORT_NUM][SM_MAX_CH_NUM][SM_MAX_NOTE_NUM];
8979
80+ //ノートデザイン
81+ MTNoteDesignMod *m_pNoteDesignMod;
82+
9083 //ノート発音状態情報
9184 NoteStatusMod* m_pNoteStatusMod;
9285
86+ virtual int _UpdateStatusOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice);
87+ virtual int _UpdateVertexOfActiveNotes(LPDIRECT3DDEVICE9 pD3DDevice);
88+
89+ virtual int _CreateNoteDesign();
9390 virtual int _CreateNoteStatus();
9491
9592 int _CreateVertexOfNote(
--- /dev/null
+++ b/MIDITrail/MTNoteBoxRingMod.cpp
@@ -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+}
--- /dev/null
+++ b/MIDITrail/MTNoteBoxRingMod.h
@@ -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+
--- a/MIDITrail/MTNoteRippleMod.h
+++ b/MIDITrail/MTNoteRippleMod.h
@@ -54,14 +54,6 @@ public:
5454
5555 protected:
5656
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-
6557 //ノート発音状態構造体
6658 //キー状態
6759 enum KeyStatus {
@@ -78,13 +70,6 @@ private:
7870 float keyDownRate;
7971 };
8072
81-protected:
82-
83- //ノートデザイン
84- MTNoteDesignMod *m_pNoteDesignMod;
85-
86-private:
87-
8873 //ノートリスト
8974 SMNoteList m_NoteListRT;
9075
@@ -93,9 +78,18 @@ private:
9378 unsigned long m_CurNoteIndex;
9479 float m_KeyDownRate[MTNOTERIPPLE_MAX_PORT_NUM][SM_MAX_CH_NUM][SM_MAX_NOTE_NUM];
9580
81+ //ノートデザイン
82+ MTNoteDesignMod *m_pNoteDesignMod;
83+
9684 //ノート発音状態情報
9785 NoteStatusMod* m_pNoteStatusMod;
9886
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+
9993 virtual int _CreateNoteDesign();
10094
10195 int _SetVertexPosition(
--- a/MIDITrail/MTScenePianoRollRingMod.cpp
+++ b/MIDITrail/MTScenePianoRollRingMod.cpp
@@ -63,6 +63,10 @@ int MTScenePianoRollRingMod::Create(
6363 //----------------------------------
6464 // 描画オブジェクト
6565 //----------------------------------
66+ //ノートボックス生成
67+ result = m_NoteBoxMod.Create(pD3DDevice, GetName(), pSeqData, &m_NotePitchBend);
68+ if (result != 0) goto EXIT;
69+
6670 //ノート波紋生成
6771 result = m_NoteRippleMod.Create(pD3DDevice, GetName(), pSeqData, &m_NotePitchBend);
6872 if (result != 0) goto EXIT;
@@ -100,6 +104,10 @@ int MTScenePianoRollRingMod::Transform(
100104 //回転角度取得
101105 rollAngle = m_FirstPersonCam.GetManualRollAngle();
102106
107+ //ノートボックス更新
108+ result = m_NoteBoxMod.Transform(pD3DDevice, rollAngle);
109+ if (result != 0) goto EXIT;
110+
103111 //グリッドリング更新
104112 result = m_GridRingMod.Transform(pD3DDevice, rollAngle);
105113 if (result != 0) goto EXIT;
@@ -143,7 +151,7 @@ int MTScenePianoRollRingMod::Draw(
143151 if (result != 0) goto EXIT;
144152
145153 //ノートボックス描画
146- result = m_NoteBox.Draw(pD3DDevice);
154+ result = m_NoteBoxMod.Draw(pD3DDevice);
147155 if (result != 0) goto EXIT;
148156
149157 //ピクチャボード描画
@@ -179,6 +187,7 @@ EXIT:;
179187 //******************************************************************************
180188 void MTScenePianoRollRingMod::Release()
181189 {
190+ m_NoteBoxMod.Release();
182191 m_GridRingMod.Release();
183192 m_TimeIndicatorMod.Release();
184193 m_NoteRippleMod.Release();
@@ -219,7 +228,8 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg(
219228 m_NoteRippleMod.SetPlayTimeMSec(parser.GetPlayTimeMSec());
220229 m_NoteRippleMod.SetCurTickTime(parser.GetPlayTickTime());
221230 m_PictBoard.SetCurTickTime(parser.GetPlayTickTime());
222- m_NoteBox.SetCurTickTime(parser.GetPlayTickTime());
231+ m_NoteBoxMod.SetPlayTimeMSec(parser.GetPlayTimeMSec());
232+ m_NoteBoxMod.SetCurTickTime(parser.GetPlayTickTime());
223233 }
224234 //テンポ変更通知
225235 else if (parser.GetMsg() == SMMsgParser::MsgTempo) {
@@ -251,8 +261,8 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg(
251261 if (parser.GetSkipStartDirection() == SMMsgParser::SkipBack) {
252262 m_NotePitchBend.Reset();
253263 }
254- m_NoteBox.Reset();
255- m_NoteBox.SetSkipStatus(true);
264+ m_NoteBoxMod.Reset();
265+ m_NoteBoxMod.SetSkipStatus(true);
256266 m_NoteRippleMod.Reset();
257267 m_NoteRippleMod.SetSkipStatus(true);
258268 m_IsSkipping = true;
@@ -260,7 +270,7 @@ int MTScenePianoRollRingMod::OnRecvSequencerMsg(
260270 //スキップ終了通知
261271 else if (parser.GetMsg() == SMMsgParser::MsgSkipEnd) {
262272 m_Dashboard.SetNotesCount(parser.GetSkipEndNotesCount());
263- m_NoteBox.SetSkipStatus(false);
273+ m_NoteBoxMod.SetSkipStatus(false);
264274 m_NoteRippleMod.SetSkipStatus(false);
265275 m_IsSkipping = false;
266276 }
@@ -277,6 +287,7 @@ void MTScenePianoRollRingMod::_Reset()
277287 MTScenePianoRollRing::_Reset();
278288
279289 m_TimeIndicatorMod.Reset();
290+ m_NoteBoxMod.Reset();
280291 m_NoteRippleMod.Reset();
281292 }
282293
--- a/MIDITrail/MTScenePianoRollRingMod.h
+++ b/MIDITrail/MTScenePianoRollRingMod.h
@@ -10,6 +10,7 @@
1010
1111 #pragma once
1212
13+#include "MTNoteBoxRingMod.h"
1314 #include "MTNoteRippleRingMod.h"
1415 #include "MTGridRingMod.h"
1516 #include "MTTimeIndicatorRingMod.h"
@@ -60,6 +61,7 @@ public:
6061 protected:
6162
6263 //描画オブジェクト
64+ MTNoteBoxRingMod m_NoteBoxMod;
6365 MTNoteRippleRingMod m_NoteRippleMod;
6466 MTGridRingMod m_GridRingMod;
6567 MTTimeIndicatorRingMod m_TimeIndicatorMod;