本文整理汇总了C++中IDeckLinkOutput::ScheduleAudioSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ IDeckLinkOutput::ScheduleAudioSamples方法的具体用法?C++ IDeckLinkOutput::ScheduleAudioSamples怎么用?C++ IDeckLinkOutput::ScheduleAudioSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDeckLinkOutput
的用法示例。
在下文中一共展示了IDeckLinkOutput::ScheduleAudioSamples方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: try_finish_current_audio_packet
/*
* Try sending some audio data to the Decklink.
* Call only with current_audio_pkt != NULL.
* Will set current_audio_pkt to NULL and delete the packet
* if it is fully consumed.
* Return number of samples consumed.
*/
int try_finish_current_audio_packet( ) {
uint32_t n_consumed;
uint32_t n_left;
uint32_t buffer;
deckLinkOutput->GetBufferedAudioSampleFrameCount(&buffer);
fprintf(stderr, "audio buffer = %u ", buffer);
assert(current_audio_pkt != NULL);
n_left = current_audio_pkt->n_frames( )
- samples_written_from_current_audio_pkt;
if (n_left == 0) {
fprintf(stderr, "Audio warning: This should not happen!\n");
return 1;
}
if (deckLinkOutput->ScheduleAudioSamples(
current_audio_pkt->sample(
samples_written_from_current_audio_pkt
), n_left, 0, 0, &n_consumed) != S_OK) {
throw std::runtime_error(
"Failed to schedule audio samples"
);
}
if (n_consumed == n_left) {
delete current_audio_pkt;
current_audio_pkt = NULL;
} else if (n_consumed < n_left) {
samples_written_from_current_audio_pkt += n_consumed;
} else {
throw std::runtime_error("This should not happen");
}
deckLinkOutput->GetBufferedAudioSampleFrameCount(&buffer);
fprintf(stderr, "-> %u\n", buffer);
return n_consumed;
}
示例2: RenderAudioSamples
virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( bool preroll )
{
// Provide more audio samples to the DeckLink API
HRESULT result = S_OK;
uint32_t count = m_fifo->used / m_channels;
uint32_t buffered = count;
if ( count
// Stay under preferred buffer level
&& ( S_OK == m_deckLinkOutput->GetBufferedAudioSampleFrameCount( &buffered ) )
&& buffered < m_maxAudioBuffer )
{
uint32_t written = 0;
buffered = m_maxAudioBuffer - buffered;
count = buffered > count ? count : buffered;
result = m_deckLinkOutput->ScheduleAudioSamples( m_fifo->buffer, count, 0, 0, &written );
if ( written )
sample_fifo_remove( m_fifo, written * m_channels );
}
return result;
}