Files
Work/midiseq/safe/ChannelModeMessage.hpp
2024-08-07 09:16:27 -04:00

59 lines
1.7 KiB
C++

#ifndef _MIDISEQ_CHANNELMODEMESSAGE_HPP_
#define _MIDISEQ_CHANNELMODEMESSAGE_HPP_
#ifndef _MIDISEQ_PUREEVENT_HPP_
#include <midiseq/pureevnt.hpp>
#endif
class ChannelModeMessage
{
public:
typedef enum ChannelMessage{AllNotesOff,LocalControlOff,LocalControlOn,
Modulation,MainVolume,Pan,Expression,Sustain,ResetAllControllers};
ChannelModeMessage(ChannelMessage channelMessage=AllNotesOff);
virtual ~ChannelModeMessage();
PureEvent getEvent(BYTE deltaTime=0,BYTE channel=0,BYTE value=0);
private:
ChannelMessage mChannelMessage;
};
inline
ChannelModeMessage::ChannelModeMessage(ChannelMessage channelMessage)
: mChannelMessage(channelMessage)
{
}
inline
ChannelModeMessage::~ChannelModeMessage()
{
}
inline
PureEvent ChannelModeMessage::getEvent(BYTE deltaTime,BYTE channel,BYTE value)
{
switch(mChannelMessage)
{
case AllNotesOff :
return PureEvent(MIDIParameter,deltaTime,channel,123,0);
case LocalControlOff :
return PureEvent(MIDIParameter,deltaTime,channel,122,0);
case LocalControlOn :
return PureEvent(MIDIParameter,deltaTime,channel,122,127);
case Modulation :
return PureEvent(MIDIParameter,deltaTime,channel,1,value);
case MainVolume :
return PureEvent(MIDIParameter,deltaTime,channel,7,value);
case Pan :
return PureEvent(MIDIParameter,deltaTime,channel,10,value);
case Expression :
return PureEvent(MIDIParameter,deltaTime,channel,11,value);
case Sustain :
return PureEvent(MIDIParameter,deltaTime,channel,64,value);
case ResetAllControllers :
return PureEvent(MIDIParameter,deltaTime,channel,121,0);
default :
return PureEvent(MIDIParameter,deltaTime,channel,123,0); // default is all notes off
}
}
#endif