From 82ba45b3f22a761df6e06ff6a540b91f1aa20fdc Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 16 Sep 2013 21:26:57 -0700 Subject: New feature: "MIDI thru" is implemented by bindings from input ports to output ports which is user-configurable and stored in the .ini file. Tracks no longer perform "MIDI thru", but only capture and playback. --- Sekaiju.ini | 19 ++++++++++- Sekaiju.sln | 20 ++++++++++++ Sekaiju.vcproj | 8 +++++ SekaijuRes/SekaijuEnu.rc | 73 ++++++++++++++++++++++++++++++++++++++++++ src/MIDIDeviceSheet.cpp | 3 ++ src/MIDIDeviceSheet.h | 2 ++ src/MIDIThruBindingPage.cpp | 77 +++++++++++++++++++++++++++++++++++++++++++++ src/MIDIThruBindingPage.h | 56 +++++++++++++++++++++++++++++++++ src/Resource.h | 18 +++++++++++ src/SekaijuApp.cpp | 59 +++++++++++++++++----------------- src/SekaijuApp.h | 5 +++ 11 files changed, 311 insertions(+), 29 deletions(-) create mode 100644 src/MIDIThruBindingPage.cpp create mode 100644 src/MIDIThruBindingPage.h diff --git a/Sekaiju.ini b/Sekaiju.ini index 56981ba..bc31c8a 100755 --- a/Sekaiju.ini +++ b/Sekaiju.ini @@ -32,6 +32,23 @@ 013="" 014="" 015="" +[MIDIThruBinding] +000=1 +001=2 +002=3 +003=4 +004=5 +005=6 +006=7 +007=8 +008=9 +009=10 +010=11 +011=12 +012=13 +013=14 +014=15 +015=16 [MIDIInstDefNorm] 000=Microsoft GS Wavetable Synth 001= @@ -208,7 +225,7 @@ EnableTrackZoomKey=1 EnableTimeZoomKey=0 SpeakerModeVisibleTrack=0 [CurrentPage] -MIDIDevice=1 +MIDIDevice=2 Option=0 [Control] Playing=0 diff --git a/Sekaiju.sln b/Sekaiju.sln index 215bed5..8f61c0e 100755 --- a/Sekaiju.sln +++ b/Sekaiju.sln @@ -3,10 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sekaiju", "Sekaiju.vcproj", "{0C7031CF-DC05-4435-8B37-0B91980BFB74}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SekaijuRes", "SekaijuRes\SekaijuRes.vcproj", "{7EB5B873-E2BD-492C-8C78-5FB16EF767E9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 DebugU|Win32 = DebugU|Win32 + Enu|Win32 = Enu|Win32 + Jpn|Win32 = Jpn|Win32 Release|Win32 = Release|Win32 ReleaseU|Win32 = ReleaseU|Win32 EndGlobalSection @@ -15,10 +19,26 @@ Global {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Debug|Win32.Build.0 = Debug|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.DebugU|Win32.ActiveCfg = DebugU|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.DebugU|Win32.Build.0 = DebugU|Win32 + {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Enu|Win32.ActiveCfg = Debug|Win32 + {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Enu|Win32.Build.0 = Debug|Win32 + {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Jpn|Win32.ActiveCfg = Debug|Win32 + {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Jpn|Win32.Build.0 = Debug|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Release|Win32.ActiveCfg = Release|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.Release|Win32.Build.0 = Release|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32 {0C7031CF-DC05-4435-8B37-0B91980BFB74}.ReleaseU|Win32.Build.0 = ReleaseU|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Debug|Win32.ActiveCfg = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Debug|Win32.Build.0 = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.DebugU|Win32.ActiveCfg = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.DebugU|Win32.Build.0 = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Enu|Win32.ActiveCfg = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Enu|Win32.Build.0 = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Jpn|Win32.ActiveCfg = Jpn|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Jpn|Win32.Build.0 = Jpn|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Release|Win32.ActiveCfg = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.Release|Win32.Build.0 = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.ReleaseU|Win32.ActiveCfg = Enu|Win32 + {7EB5B873-E2BD-492C-8C78-5FB16EF767E9}.ReleaseU|Win32.Build.0 = Enu|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Sekaiju.vcproj b/Sekaiju.vcproj index bbfeb73..660b9bc 100755 --- a/Sekaiju.vcproj +++ b/Sekaiju.vcproj @@ -2082,6 +2082,14 @@ /> + + + + diff --git a/SekaijuRes/SekaijuEnu.rc b/SekaijuRes/SekaijuEnu.rc index 23af703..d5d6f74 100755 --- a/SekaijuRes/SekaijuEnu.rc +++ b/SekaijuRes/SekaijuEnu.rc @@ -1445,6 +1445,79 @@ BEGIN END +// MIDI Thru Binding Page +IDD_MIDITHRUBINDING DIALOG DISCARDABLE 0, 0, 300, 268 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "MIDI Thru Binding" +FONT 9, "MS Sans Serif" +BEGIN + LTEXT "In Port01", IDC_STATIC, + 8, 8, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_01, + 60, 8, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port02", IDC_STATIC, + 8, 24, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_02, + 60, 24, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port03", IDC_STATIC, + 8, 40, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_03, + 60, 40, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port04", IDC_STATIC, + 8, 56, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_04, + 60, 56, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port05", IDC_STATIC, + 8, 72, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_05, + 60, 72, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port06", IDC_STATIC, + 8, 88, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_06, + 60, 88, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port07", IDC_STATIC, + 8, 104, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_07, + 60, 104, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port08", IDC_STATIC, + 8, 120, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_08, + 60, 120, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port09", IDC_STATIC, + 8, 136, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_09, + 60, 136, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port10", IDC_STATIC, + 8, 152, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_10, + 60, 152, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port11", IDC_STATIC, + 8, 168, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_11, + 60, 168, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port12", IDC_STATIC, + 8, 184, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_12, + 60, 184, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port13", IDC_STATIC, + 8, 200, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_13, + 60, 200, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port14", IDC_STATIC, + 8, 216, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_14, + 60, 216, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port15", IDC_STATIC, + 8, 232, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_15, + 60, 232, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL + LTEXT "In Port16", IDC_STATIC, + 8, 248, 52, 16; + EDITTEXT IDC_MIDITHRUBINDING_16, + 60, 248, 232, 100, WS_TABSTOP | ES_AUTOHSCROLL +END + + // MIDI Instrument definition (Normal) Page IDD_MIDIINSTDEFNORM DIALOG DISCARDABLE 0, 0, 300, 268 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU diff --git a/src/MIDIDeviceSheet.cpp b/src/MIDIDeviceSheet.cpp index f8ee5bb..b1a3ed8 100644 --- a/src/MIDIDeviceSheet.cpp +++ b/src/MIDIDeviceSheet.cpp @@ -29,6 +29,7 @@ #include "SekaijuApp.h" #include "MIDIInDevicePage.h" #include "MIDIOutDevicePage.h" +#include "MIDIThruBindingPage.h" #include "MIDIInstDefNormPage.h" #include "MIDIInstDefDrumPage.h" #include "MIDIDeviceSheet.h" @@ -42,6 +43,7 @@ CMIDIDeviceSheet::CMIDIDeviceSheet (CWnd* pParentWnd) :CPropertySheet (IDS_MIDIDEVICE_AND_INSTRUMENT, pParentWnd) { AddPage (&m_theMIDIInDevicePage); AddPage (&m_theMIDIOutDevicePage); + AddPage (&m_theMIDIThruBindingPage); AddPage (&m_theMIDIInstDefNormPage); AddPage (&m_theMIDIInstDefDrumPage); } @@ -87,6 +89,7 @@ void CMIDIDeviceSheet::OnApplyNow () { pSekaijuApp->ApplyMIDIDeviceSheet (this); m_theMIDIInDevicePage.SetModified (FALSE); m_theMIDIOutDevicePage.SetModified (FALSE); + m_theMIDIThruBindingPage.SetModified (FALSE); m_theMIDIInstDefNormPage.SetModified (FALSE); m_theMIDIInstDefDrumPage.SetModified (FALSE); } diff --git a/src/MIDIDeviceSheet.h b/src/MIDIDeviceSheet.h index 4476561..b797808 100644 --- a/src/MIDIDeviceSheet.h +++ b/src/MIDIDeviceSheet.h @@ -23,6 +23,7 @@ #include "MIDIInDevicePage.h" #include "MIDIOutDevicePage.h" +#include "MIDIThruBindingPage.h" #include "MIDIInstDefNormPage.h" #include "MIDIInstDefDrumPage.h" @@ -33,6 +34,7 @@ class CMIDIDeviceSheet : public CPropertySheet { public: CMIDIInDevicePage m_theMIDIInDevicePage; // MIDI入力デバイスページ CMIDIOutDevicePage m_theMIDIOutDevicePage; // MIDI出力デバイスページ + CMIDIThruBindingPage m_theMIDIThruBindingPage; // MIDI入出関係(ループ)ページ CMIDIInstDefNormPage m_theMIDIInstDefNormPage; // MIDIインストゥルメント(通常)ページ CMIDIInstDefDrumPage m_theMIDIInstDefDrumPage; // MIDIインストゥルメント(ドラム)ページ //-------------------------------------------------------------------------- diff --git a/src/MIDIThruBindingPage.cpp b/src/MIDIThruBindingPage.cpp new file mode 100644 index 0000000..409da5e --- /dev/null +++ b/src/MIDIThruBindingPage.cpp @@ -0,0 +1,77 @@ +//****************************************************************************** +// MIDIシーケンサーソフト『世界樹』 +// MIDI入力同期モードページクラス +// (C)2002-2010 おーぷんMIDIぷろじぇくと/くず +//****************************************************************************** + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Lesser General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2.1 of the License, or (at your option) any later version. */ + +/* This library 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. See the GNU */ +/* Lesser General Public License for more details. */ + +/* You should have received a copy of the GNU Lesser General Public */ +/* License along with this library; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "winver.h" +#include +#include +#include "../../MIDIIO/MIDIIO.h" +#include "../../MIDIData/MIDIData.h" +#include "../../MIDIClock/MIDIClock.h" +#include "../../MIDIStatus/MIDIStatus.h" +#include "../../MIDIInstrument/MIDIInstrument.h" +#include "SekaijuApp.h" +#include "MIDIThruBindingPage.h" +#include "MIDIDeviceSheet.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +IMPLEMENT_DYNCREATE (CMIDIThruBindingPage, CPropertyPage) + +//------------------------------------------------------------------------------ +// 構築と破壊 +//------------------------------------------------------------------------------ + +// コンストラクタ +CMIDIThruBindingPage::CMIDIThruBindingPage () : +CPropertyPage (IDD_MIDITHRUBINDING) { +} + +// デストラクタ +CMIDIThruBindingPage::~CMIDIThruBindingPage () { +} + +//------------------------------------------------------------------------------ +// オーバーライド +//------------------------------------------------------------------------------ +void CMIDIThruBindingPage::DoDataExchange (CDataExchange* pDX) { + long i; + for (i = 0; i < MAXMIDIINDEVICENUM; i++) { + DDX_Text (pDX, IDC_MIDITHRUBINDING_01 + i, m_nMIDIThruBinding[i]); + } +} + +// ダイアログの初期化 +BOOL CMIDIThruBindingPage::OnInitDialog () { + CDialog::OnInitDialog(); + return TRUE; +} + + +//------------------------------------------------------------------------------ +// メッセージマップ +//------------------------------------------------------------------------------ +BEGIN_MESSAGE_MAP (CMIDIThruBindingPage, CPropertyPage) +END_MESSAGE_MAP () diff --git a/src/MIDIThruBindingPage.h b/src/MIDIThruBindingPage.h new file mode 100644 index 0000000..af62449 --- /dev/null +++ b/src/MIDIThruBindingPage.h @@ -0,0 +1,56 @@ +//****************************************************************************** +// MIDIシーケンサーソフト『世界樹』 +// MIDI入力同期モードページクラス +// (C)2002-2010 おーぷんMIDIぷろじぇくと/くず +//****************************************************************************** + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Lesser General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2.1 of the License, or (at your option) any later version. */ + +/* This library 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. See the GNU */ +/* Lesser General Public License for more details. */ + +/* You should have received a copy of the GNU Lesser General Public */ +/* License along with this library; if not, write to the Free Software */ +/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _MIDITRHUBINDINGPAGE_H_ +#define _MIDITRHUBINDINGPAGE_H_ + + +class CMIDIThruBindingPage : public CPropertyPage { + DECLARE_DYNCREATE (CMIDIThruBindingPage) + + //-------------------------------------------------------------------------- + // アトリビュート + //-------------------------------------------------------------------------- +public: + int m_nMIDIThruBinding[MAXMIDIINDEVICENUM]; + + //-------------------------------------------------------------------------- + // 構築と破壊 + //-------------------------------------------------------------------------- +public: + CMIDIThruBindingPage (); // コンストラクタ + virtual ~CMIDIThruBindingPage (); // デストラクタ + + //-------------------------------------------------------------------------- + // オーバーライド + //-------------------------------------------------------------------------- +protected: + virtual void DoDataExchange (CDataExchange* pDX); + virtual BOOL OnInitDialog (); + + //-------------------------------------------------------------------------- + // メッセージマップ + //-------------------------------------------------------------------------- +protected: + DECLARE_MESSAGE_MAP () + +}; + +#endif diff --git a/src/Resource.h b/src/Resource.h index 920e37b..7ac1e36 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -1262,6 +1262,7 @@ #define IDD_MIDIINDEVICE 0x4333 #define IDD_MIDIOUTDEVICE 0x4334 +#define IDD_MIDITHRUBINDING 0x4335 #define IDD_MIDIINSTDEFNORM 0x4343 #define IDD_MIDIINSTDEFDRUM 0x4344 #define IDD_MIDIINSYNCMODE 0x4353 @@ -1496,6 +1497,23 @@ #define IDC_MIDIINDEVICE_15 0x700E #define IDC_MIDIINDEVICE_16 0x700F +#define IDC_MIDITHRUBINDING_01 0x7080 +#define IDC_MIDITHRUBINDING_02 0x7081 +#define IDC_MIDITHRUBINDING_03 0x7082 +#define IDC_MIDITHRUBINDING_04 0x7083 +#define IDC_MIDITHRUBINDING_05 0x7084 +#define IDC_MIDITHRUBINDING_06 0x7085 +#define IDC_MIDITHRUBINDING_07 0x7086 +#define IDC_MIDITHRUBINDING_08 0x7087 +#define IDC_MIDITHRUBINDING_09 0x7088 +#define IDC_MIDITHRUBINDING_10 0x7089 +#define IDC_MIDITHRUBINDING_11 0x708A +#define IDC_MIDITHRUBINDING_12 0x708B +#define IDC_MIDITHRUBINDING_13 0x708C +#define IDC_MIDITHRUBINDING_14 0x708D +#define IDC_MIDITHRUBINDING_15 0x708E +#define IDC_MIDITHRUBINDING_16 0x708F + #define IDC_MIDIOUTDEVICE_01 0x7100 #define IDC_MIDIOUTDEVICE_02 0x7101 #define IDC_MIDIOUTDEVICE_03 0x7102 diff --git a/src/SekaijuApp.cpp b/src/SekaijuApp.cpp index 8fe4eb9..8af01a5 100644 --- a/src/SekaijuApp.cpp +++ b/src/SekaijuApp.cpp @@ -722,6 +722,12 @@ BOOL CSekaijuApp::LoadIniFile () { if (m_strMIDIOutName[0] == _T("")) { m_strMIDIOutName[0] = _T("MIDI Mapper"); } + // [MIDIThruBinding] + for (i = 0; i < MAXMIDIINDEVICENUM; i++) { + memset (szTemp, 0, sizeof (szTemp)); + _sntprintf (szTemp, 255, _T("%03d"), i); + m_nMIDIThruBinding[i] = GetProfileInt (_T("MIDIThruBinding"), szTemp, i + 1); + } // [MIDIInstDefNorm] for (i = 0; i < MAXMIDIOUTDEVICENUM; i++) { memset (szTemp, 0, sizeof (szTemp)); @@ -748,6 +754,8 @@ BOOL CSekaijuApp::LoadIniFile () { _sntprintf (szTemp, 255, _T("%03d"), i); m_lMIDIOutSyncMode[i] = GetProfileInt (_T("MIDIOutSyncMode"), szTemp, i == 0 ? 1 : 0); } + // [MIDIThroughPatch] + // [WindowPlacement] m_theWindowPlacement.m_bIconic = (BOOL)GetProfileInt (_T("WindowPlacement"), _T("Iconic"), FALSE); @@ -981,6 +989,12 @@ BOOL CSekaijuApp::SaveIniFile () { CString quotedVal = CString(_T("\"")) + m_strMIDIOutName[i] + _T("\""); WriteProfileString (_T("MIDIOutDevice"), szTemp, quotedVal); } + // [MIDIThruBinding] + for (i = 0; i < MAXMIDIINDEVICENUM; i++) { + memset (szTemp, 0, sizeof (szTemp)); + _sntprintf (szTemp, 255, _T("%03d"), i); + WriteProfileInt (_T("MIDIThruBinding"), szTemp, m_nMIDIThruBinding[i]); + } // [MIDIInstDefNorm] for (i = 0; i < MAXMIDIOUTDEVICENUM; i++) { memset (szTemp, 0, sizeof (szTemp)); @@ -1528,6 +1542,7 @@ BOOL CSekaijuApp::PlayRecordProc (LPVOID pInfo) { for (i = 0; i < MAXMIDIINDEVICENUM; i++) { // MIDI入力デバイスが有効ならば if (m_pMIDIIn[i] != NULL) { + int nMidiThru = pSekaijuApp->m_nMIDIThruBinding[i] - 1; long lMIDIInSyncMode = pSekaijuApp->m_lMIDIInSyncMode[i]; // MIDIメッセージの取得できる限り while (1) { @@ -1539,6 +1554,20 @@ BOOL CSekaijuApp::PlayRecordProc (LPVOID pInfo) { } // MIDIInStatusへの記録 MIDIStatus_PutMIDIMessage (m_pMIDIInStatus[i], byMsg, lLen); + + // ループ + if (nMidiThru >= 0 && nMidiThru < MAXMIDIOUTDEVICENUM) { + MIDIOut* pMIDIOut = m_pMIDIOut[nMidiThru]; + if (pMIDIOut) + MIDIOut_PutMIDIMessage (pMIDIOut, byMsg, lLen); + // MIDIチャンネルメッセージの場合 + if (0x80 <= byMsg[0] && byMsg[0] <= 0xEF) { + MIDIStatus* pMIDIOutStatus = m_pMIDIOutStatus[nMidiThru]; + if (pMIDIOutStatus) + MIDIStatus_PutMIDIMessage (pMIDIOutStatus, byMsg, lLen); + } + } + // アクティブセンシングの場合 if (byMsg[0] == 0xFE) { ; @@ -1611,28 +1640,11 @@ BOOL CSekaijuApp::PlayRecordProc (LPVOID pInfo) { if (lInputOn && lInputPort == i && lInputChannel == (byMsg[0] & 0x0F)) { // 出力チャンネルの変換 BYTE byMsg2[sizeof(byMsg)]; - memset (byMsg2, 0, sizeof (byMsg)); memcpy (byMsg2, byMsg, sizeof (byMsg)); if (0 <= lOutputChannel && lOutputChannel < 16) { byMsg2[0] &= 0xF0; byMsg2[0] |= (BYTE)lOutputChannel; } - // 音出し処理(演奏中でなくかつ録音中でない場合のみ) - if (!(m_bPlaying && m_bRecording)) { - MIDIOut* pMIDIOut = NULL; - MIDIStatus* pMIDIOutStatus = NULL; - if (0 <= lOutputPort && lOutputPort < MAXMIDIOUTDEVICENUM) { - pMIDIOut = m_pMIDIOut[lOutputPort]; - pMIDIOutStatus = m_pMIDIOutStatus [lOutputPort]; - } - if (pMIDIOut) { - //TODO:MIDIメッセージがループバックする場合下記を無効にしてください。 - MIDIOut_PutMIDIMessage (pMIDIOut, byMsg2, lLen); - } - if (pMIDIOutStatus) { - MIDIStatus_PutMIDIMessage (pMIDIOutStatus, byMsg2, lLen); - } - } // このMIDIメッセージをMIDIデータに記録 if (m_bRecording) { MIDIEvent* pMIDIEvent = MIDIEvent_Create @@ -1686,17 +1698,6 @@ BOOL CSekaijuApp::PlayRecordProc (LPVOID pInfo) { long lOutputPort = MIDITrack_GetOutputPort (pMIDITrack); long lOutputChannel = MIDITrack_GetOutputChannel (pMIDITrack); if (lInputOn && lInputPort == i && lInputChannel == -1) { - // 音出し処理(演奏中でなくかつ録音中でない場合のみ) - if (!(m_bPlaying && m_bRecording)) { - MIDIOut* pMIDIOut = NULL; - if (0 <= lOutputPort && lOutputPort < MAXMIDIOUTDEVICENUM) { - pMIDIOut = m_pMIDIOut[lOutputPort]; - } - if (pMIDIOut) { - //TODO:MIDIメッセージがループバックする場合下記を無効にしてください。 - MIDIOut_PutMIDIMessage (pMIDIOut, byMsg, lLen); - } - } // このMIDIメッセージをMIDIデータに記録 if (m_bRecording) { MIDITrack_InsertSysExEvent @@ -3494,6 +3495,7 @@ void CSekaijuApp::OnSetupMIDIDevice () { else { theSheet.m_theMIDIInDevicePage.m_strMIDIInName[i] = m_strMIDIInName[i]; } + theSheet.m_theMIDIThruBindingPage.m_nMIDIThruBinding[i] = m_nMIDIThruBinding[i]; } for (i = 0; i < MAXMIDIOUTDEVICENUM; i++) { if (m_strMIDIOutName[i] == _T("")) { @@ -3522,6 +3524,7 @@ void CSekaijuApp::OnSetupMIDIDevice () { if (theSheet.DoModal () == IDOK) { for (i = 0; i < MAXMIDIINDEVICENUM; i++) { m_strMIDIInName[i] = theSheet.m_theMIDIInDevicePage.m_strMIDIInName[i]; + m_nMIDIThruBinding[i] = theSheet.m_theMIDIThruBindingPage.m_nMIDIThruBinding[i]; } for (i = 0; i < MAXMIDIOUTDEVICENUM; i++) { m_strMIDIOutName[i] = theSheet.m_theMIDIOutDevicePage.m_strMIDIOutName[i]; diff --git a/src/SekaijuApp.h b/src/SekaijuApp.h index 131d04c..22efde9 100644 --- a/src/SekaijuApp.h +++ b/src/SekaijuApp.h @@ -368,6 +368,11 @@ public: long m_lMIDIInSyncMode[MAXMIDIINDEVICENUM]; long m_lMIDIOutSyncMode[MAXMIDIOUTDEVICENUM]; + // MIDI入出力関係(ループバック) + // Associates each input port with output port to which + // received events are sent. Zero means: no MIDI through for that port. + int m_nMIDIThruBinding[MAXMIDIINDEVICENUM]; + // コントロール状態 BOOL m_bPlaying; // 演奏フラグ (0=停止中,1=演奏中) BOOL m_bRecording; // 録音フラグ (0=停止中,1=録音中) -- cgit v1.2.3