本文整理汇总了C++中MidiMessage::isTextMetaEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::isTextMetaEvent方法的具体用法?C++ MidiMessage::isTextMetaEvent怎么用?C++ MidiMessage::isTextMetaEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::isTextMetaEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
std::map<std::string, double> key_position;
time_scale_changed = false;
gcode.clear();
heeks.clear();
key_position.clear();
std::ostringstream l_ossGCode;
for (int track = 0; track<midi_file.getNumTracks(); track++)
{
int number_of_notes_included = 0;
int number_of_notes_ignored = 0;
const MidiMessageSequence *pMessageSequence = midi_file.getTrack(track);
double start_time = pMessageSequence->getStartTime();
double end_time = pMessageSequence->getEndTime();
double duration = end_time - start_time;
if (duration <= 0.0001) continue;
l_ossGCode.str("");
l_ossGCode << "(Duration of track " << track << " is " << duration << " seconds)";
gcode.push_back( l_ossGCode.str() );
printf("%s\n", l_ossGCode.str().c_str());
// printf("Duration of track %d is %lf seconds\n", track, duration);
for (int event = 0; event < pMessageSequence->getNumEvents(); event++)
{
MidiMessageSequence::MidiEventHolder *pEvent = pMessageSequence->getEventPointer(event);
MidiMessage message = pEvent->message;
double time_stamp = message.getTimeStamp();
if (message.isTextMetaEvent())
{
String text = message.getTextFromTextMetaEvent();
char buf[1024];
memset( buf, '\0', sizeof(buf) );
text.copyToBuffer( buf, sizeof(buf)-1 );
// printf("Track %d is %s\n", track, buf );
l_ossGCode.str("");
l_ossGCode << "(Text track " << track << " is " << buf << ")";
gcode.push_back(l_ossGCode.str());
printf("%s\n", l_ossGCode.str().c_str());
std::ostringstream l_ossHeeks;
l_ossHeeks << "<Text text=\"" << buf << "\" font=\"OpenGL\" col=\"0\" m0=\"-0.0443342566\" m1=\"-0.999016753\" m2=\"0\" m3=\"" << (double) (time_stamp * mm_per_second) << "\" m4=\"0.999016753\" m5=\"-0.0443342566\" m6=\"0\" m7=\"" << (double) ((track_width + space_between_tracks) * track) << "\" m8=\"0\" m9=\"0\" ma=\"1\" mb=\"0\" id=\"" << id++ << "\" />";
heeks.push_back( l_ossHeeks.str() );
}
if (message.isTrackNameEvent())
{
String text = message.getTextFromTextMetaEvent();
char buf[1024];
memset( buf, '\0', sizeof(buf) );
text.copyToBuffer( buf, sizeof(buf)-1 );
printf("Track %d is %s\n", track, buf );
}
if (message.isNoteOn())
{
char note_name[256];
memset( note_name, '\0', sizeof(note_name) );
message.getMidiNoteName(message.getNoteNumber(), true, true, middle_c_octave).copyToBuffer( note_name, sizeof(note_name)-1 );
notes.insert( message.getNoteNumber() );