Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv2848
Modified Files:
AudioIO.cpp
Log Message:
Fix recording in 24-bit
Index: AudioIO.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- AudioIO.cpp 4 Oct 2006 02:58:10 -0000 1.146
+++ AudioIO.cpp 23 Oct 2006 10:32:40 -0000 1.147
@@ -53,6 +53,7 @@
#include <wx/msgdlg.h>
#include <wx/timer.h>
#include <wx/intl.h>
+#include <wx/debug.h>
#include "AudacityApp.h"
#include "AudioIO.h"
@@ -533,6 +534,12 @@
{
mLastPaError = paNoError;
mRate = GetBestRate(sampleRate);
+
+ // Special case: Our 24-bit sample format is different from PortAudio's
+ // 3-byte packed format. So just make PortAudio return float samples,
+ // since we need float values anyway to apply the gain.
+ if (captureFormat == int24Sample)
+ captureFormat = floatSample;
mNumPlaybackChannels = numPlaybackChannels;
mNumCaptureChannels = numCaptureChannels;
@@ -588,6 +595,7 @@
if( numCaptureChannels > 0)
{
mCaptureFormat = captureFormat;
+
captureParameters = new PaStreamParameters;
const PaDeviceInfo *captureDeviceInfo;
wxString captureDeviceName =
gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
@@ -1933,18 +1941,13 @@
tempFloats[i] =
inputFloats[numCaptureChannels*i+t] * gain;
} break;
- case int24Sample: {
- int *inputInts = (int *)inputBuffer;
- int *tempInts = (int *)tempBuffer;
- for( i = 0; i < len; i++) {
- float tmp = inputInts[numCaptureChannels*i+t] * gain;
- if (tmp > 8388607)
- tmp = 8388607;
- if (tmp < -8388608)
- tmp = -8388608;
- tempInts[i] = (int)(tmp);
- }
- } break;
+ case int24Sample:
+ // We should never get here. Audacity's int24Sample format
+ // is different from PortAudio's sample format and so we
+ // make PortAudio return float samples when recording in
+ // 24-bit samples.
+ wxASSERT(false);
+ break;
case int16Sample: {
short *inputShorts = (short *)inputBuffer;
short *tempShorts = (short *)tempBuffer;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs