当前位置: 首页>>代码示例>>C++>>正文


C++ MidiMessage::isSongPositionPointer方法代码示例

本文整理汇总了C++中MidiMessage::isSongPositionPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::isSongPositionPointer方法的具体用法?C++ MidiMessage::isSongPositionPointer怎么用?C++ MidiMessage::isSongPositionPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MidiMessage的用法示例。


在下文中一共展示了MidiMessage::isSongPositionPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processBlock

void MetronomeProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
    const int numSamples = buffer.getNumSamples();
    int channel;

	// convert special metronome bip and bop (0xf2 00 and 0xf2 01) into note on/off messages

	MidiBuffer metronomeMidiBuffer;
	MidiBuffer::Iterator iter(midiMessages);
	MidiMessage message;
	int pos;
	while (iter.getNextEvent(message,pos))
	{
		if (message.getRawDataSize()==2 && message.isSongPositionPointer())
		{
			char raw[4] = {0,0,0,0};

			char* data = (char*)message.getRawData();
			if (data[1]==0)
			{
				// bip
				MidiMessage b = MidiMessage::noteOn(1,80,64.0f);
				memcpy(raw,b.getRawData(),4);
			}
			else
			{
				// bop
				MidiMessage b = MidiMessage::noteOn(1,70,64.0f);
				memcpy(raw,b.getRawData(),4);
			}

			if (raw[0])
			{
				MidiMessage m(raw[0],raw[1],raw[2]);
				//printf("m %d %d %d at %d\n",m.getRawData()[0],m.getRawData()[1],m.getRawData()[2],pos);

				metronomeMidiBuffer.addEvent(m,pos);
			}
		}
	}

    // and now get the synth to process these midi events and generate its output.
    synth.renderNextBlock (buffer, metronomeMidiBuffer, 0, numSamples);
}
开发者ID:eriser,项目名称:rejuce,代码行数:44,代码来源:MetronomeProcessor.cpp

示例2: timerCallback


//.........这里部分代码省略.........
                midiLine += ") = ";
                midiLine += String (msg.getControllerValue());
           }
            else if (msg.isTimeSignatureMetaEvent ())
            {
                int newNumerator, newDenominator;
                msg.getTimeSignatureInfo (newNumerator, newDenominator);

                midiLine += "TIME SIGNATURE: ";
                midiLine += String (newNumerator);
                midiLine += " / ";
                midiLine += String (newDenominator);
            }
            else if (msg.isTempoMetaEvent ())
            {
                midiLine += "TEMPO: ";
                midiLine += String (msg.getTempoSecondsPerQuarterNote ());
                //midiLine += " ";
                //midiLine += String (msg.getTempoMetaEventTickLength (ticksPerQuarterNote));
            }
            else if (msg.isMidiMachineControlMessage())
            {
                midiLine += "MIDI CONTROL: ";
                
                switch (msg.getMidiMachineControlCommand())
                {
                    case MidiMessage::mmc_stop:             midiLine += "stop"; break;
                    case MidiMessage::mmc_play:             midiLine += "play"; break;
                    case MidiMessage::mmc_deferredplay:     midiLine += "deferredplay"; break;
                    case MidiMessage::mmc_fastforward:      midiLine += "fastforward"; break;
                    case MidiMessage::mmc_rewind:           midiLine += "rewind"; break;
                    case MidiMessage::mmc_recordStart:      midiLine += "recordStart"; break;
                    case MidiMessage::mmc_recordStop:       midiLine += "recordStop"; break;
                    case MidiMessage::mmc_pause:            midiLine += "pause"; break;
                }
            }
            else if (msg.isMidiStart ())
            {
                midiLine += "MIDI START: ";
            }
            else if (msg.isMidiContinue ())
            {
                midiLine += "MIDI CONTINUE: ";
            }
            else if (msg.isMidiStop ())
            {
                midiLine += "MIDI STOP: ";
            }
            else if (msg.isSongPositionPointer ())
            {
                midiLine += "SONG POSITION: ";
                midiLine += String (msg.getSongPositionPointerMidiBeat ());
            }
            else if (msg.isQuarterFrame ())
            {
                midiLine += "QUARTER FRAME: ";
                midiLine += String (msg.getQuarterFrameSequenceNumber ());
                midiLine += " ";
                midiLine += String (msg.getQuarterFrameValue ());
            }
            else if (msg.isFullFrame ())
            {
                midiLine += "FULL FRAME: ";

                msg.getFullFrameParameters (hours, minutes, seconds, frames, timeCode);

                midiLine += String (hours);
                midiLine += ":";
                midiLine += String (minutes);
                midiLine += ":";
                midiLine += String (seconds);
                midiLine += ":";
                midiLine += String (frames);

                midiLine += " timecode: ";
                switch (timeCode) {
                    case MidiMessage::fps24:      midiLine += "fps24"; break;
                    case MidiMessage::fps25:      midiLine += "fps25"; break;
                    case MidiMessage::fps30drop:  midiLine += "fps30drop"; break;
                    case MidiMessage::fps30:      midiLine += "fps30"; break;
                }
            }
            else if (msg.isMidiMachineControlGoto (hours, minutes, seconds, frames))
            {
                midiLine += "MIDI CONTROL GOTO: ";
                midiLine += String (hours);
                midiLine += ":";
                midiLine += String (minutes);
                midiLine += ":";
                midiLine += String (seconds);
                midiLine += ":";
                midiLine += String (frames);
            }

            midiOutputEditor->insertTextAtCursor (midiLine + T("\n"));
        }

	}

}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:101,代码来源:MidiMonitorEditor.cpp


注:本文中的MidiMessage::isSongPositionPointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。