• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ audio_format类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中audio_format的典型用法代码示例。如果您正苦于以下问题:C++ audio_format类的具体用法?C++ audio_format怎么用?C++ audio_format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: audio_membuffer

 audio_membuffer(audio_format aud_fmt, float seconds) : audio_data(0),
                                                        aud_info(aud_fmt),
                                                        buf_size(0),
                                                        init_size(0)
 {
     /* Allocs memory for audio recording the specified number of seconds */
     init_size = (unsigned int)((float)aud_info.byte_rate() * seconds <= 0 ? 1 : seconds);
     alloc_mem_(init_size);
 }
开发者ID:GYGit,项目名称:reactos,代码行数:9,代码来源:audio_membuffer.hpp


示例2: create_buffer

		// directsound_audio_stream::create_buffer()
		void directsound_audio_stream::create_buffer(directsound_instance& instance, audio_format const& format) {
			WAVEFORMATEX waveFormat;
			waveFormat.wFormatTag = WAVE_FORMAT_PCM;
			waveFormat.nChannels = format.channels();
			waveFormat.nSamplesPerSec = format.frequency();
			waveFormat.nAvgBytesPerSec = format.bytes_per_second();
			waveFormat.nBlockAlign = static_cast<WORD>(format.bytes_per_frame());
			waveFormat.wBitsPerSample = format.bits_per_sample();
			waveFormat.cbSize = 0;

			DSBUFFERDESC bufferDesc;
			bufferDesc.dwSize = sizeof(DSBUFFERDESC);
			bufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2;
			bufferDesc.dwReserved = 0;
			bufferDesc.dwBufferBytes = static_cast<DWORD>( BufferSize_seconds.count() * format.bytes_per_second() );
			bufferDesc.guid3DAlgorithm = DS3DALG_DEFAULT;
			bufferDesc.lpwfxFormat = &waveFormat;
			LPDIRECTSOUNDBUFFER ptr = nullptr;
			if( FAILED(instance.ptr()->CreateSoundBuffer(&bufferDesc, &ptr, nullptr)) ) {
				throw directsound_exception{};
			}
			ptr->SetFormat(&waveFormat);
			_buffer = buffer_ptr{ ptr };

			clear_entire_buffer();
			_state = audio_stream_state::ready;
		}
开发者ID:fr00b0,项目名称:chirp,代码行数:28,代码来源:directsound_backend.cpp


示例3: audio_membuffer

 audio_membuffer( audio_format aud_fmt, unsigned int seconds )
     : audio_data( 0 ), aud_info( aud_fmt ), buf_size( 0 ),
     init_size( 0 )
 {  
     
     //
     // Allocs memory for audio recording
     // the specified number of seconds.
     //
     init_size = aud_info.byte_rate() * seconds;
     alloc_mem_( init_size );
 
 }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:13,代码来源:audio_membuffer.hpp


示例4: samplevalue_max

        unsigned int samplevalue_max( void )
        {

            if ( aud_info.bits() == 16 )
                return (unsigned int )65535;

            else if ( aud_info.bits() == 8 )
                return (unsigned int)255;

            else 
                return 0;
        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:12,代码来源:audio_wavein.hpp


示例5: samples_received

        unsigned int samples_received( void ) const
        {


            return ( aud_info.samples_in_bytes( bytes_received ));

        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:7,代码来源:audio_membuffer.hpp


示例6: tot_samples_buf

        unsigned tot_samples_buf( void )
        {


            return aud_info.samples_in_bytes( mb_size );


        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:8,代码来源:audio_wavein.hpp


示例7: nsample

        unsigned int nsample ( unsigned int nsamp )
        {


            unsigned int svalue;



            if ( aud_info.bits() == 16 )
                svalue = ( unsigned int )  abs( *(( short * ) (main_buffer + aud_info.bytes_in_samples( nsamp ))));
            else if ( aud_info.bits() == 8 )
               svalue = (unsigned int)(( ptrdiff_t ) *(main_buffer + aud_info.bytes_in_samples( nsamp )));

            else 
                svalue = 0;

            return svalue;

        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:19,代码来源:audio_wavein.hpp


示例8:

        audio_membuffer( void )
            : audio_data( 0 ), aud_info( _AUDIO_DEFAULT_FORMAT ),
            buf_size( 0 ), init_size( 0 )
        {  
            
            //
            // Allocs memory for at least 1 or some seconds
            // of recording.
            //
            init_size = ( unsigned int )
                (( float )aud_info.byte_rate() * _AUDIO_DEFAULT_BUFSECS );


            alloc_mem_( init_size );

        
        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:17,代码来源:audio_membuffer.hpp


示例9: total_samples

        unsigned int total_samples( void ) const
        {

            return ( aud_info.samples_in_seconds( fseconds_total() ));

        }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:6,代码来源:audio_membuffer.hpp


示例10: fseconds_recorded

 //returns the float number of seconds
 //that has been recorded
 float fseconds_recorded( void ) const
 { return ( float )(( float ) bytes_received / 
                 ( float ) aud_info.byte_rate()); }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:5,代码来源:audio_membuffer.hpp


示例11: fseconds_total

 //returns the float number of seconds
 //that the buffer can record
 float fseconds_total( void ) const
 { return ( float )(( float ) buf_size / 
                 ( float ) aud_info.byte_rate()); }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:5,代码来源:audio_membuffer.hpp


示例12: seconds_recorded

 //returns the integer number of seconds
 //that the buffer can record
 unsigned int seconds_recorded( void ) const
 { return bytes_received / aud_info.byte_rate(); }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:4,代码来源:audio_membuffer.hpp


示例13: seconds_total

 //returns the integer number of seconds
 //that the buffer can record
 unsigned int seconds_total( void ) const
 { return buf_size / aud_info.byte_rate(); }
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:4,代码来源:audio_membuffer.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ auto_ptr类代码示例发布时间:2022-05-31
下一篇:
C++ attribute类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap