Date: Tue, 05 Mar 2013 16:13:00 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: "Joseph A. Nagy, Jr" <jnagyjr1978@gmail.com> Cc: "Ports @ FreeBSD" <freebsd-ports@freebsd.org>, xxjack12xx@gmail.com Subject: Re: audio/audacity still does not compile due to issues with soundtouch Message-ID: <51360B7C.5070707@FreeBSD.org> In-Reply-To: <5135DF07.7070807@gmail.com> References: <5135779D.1000100@gmail.com> <51357D48.9040308@gmail.com> <5135DE27.9050508@FreeBSD.org> <5135DF07.7070807@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------000209080703030805060409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2013-03-05 13:03, Joseph A. Nagy, Jr wrote: > On 03/05/13 05:59, Dimitry Andric wrote: >> On 2013-03-05 06:06, Joseph A. Nagy, Jr wrote: >>> On 03/04/13 22:42, Joseph A. Nagy, Jr wrote: >>>> I am still having issues with Audacity trying to compile in soundtouch >>>> plugins. Is this an issue with the port (there is no config option to >>>> disable this behavior) or is it an upstream issue? >>> >>> Full error messages follow: >>> effects/SoundTouchEffect.cpp:209:31: error: cannot initialize a >>> parameter of type 'const SAMPLETYPE *' >>> (aka 'const short *') with an lvalue of type 'float *' >>> mSoundTouch->putSamples(buffer, block); >>> ^~~~~~ >>> /usr/local/include/soundtouch/SoundTouch.h:237:31: note: passing >>> argument to parameter 'samples' here >>> const SAMPLETYPE *samples, ///< Pointer to sample buffer. >>> ^ >> >> It looks like you have configured the Soundtouch port with the >> INTEGER_SAMPLES option. In that case, Soundtouch defines SAMPLETYPE to >> short, and apparently Audacity is hardcoded to expect float samples >> instead. >> >> Maybe this should be reported to Audacity, but I can imagine they would >> say "Soundtouch must be configured with float samples". :-) > > I will report it to Audacity, right after I rebuild soundtouch w/o > integer samples selected as an option. Joseph, can you please try out the attached diff for Audacity? I have attempted to fix the assumption that samples are always in float format, and Audacity now compiles and links, even if Soundtouch is configured with the INTEGER_SAMPLES options. However, I cannot currently test if this still properly works at runtime. Maybe you are able to run this on a test setup, and check if the Soundtouch effects seem to work as expected. --------------000209080703030805060409 Content-Type: text/x-diff; name="audio__audacity-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="audio__audacity-1.diff" Index: audio/audacity/files/patch-src__effects__SoundTouchEffect.cpp =================================================================== --- audio/audacity/files/patch-src__effects__SoundTouchEffect.cpp (revision 0) +++ audio/audacity/files/patch-src__effects__SoundTouchEffect.cpp (working copy) @@ -0,0 +1,107 @@ +--- src/effects/SoundTouchEffect.cpp.orig 2013-01-18 16:50:47.000000000 +0100 ++++ src/effects/SoundTouchEffect.cpp 2013-03-05 15:33:53.000000000 +0100 +@@ -24,6 +24,12 @@ effect that uses SoundTouch to do its pr + #include "TimeWarper.h" + #include "../NoteTrack.h" + ++#ifdef SOUNDTOUCH_FLOAT_SAMPLES ++#define soundtouchSample floatSample ++#else ++#define soundtouchSample int16Sample ++#endif ++ + bool EffectSoundTouch::ProcessLabelTrack(Track *track) + { + // SetTimeWarper(new RegionTimeWarper(mCurT0, mCurT1, +@@ -189,7 +195,7 @@ bool EffectSoundTouch::ProcessOne(WaveTr + + //Initiate a processing buffer. This buffer will (most likely) + //be shorter than the length of the track being processed. +- float *buffer = new float[track->GetMaxBlockSize()]; ++ SAMPLETYPE *buffer = new SAMPLETYPE[track->GetMaxBlockSize()]; + + //Go through the track one buffer at a time. s counts which + //sample the current buffer starts at. +@@ -203,7 +209,7 @@ bool EffectSoundTouch::ProcessOne(WaveTr + block = end - s; + + //Get the samples from the track and put them in the buffer +- track->Get((samplePtr) buffer, floatSample, s, block); ++ track->Get((samplePtr) buffer, soundtouchSample, s, block); + + //Add samples to SoundTouch + mSoundTouch->putSamples(buffer, block); +@@ -211,9 +217,9 @@ bool EffectSoundTouch::ProcessOne(WaveTr + //Get back samples from SoundTouch + unsigned int outputCount = mSoundTouch->numSamples(); + if (outputCount > 0) { +- float *buffer2 = new float[outputCount]; ++ SAMPLETYPE *buffer2 = new SAMPLETYPE[outputCount]; + mSoundTouch->receiveSamples(buffer2, outputCount); +- outputTrack->Append((samplePtr)buffer2, floatSample, outputCount); ++ outputTrack->Append((samplePtr)buffer2, soundtouchSample, outputCount); + delete[] buffer2; + } + +@@ -230,9 +236,9 @@ bool EffectSoundTouch::ProcessOne(WaveTr + + unsigned int outputCount = mSoundTouch->numSamples(); + if (outputCount > 0) { +- float *buffer2 = new float[outputCount]; ++ SAMPLETYPE *buffer2 = new SAMPLETYPE[outputCount]; + mSoundTouch->receiveSamples(buffer2, outputCount); +- outputTrack->Append((samplePtr)buffer2, floatSample, outputCount); ++ outputTrack->Append((samplePtr)buffer2, soundtouchSample, outputCount); + delete[] buffer2; + } + +@@ -277,9 +283,9 @@ bool EffectSoundTouch::ProcessStereo(Wav + // because Soundtouch wants them interleaved, i.e., each + // Soundtouch sample is left-right pair. + sampleCount maxBlockSize = leftTrack->GetMaxBlockSize(); +- float* leftBuffer = new float[maxBlockSize]; +- float* rightBuffer = new float[maxBlockSize]; +- float* soundTouchBuffer = new float[maxBlockSize * 2]; ++ SAMPLETYPE* leftBuffer = new SAMPLETYPE[maxBlockSize]; ++ SAMPLETYPE* rightBuffer = new SAMPLETYPE[maxBlockSize]; ++ SAMPLETYPE* soundTouchBuffer = new SAMPLETYPE[maxBlockSize * 2]; + + // Go through the track one stereo buffer at a time. + // sourceSampleCount counts the sample at which the current buffer starts, +@@ -294,8 +300,8 @@ bool EffectSoundTouch::ProcessStereo(Wav + blockSize = end - sourceSampleCount; + + // Get the samples from the tracks and put them in the buffers. +- leftTrack->Get((samplePtr)(leftBuffer), floatSample, sourceSampleCount, blockSize); +- rightTrack->Get((samplePtr)(rightBuffer), floatSample, sourceSampleCount, blockSize); ++ leftTrack->Get((samplePtr)(leftBuffer), soundtouchSample, sourceSampleCount, blockSize); ++ rightTrack->Get((samplePtr)(rightBuffer), soundtouchSample, sourceSampleCount, blockSize); + + // Interleave into soundTouchBuffer. + for (int index = 0; index < blockSize; index++) { +@@ -369,20 +375,20 @@ bool EffectSoundTouch::ProcessStereoResu + WaveTrack* outputLeftTrack, + WaveTrack* outputRightTrack) + { +- float* outputSoundTouchBuffer = new float[outputCount*2]; ++ SAMPLETYPE* outputSoundTouchBuffer = new SAMPLETYPE[outputCount*2]; + mSoundTouch->receiveSamples(outputSoundTouchBuffer, outputCount); + + // Dis-interleave outputSoundTouchBuffer into separate track buffers. +- float* outputLeftBuffer = new float[outputCount]; +- float* outputRightBuffer = new float[outputCount]; ++ SAMPLETYPE* outputLeftBuffer = new SAMPLETYPE[outputCount]; ++ SAMPLETYPE* outputRightBuffer = new SAMPLETYPE[outputCount]; + for (unsigned int index = 0; index < outputCount; index++) + { + outputLeftBuffer[index] = outputSoundTouchBuffer[index*2]; + outputRightBuffer[index] = outputSoundTouchBuffer[(index*2)+1]; + } + +- outputLeftTrack->Append((samplePtr)outputLeftBuffer, floatSample, outputCount); +- outputRightTrack->Append((samplePtr)outputRightBuffer, floatSample, outputCount); ++ outputLeftTrack->Append((samplePtr)outputLeftBuffer, soundtouchSample, outputCount); ++ outputRightTrack->Append((samplePtr)outputRightBuffer, soundtouchSample, outputCount); + + delete[] outputSoundTouchBuffer; + delete[] outputLeftBuffer; --------------000209080703030805060409--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51360B7C.5070707>