Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv15539

Modified Files:
        AudioIO.cpp AudioIO.h 
Log Message:
A rather naive approach to selecting the best device sampling rate.

Index: AudioIO.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- AudioIO.cpp 23 Sep 2006 02:28:03 -0000      1.145
+++ AudioIO.cpp 4 Oct 2006 02:58:10 -0000       1.146
@@ -532,7 +532,7 @@
                                    sampleFormat captureFormat)
 {
    mLastPaError = paNoError;
-   mRate = sampleRate;
+   mRate = GetBestRate(sampleRate);
 
    mNumPlaybackChannels = numPlaybackChannels;
    mNumCaptureChannels = numCaptureChannels;
@@ -1461,6 +1461,17 @@
    return rates[rates.GetCount() - 1];
 }
 
+long AudioIO::GetBestRate(double sampleRate)
+{
+   wxArrayLong rates = GetSupportedSampleRates();
+   long rate = (long)sampleRate;
+   
+   if (rates.Index(rate) != wxNOT_FOUND) {
+      return rate;
+   }
+
+   return rates[rates.GetCount() - 1];
+}      
 
 
 //////////////////////////////////////////////////////////////////////

Index: AudioIO.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- AudioIO.h   24 Jul 2006 14:58:56 -0000      1.45
+++ AudioIO.h   4 Oct 2006 02:58:10 -0000       1.46
@@ -151,6 +151,7 @@
    int GetNumCaptureChannels() { return mNumCaptureChannels; }
 
 private:
+   long GetBestRate(double sampleRate);
 
    bool StartPortAudioStream(double sampleRate,
                              unsigned int numPlaybackChannels,


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to