本文整理汇总了C++中Blip_Buffer::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Blip_Buffer::clear方法的具体用法?C++ Blip_Buffer::clear怎么用?C++ Blip_Buffer::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blip_Buffer
的用法示例。
在下文中一共展示了Blip_Buffer::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
long sample_rate = 44100;
// Sample rate sets how many samples are generated per second
if ( buf.set_sample_rate( sample_rate ) )
return 1; // out of memory
buf.bass_freq( 0 ); // keep waveforms perfectly flat
// Setup synth
synth.output( &buf );
synth.volume( 0.50 );
while ( !button_pressed() )
{
// Mouse sets clock rate, higher to the right. The higher the clock
// rate, the more packed the waveform becomes.
long rate = sample_rate * (mouse_x() * 10 + 1);
// Clock rate sets how many time units there are per second
buf.clock_rate( rate );
// Generate random waveform, with each transition spaced 50 clocks apart.
srand( 1 );
buf.clear();
for ( int time = 0; time < 500; time += 50 )
synth.update( time, rand() % 20 - 10 );
buf.end_frame( 600 );
show_buffer_unscaled( buf );
}
return 0;
}