예제 #1
0
 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);
 }
예제 #2
0
 audio_membuffer(audio_format aud_fmt) : audio_data(0),
                                         aud_info(aud_fmt),
                                         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);
 }
예제 #3
0
 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 );
 
 }
예제 #4
0
        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 );

        
        }
예제 #5
0
 //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()); }
예제 #6
0
 //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()); }
예제 #7
0
 //returns the integer number of seconds
 //that the buffer can record
 unsigned int seconds_recorded( void ) const
 { return bytes_received / aud_info.byte_rate(); }
예제 #8
0
 //returns the integer number of seconds
 //that the buffer can record
 unsigned int seconds_total( void ) const
 { return buf_size / aud_info.byte_rate(); }