tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板) [ツリー表示へ]   [Home]
一括表示(VB.NET VB2005)
タイトルVB.NETで特定の音階の音だけをを消すには?
記事No2668
投稿日: 2005/11/29(Tue) 14:05
投稿者アチョウ
  Private Sub makefrm_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress

        '打った文字を大文字に変換
        str = StrConv(e.KeyChar, VbStrConv.UpperCase)
        'ド

        If str = Zbtn.Text And Zbtn.Enabled = True Then
            Zbtn.Enabled = False
            onkaiNum = 60
            dwMsg = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &H100) + 100 *
&H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Zbtn.BackColor = BackColor.Aqua
        End If

        If str = Sbtn.Text And Sbtn.Enabled = True Then
            Sbtn.Enabled = False
            onkaiNum = 61
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Sbtn.BackColor = BackColor.Aqua
        End If

        If str = Xbtn.Text And Xbtn.Enabled = True Then
            Xbtn.Enabled = False
            onkaiNum = 62
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Xbtn.BackColor = BackColor.Aqua
        End If

        If str = Dbtn.Text And Dbtn.Enabled = True Then
            Dbtn.Enabled = False
            onkaiNum = 63
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Dbtn.BackColor = BackColor.Aqua
        End If

        If str = Cbtn.Text And Cbtn.Enabled = True Then
            Cbtn.Enabled = False
            onkaiNum = 64
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Cbtn.BackColor = BackColor.Aqua
        End If

        If str = Vbtn.Text And Vbtn.Enabled = True Then
            Vbtn.Enabled = False
            onkaiNum = 65
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Vbtn.BackColor = BackColor.Aqua
        End If

        If str = Gbtn.Text And Gbtn.Enabled = True Then
            Gbtn.Enabled = False
            onkaiNum = 66
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Gbtn.BackColor = BackColor.Aqua
        End If

        If str = Bbtn.Text And Bbtn.Enabled = True Then
            Bbtn.Enabled = False
            onkaiNum = 67
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Bbtn.BackColor = BackColor.Aqua
        End If

        If str = Hbtn.Text And Hbtn.Enabled = True Then
            Hbtn.Enabled = False
            onkaiNum = 68
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Hbtn.BackColor = BackColor.Aqua
        End If

        If str = nBtn.Text And nBtn.Enabled = True Then
            nBtn.Enabled = False
            onkaiNum = 69
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            nBtn.BackColor = BackColor.Aqua
        End If

        If str = Jbtn.Text And Jbtn.Enabled = True Then
            Jbtn.Enabled = False
            onkaiNum = 70
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Jbtn.BackColor = BackColor.Aqua
        End If

        If str = Mbtn.Text And Mbtn.Enabled = True Then
            Mbtn.Enabled = False
            onkaiNum = 71
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Mbtn.BackColor = BackColor.Aqua
        End If

        If str = Qbtn.Text And Qbtn.Enabled = True Then
            Qbtn.Enabled = False
            onkaiNum = 72
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Qbtn.BackColor = BackColor.Aqua
        End If

        If str = S2btn.Text And S2btn.Enabled = True Then
            S2btn.Enabled = False
            onkaiNum = 73
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            S2btn.BackColor = BackColor.Aqua
        End If

        If str = Wbtn.Text And Wbtn.Enabled = True Then
            Wbtn.Enabled = False
            onkaiNum = 74
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Wbtn.BackColor = BackColor.Aqua
        End If

        If str = D3btn.Text And D3btn.Enabled = True Then
            D3btn.Enabled = False
            onkaiNum = 75
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            D3btn.BackColor = BackColor.Aqua
        End If

        If str = Ebtn.Text And Ebtn.Enabled = True Then
            Ebtn.Enabled = False
            onkaiNum = 76
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Ebtn.BackColor = BackColor.Aqua
        End If

        If str = Rbtn.Text And Rbtn.Enabled = True Then
            Rbtn.Enabled = False
            onkaiNum = 77
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Rbtn.BackColor = BackColor.Aqua
        End If

        If str = G5btn.Text And G5btn.Enabled = True Then
            G5btn.Enabled = False
            onkaiNum = 78
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            G5btn.BackColor = BackColor.Aqua
        End If

        If str = Tbtn.Text And Tbtn.Enabled = True Then
            Tbtn.Enabled = False
            onkaiNum = 79
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Tbtn.BackColor = BackColor.Aqua
        End If

        If str = H6btn.Text And H6btn.Enabled = True Then
            H6btn.Enabled = False
            onkaiNum = 80
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            H6btn.BackColor = BackColor.Aqua
        End If

        If str = Ybtn.Text And Ybtn.Enabled = True Then
            Ybtn.Enabled = False
            onkaiNum = 81
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Ybtn.BackColor = BackColor.Aqua
        End If

        If str = J7btn.Text And J7btn.Enabled = True Then
            J7btn.Enabled = False
            onkaiNum = 82
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            J7btn.BackColor = BackColor.Aqua
        End If

        If str = Ubtn.Text And Ubtn.Enabled = True Then
            Ubtn.Enabled = False
            onkaiNum = 83
            Dim dwMsg As Integer = &H90 + 1 + (Decimal.ToInt32(onkaiNum + okuta) * &
;H100) +
100 * &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
            Ubtn.BackColor = BackColor.Aqua
        End If

    End Sub

    Private Sub makefrm_KeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
        Dim onpuWhite(), onpublack() As Button
        Dim i, x As Integer



        'If Zbtn.Enabled = False Then
        '    Dim dwMsg As Integer = &H80 + 1 + (Decimal.ToInt32(60 + okuta) * &H100
) + 100
* &H10000
        '    midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
        '    Zbtn.Enabled = True
        '    Zbtn.BackColor = BackColor.White
        'End If


        'おと消し-全消音11/21.
        For num = 0 To 127
            Dim dwMsg As Integer = &H80 + 1 + (Decimal.ToInt32(num) * &H100) + 100
* &H10000
            midiOutShortMsg(Me.m_hMidiDevice, dwMsg)
        Next

        '鍵盤への処理11/28

        onpuWhite = New Button() {Zbtn, Xbtn, Cbtn, Vbtn, Bbtn, nBtn, Mbtn, Qbtn, Wbtn,
Ebtn, Rbtn, Tbtn, Ybtn, Ubtn}
        onpublack = New Button() {Sbtn, Dbtn, Gbtn, Hbtn, Jbtn, S2btn, D3btn, G5btn, H6btn,

J7btn}

        For i = 0 To 13
            onpuWhite(i).BackColor = BackColor.White
            onpuWhite(i).Enabled = True
        Next

        For x = 0 To 9
            onpublack(x).BackColor = BackColor.Black
            onpublack(x).Enabled = True
        Next


    End Sub

↑様にやるとキーボードを離した瞬間にすべての音が消えてしまいます。
なにか解決法がないでしょうか?  たびたびすみません

[ツリー表示へ]
タイトルRe: VB.NETで特定の音階の音だけをを消すには?
記事No2724
投稿日: 2005/12/09(Fri) 15:07
投稿者というか
卒業研究外注したらどうです?w
それか担当教官にテーマ変更頼んでみるとか。

[ツリー表示へ]
タイトルRe^2: VB.NETで特定の音階の音だけをを消すには?
記事No2725
投稿日: 2005/12/09(Fri) 15:14
投稿者アチョウ
失礼いたしました

[ツリー表示へ]