@@ -448,7 +448,7 @@ float RecordNode::getFreeSpace() const
448448
449449void RecordNode::handleEvent (const EventChannel* eventInfo, const MidiMessage& event, int samplePosition)
450450{
451- if (true )
451+ if (isRecording )
452452 {
453453
454454 if ((*(event.getRawData ()+0 ) & 0x80 ) == 0 ) // saving flag > 0 (i.e., event has not already been processed)
@@ -476,6 +476,8 @@ void RecordNode::process(AudioSampleBuffer& buffer)
476476 // FIRST: cycle through events -- extract the TTLs and the timestamps
477477 checkForEvents ();
478478
479+ bool noEmptyBuffers = true ;
480+
479481 if (isRecording)
480482 {
481483 // SECOND: write channel data
@@ -484,20 +486,33 @@ void RecordNode::process(AudioSampleBuffer& buffer)
484486 {
485487 int realChan = channelMap[chan];
486488 int nSamples = getNumSamples (realChan);
487- int timestamp = getTimestamp (realChan);
488- m_dataQueue->writeChannel (buffer, chan, realChan, nSamples, timestamp);
489+
490+ if (nSamples == 0 )
491+ noEmptyBuffers = false ;
489492 }
490493
491- // std::cout << nSamples << " " << samplesWritten << " " << blockIndex << std::endl;
492- if (!setFirstBlock)
494+ if (noEmptyBuffers || setFirstBlock)
493495 {
494- m_recordThread->setFirstBlockFlag (true );
495- setFirstBlock = true ;
496+ for (int chan = 0 ; chan < recordChans; ++chan)
497+ {
498+ int realChan = channelMap[chan];
499+ int nSamples = getNumSamples (realChan);
500+ int timestamp = getTimestamp (realChan);
501+ m_dataQueue->writeChannel (buffer, chan, realChan, nSamples, timestamp);
502+ }
503+ if (!setFirstBlock)
504+ {
505+
506+ m_recordThread->setFirstBlockFlag (true );
507+ setFirstBlock = true ;
508+ }
496509 }
510+
511+ // std::cout << nSamples << " " << samplesWritten << " " << blockIndex << std::endl;
512+
497513
498514 }
499515
500-
501516}
502517
503518void RecordNode::registerProcessor (const GenericProcessor* sourceNode)
0 commit comments