Permalink
Browse files

Changed default sampling rate from 48000 to 44100

  • Loading branch information...
1 parent 04fe918 commit 868a3b17ca03df76930321f32df6323fef20cd47 @wedesoft committed Nov 14, 2010
Showing with 11 additions and 14 deletions.
  1. +7 −10 ext/alsainput.cc
  2. +1 −1 ext/alsainput.hh
  3. +1 −1 ext/alsaoutput.hh
  4. +1 −1 lib/hornetseye-alsa/alsainput.rb
  5. +1 −1 lib/hornetseye-alsa/alsaoutput.rb
View
17 ext/alsainput.cc
@@ -83,20 +83,17 @@ SequencePtr AlsaInput::read( int samples ) throw (Error)
ERRORMACRO( m_pcmHandle != NULL, Error, , "PCM device \"" << m_pcmName
<< "\" is not open. Did you call \"close\" before?" );
int n = samples * 2 * m_channels;
-#if 0
- int n = frame->size() / ( 2 * m_channels );
+ SequencePtr frame( new Sequence( n ) );
int err;
- while ( ( err = snd_pcm_writei( m_pcmHandle, (short int *)frame->data(),
- n ) ) < 0 ) {
+ while ( ( err = snd_pcm_readi( m_pcmHandle, (short int *)frame->data(),
+ n ) ) < 0 ) {
err = snd_pcm_recover( m_pcmHandle, err, 1 );
- ERRORMACRO( err >= 0, Error, , "Error writing audio frames to PCM device \""
+ ERRORMACRO( err >= 0, Error, , "Error reading audio frames from PCM device \""
<< m_pcmName << "\": " << snd_strerror( err ) );
};
- ERRORMACRO( n == err, Error, , "Only managed to write " << err << " of " << n
- << " frames to PCM device \"" << m_pcmName << "\"" );
-#endif
- SequencePtr sequence( new Sequence( n ) );
- return sequence;
+ ERRORMACRO( n == err, Error, , "Only managed to read " << err << " of " << n
+ << " frames from PCM device \"" << m_pcmName << "\"" );
+ return frame;
}
unsigned int AlsaInput::rate(void)
View
2 ext/alsainput.hh
@@ -26,7 +26,7 @@ class AlsaInput
{
public:
AlsaInput( const std::string &pcmName = "default:0",
- unsigned int rate = 48000, unsigned int channels = 2,
+ unsigned int rate = 44100, unsigned int channels = 2,
int periods = 16, snd_pcm_uframes_t frames = 1024 ) throw (Error);
virtual ~AlsaInput(void);
void close(void);
View
2 ext/alsaoutput.hh
@@ -26,7 +26,7 @@ class AlsaOutput
{
public:
AlsaOutput( const std::string &pcmName = "default:0",
- unsigned int rate = 48000, unsigned int channels = 2,
+ unsigned int rate = 44100, unsigned int channels = 2,
int periods = 16, snd_pcm_uframes_t frames = 1024 ) throw (Error);
virtual ~AlsaOutput(void);
void close(void);
View
2 lib/hornetseye-alsa/alsainput.rb
@@ -23,7 +23,7 @@ class << self
alias_method :orig_new, :new
- def new( pcm_name = 'default:0', rate = 48000, channels = 2, periods = 16,
+ def new( pcm_name = 'default:0', rate = 44100, channels = 2, periods = 16,
frames = 1024 )
orig_new pcm_name, rate, channels, periods, frames
end
View
2 lib/hornetseye-alsa/alsaoutput.rb
@@ -23,7 +23,7 @@ class << self
alias_method :orig_new, :new
- def new( pcm_name = 'default:0', rate = 48000, channels = 2, periods = 16,
+ def new( pcm_name = 'default:0', rate = 44100, channels = 2, periods = 16,
frames = 1024 )
orig_new pcm_name, rate, channels, periods, frames
end

0 comments on commit 868a3b1

Please sign in to comment.