Click here to Skip to main content
16,004,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
void CDemoDlg::OnNoteOn(CPianoCtrl &PianoCtrl, unsigned char NoteId)
{
    midi::CShortMsg ShortMsg(midi::NOTE_ON, 0, NoteId, 127, 0);
    ShortMsg.SendMsg(m_OutDevice);/* How to store this ShortMsg in another variable what should be the type of variable*/

   

}


VB
namespace midi{
.........
class CShortMsg : public CMIDIMsg
{......
 void SendMsg(midi::CMIDIOutDevice &OutDevice);
.......
}



How to store this ShortMsg in another variable what should be the type of variable?
Is it possible to store the message that we are sending to m_OutDevice?
Posted
Updated 21-Jan-12 0:10am
v5

You already have it in a variable: ShortMsg, which is a variable of the class midi::CShortMsg. Perhaps you could try rephrasing your question.
 
Share this answer
 
Comments
chaiein 21-Jan-12 4:53am    
struct Records
{

midi::CShortMsg Message;/* this is causing error */
.......

};

when ever
the below code is executed
midi::CShortMsg ShortMsg(midi::NOTE_ON, 0, NoteId, 127, 0);
ShortMsg.SendMsg(m_OutDevice);
i need to store the message in another variable that is in the structure Record.
Richard MacCutchan 21-Jan-12 5:31am    
I don't understand; how can this code ever work if CShortMsg is not a class member? Where have you copied this code from, or is midi some class that you have developed yourself?
chaiein 21-Jan-12 5:24am    
I can store that message so that i can get the same sound again.
If i am wrong please correct me.
Richard MacCutchan 21-Jan-12 5:33am    
Now you have changed the information I just responded to. I still don't understand your problem. Please edit the original question and show the exact code that you have a problem with and explain what the problem is.
chaiein 21-Jan-12 5:39am    
what type of variable should i declare for storing the message that is in below code.

midi::CShortMsg ShortMsg(midi::NOTE_ON, 0, NoteId, 127, 0);
ShortMsg.SendMsg(m_OutDevice);

I am getting errors if i create a variable of type midi::CShortMsg;
midi::CShortMsg doesn't have a default constructor. So in your struct you'll need to initialize it.

C++
struct Records 
{ 
    midi::CShortMsg Message;

public:
   Records(void);
   Records(unsigned char Command, unsigned char Channel,
            unsigned char Data1, unsigned char Data2, DWORD TimeStamp);
}; 

inline Records::Records(void)
: Message(midi::NOTE_ON, 0, NoteId, 127, 0)
{
}

inline Records::Records(unsigned char Command, unsigned char Channel,
            unsigned char Data1, unsigned char Data2, 
            DWORD TimeStamp)
: Message(Command, Channel, Data1, Data2, TimeStamp)
{
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900