=== modified file 'mixxx/src/analyserqueue.cpp' --- mixxx/src/analyserqueue.cpp 2013-05-18 16:23:08 +0000 +++ mixxx/src/analyserqueue.cpp 2013-06-01 18:00:18 +0000 @@ -144,7 +144,7 @@ int totalSamples = pSoundSource->length(); //qDebug() << tio->getFilename() << " has " << totalSamples << " samples."; int processedSamples = 0; - + SAMPLE* data16 = new SAMPLE[ANALYSISBLOCKSIZE]; CSAMPLE* samples = new CSAMPLE[ANALYSISBLOCKSIZE]; @@ -158,8 +158,7 @@ do { ScopedTimer t("AnalyserQueue::doAnalysis block"); - read = pSoundSource->read(ANALYSISBLOCKSIZE, data16); - + read = pSoundSource->read(ANALYSISBLOCKSIZE, samples); // To compare apples to apples, let's only look at blocks that are the // full block size. if (read != ANALYSISBLOCKSIZE) { === modified file 'mixxx/src/cachingreader.cpp' --- mixxx/src/cachingreader.cpp 2013-03-31 17:15:07 +0000 +++ mixxx/src/cachingreader.cpp 2013-04-21 19:22:05 +0000 @@ -261,10 +261,12 @@ update->status = CHUNK_READ_EOF; return; } - + + CSAMPLE* buffer = request->chunk->data; + m_pCurrentSoundSource->seek(sample_position); int samples_read = m_pCurrentSoundSource->read(samples_to_read, - m_pSample); + buffer); // If we've run out of music, the SoundSource can return 0 samples. // Remember that SoundSourc->getLength() (which is m_iTrackNumSamples) can @@ -276,9 +278,8 @@ // TODO(XXX) This loop can't be done with a memcpy, but could be done with // SSE. - CSAMPLE* buffer = request->chunk->data; //qDebug() << "Reading into " << buffer; - SampleUtil::convert(buffer, m_pSample, samples_read); + // SampleUtil::convert(buffer, m_pSample, samples_read); update->status = CHUNK_READ_SUCCESS; update->chunk->length = samples_read; } === modified file 'mixxx/src/engine/enginepassthrough.cpp' --- mixxx/src/engine/enginepassthrough.cpp 2013-05-16 00:14:12 +0000 +++ mixxx/src/engine/enginepassthrough.cpp 2013-04-21 18:45:55 +0000 @@ -83,6 +83,7 @@ // There isn't a suitable SampleUtil method that can do mono->stereo and // short->float in one pass. // SampleUtil::convert(m_pConversionBuffer, pBuffer, iNumSamples); + //XXX:yoda we probably don't want to kill this here SampleUtil::convert(m_pConversionBuffer, pBuffer, nFrames*2); // TODO(rryan) (or bkgood?) do we need to verify the input is the one we asked for? Oh well. === modified file 'mixxx/src/musicbrainz/chromaprinter.cpp' --- mixxx/src/musicbrainz/chromaprinter.cpp 2013-05-22 07:40:27 +0000 +++ mixxx/src/musicbrainz/chromaprinter.cpp 2013-06-01 17:45:25 +0000 @@ -38,7 +38,7 @@ m_NumSamples = length; } - SAMPLE *pData = new SAMPLE[m_NumSamples]; + CSAMPLE *pData = new CSAMPLE[m_NumSamples]; QTime timerReadingFile; timerReadingFile.start(); int read = soundSource.read(m_NumSamples, pData); === modified file 'mixxx/src/soundsource.h' --- mixxx/src/soundsource.h 2012-01-07 05:51:04 +0000 +++ mixxx/src/soundsource.h 2013-04-21 19:08:45 +0000 @@ -58,7 +58,7 @@ virtual ~SoundSource(); virtual int open() = 0; virtual long seek(long) = 0; - virtual unsigned read(unsigned long size, const SAMPLE*) = 0; + virtual unsigned read(unsigned long size, const CSAMPLE*) = 0; virtual long unsigned length() = 0; static float str2bpm( QString sBpm ); virtual int parseHeader() = 0; === modified file 'mixxx/src/soundsourcecoreaudio.cpp' --- mixxx/src/soundsourcecoreaudio.cpp 2012-11-20 00:40:18 +0000 +++ mixxx/src/soundsourcecoreaudio.cpp 2013-04-21 19:09:03 +0000 @@ -192,7 +192,7 @@ return filepos; } -unsigned int SoundSourceCoreAudio::read(unsigned long size, const SAMPLE *destination) { +unsigned int SoundSourceCoreAudio::read(unsigned long size, const CSAMPLE *destination) { //if (!m_decoder) return 0; OSStatus err; SAMPLE *destBuffer(const_cast(destination)); === modified file 'mixxx/src/soundsourcecoreaudio.h' --- mixxx/src/soundsourcecoreaudio.h 2011-03-09 21:58:35 +0000 +++ mixxx/src/soundsourcecoreaudio.h 2013-04-21 19:09:01 +0000 @@ -48,7 +48,7 @@ ~SoundSourceCoreAudio(); int open(); long seek(long filepos); - unsigned read(unsigned long size, const SAMPLE *buffer); + unsigned read(unsigned long size, const CSAMPLE *buffer); inline long unsigned length(); int parseHeader(); static QList supportedFileExtensions(); === modified file 'mixxx/src/soundsourceffmpeg.cpp' --- mixxx/src/soundsourceffmpeg.cpp 2009-05-03 02:34:18 +0000 +++ mixxx/src/soundsourceffmpeg.cpp 2013-04-21 19:04:33 +0000 @@ -317,7 +317,7 @@ read samples into , and return the number of samples actually read. */ -unsigned SoundSourceFFmpeg::read(unsigned long size, const SAMPLE * destination) +unsigned SoundSourceFFmpeg::read(unsigned long size, const CSAMPLE * destination) { qDebug() << "This code has a bug! It needs fixing before you use it."; === modified file 'mixxx/src/soundsourceffmpeg.h' --- mixxx/src/soundsourceffmpeg.h 2007-07-16 01:45:38 +0000 +++ mixxx/src/soundsourceffmpeg.h 2013-04-21 19:08:58 +0000 @@ -31,7 +31,7 @@ SoundSourceFFmpeg(QString qFilename); ~SoundSourceFFmpeg(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); inline long unsigned length(); static int ParseHeader(TrackInfoObject * ); bool readInput(); === modified file 'mixxx/src/soundsourceflac.cpp' --- mixxx/src/soundsourceflac.cpp 2012-10-31 16:00:40 +0000 +++ mixxx/src/soundsourceflac.cpp 2013-06-01 18:09:43 +0000 @@ -104,9 +104,9 @@ return filepos; } -unsigned int SoundSourceFLAC::read(unsigned long size, const SAMPLE *destination) { +unsigned int SoundSourceFLAC::read(unsigned long size, const CSAMPLE *destination) { if (!m_decoder) return 0; - SAMPLE *destBuffer(const_cast(destination)); + CSAMPLE *destBuffer(const_cast(destination)); unsigned int samplesWritten = 0; unsigned int i = 0; while (samplesWritten < size) { @@ -182,17 +182,17 @@ /** * Shift a sample from FLAC as necessary to get a 16-bit value. */ -inline FLAC__int16 SoundSourceFLAC::shift(FLAC__int32 sample) const { +inline float SoundSourceFLAC::shift(FLAC__int32 sample) const { // this is how libsndfile does this operation and is wonderfully // straightforward. Just shift the sample left or right so that // it fits in a 16-bit short. -- bkgood int shift(getShift()); if (shift == 0) { - return sample; + return static_cast(sample); } else if (shift < 0) { - return sample >> abs(shift); + return static_cast(sample >> abs(shift)); } else { - return sample << shift; + return static_cast(sample << shift); } }; === modified file 'mixxx/src/soundsourceflac.h' --- mixxx/src/soundsourceflac.h 2012-07-08 07:30:32 +0000 +++ mixxx/src/soundsourceflac.h 2013-06-01 16:37:52 +0000 @@ -32,7 +32,7 @@ ~SoundSourceFLAC(); int open(); long seek(long filepos); - unsigned read(unsigned long size, const SAMPLE *buffer); + unsigned read(unsigned long size, const CSAMPLE *buffer); inline long unsigned length(); int parseHeader(); static QList supportedFileExtensions(); @@ -49,7 +49,7 @@ // these next two are inline but are defined in the cpp file because // they should only be used there -- bkgood inline int getShift() const; - inline FLAC__int16 shift(const FLAC__int32 sample) const; + inline float shift(const FLAC__int32 sample) const; QFile m_file; FLAC__StreamDecoder *m_decoder; FLAC__StreamMetadata_StreamInfo *m_streamInfo; === modified file 'mixxx/src/soundsourcemodplug.cpp' --- mixxx/src/soundsourcemodplug.cpp 2013-03-18 14:01:27 +0000 +++ mixxx/src/soundsourcemodplug.cpp 2013-04-21 19:05:36 +0000 @@ -134,7 +134,7 @@ } unsigned SoundSourceModPlug::read(unsigned long size, - const SAMPLE* pDestination) + const CSAMPLE* pDestination) { unsigned maxLength = m_sampleBuf.length() >> 1; unsigned copySamples = math_min(maxLength - m_seekPos, size); === modified file 'mixxx/src/soundsourcemodplug.h' --- mixxx/src/soundsourcemodplug.h 2013-03-19 14:50:49 +0000 +++ mixxx/src/soundsourcemodplug.h 2013-04-21 19:05:48 +0000 @@ -24,7 +24,7 @@ ~SoundSourceModPlug(); int open(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); inline long unsigned length(); int parseHeader(); static QList supportedFileExtensions(); === modified file 'mixxx/src/soundsourcemp3.cpp' --- mixxx/src/soundsourcemp3.cpp 2013-01-19 12:15:22 +0000 +++ mixxx/src/soundsourcemp3.cpp 2013-06-01 18:03:10 +0000 @@ -430,7 +430,7 @@ read samples into , and return the number of samples actually read. */ -unsigned SoundSourceMp3::read(unsigned long samples_wanted, const SAMPLE * _destination) +unsigned SoundSourceMp3::read(unsigned long samples_wanted, const CSAMPLE * _destination) { if (!isValid()) return 0; @@ -443,7 +443,7 @@ } // qDebug() << "frame list " << m_qSeekList.count(); - SAMPLE * destination = (SAMPLE *)_destination; + CSAMPLE * destination = (CSAMPLE *)_destination; unsigned Total_samples_decoded = 0; int i; @@ -644,16 +644,8 @@ return 0; } } - -inline signed int SoundSourceMp3::madScale(mad_fixed_t sample) +// faster solution , working fine on 64 bit ubuntu with 64 bit mixxx +inline float SoundSourceMp3::madScale(mad_fixed_t sample) { - sample += (1L << (MAD_F_FRACBITS - 16)); - - if (sample >= MAD_F_ONE) - sample = MAD_F_ONE - 1; - else if (sample < -MAD_F_ONE) - sample = -MAD_F_ONE; - - return sample >> (MAD_F_FRACBITS + 1 - 16); + return static_cast(sample) / static_cast(1L << (MAD_F_FRACBITS - 15)); } - === modified file 'mixxx/src/soundsourcemp3.h' --- mixxx/src/soundsourcemp3.h 2011-03-27 01:24:06 +0000 +++ mixxx/src/soundsourcemp3.h 2013-05-16 16:33:28 +0000 @@ -55,7 +55,7 @@ ~SoundSourceMp3(); int open(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); unsigned long discard(unsigned long size); /** Return the length of the file in samples. */ inline long unsigned length(); @@ -67,7 +67,7 @@ * the current element in m_qSeekList */ int findFrame(int pos); /** Scale the mad sample to be in 16 bit range. */ - inline signed int madScale (mad_fixed_t sample); + inline float madScale (mad_fixed_t sample); MadSeekFrameType* getSeekFrame(long frameIndex) const; // Returns true if the loaded file is valid and usable to read audio. === modified file 'mixxx/src/soundsourceoggvorbis.cpp' --- mixxx/src/soundsourceoggvorbis.cpp 2012-09-06 07:15:26 +0000 +++ mixxx/src/soundsourceoggvorbis.cpp 2013-05-26 21:09:57 +0000 @@ -157,15 +157,16 @@ samples actually read. */ -unsigned SoundSourceOggVorbis::read(volatile unsigned long size, const SAMPLE * destination) { +unsigned SoundSourceOggVorbis::read(volatile unsigned long size, const CSAMPLE * destination) { + if (size % 2 != 0) { qDebug() << "SoundSourceOggVorbis got non-even size in read."; size--; } char *pRead = (char*) destination; - SAMPLE *dest = (SAMPLE*) destination; - + //CSAMPLE *dest = (CSAMPLE*) destination; + CSAMPLE *dest(const_cast(destination)); // 'needed' is size of buffer in bytes. 'size' is size in SAMPLEs, === modified file 'mixxx/src/soundsourceoggvorbis.h' --- mixxx/src/soundsourceoggvorbis.h 2011-03-09 21:58:35 +0000 +++ mixxx/src/soundsourceoggvorbis.h 2013-04-21 19:06:59 +0000 @@ -28,7 +28,7 @@ ~SoundSourceOggVorbis(); int open(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); inline long unsigned length(); int parseHeader(); static QList supportedFileExtensions(); === modified file 'mixxx/src/soundsourceproxy.cpp' --- mixxx/src/soundsourceproxy.cpp 2013-04-09 19:14:38 +0000 +++ mixxx/src/soundsourceproxy.cpp 2013-04-21 19:07:13 +0000 @@ -293,7 +293,7 @@ return m_pSoundSource->seek(l); } -unsigned SoundSourceProxy::read(unsigned long size, const SAMPLE * p) +unsigned SoundSourceProxy::read(unsigned long size, const CSAMPLE * p) { if (!m_pSoundSource) { return 0; === modified file 'mixxx/src/soundsourceproxy.h' --- mixxx/src/soundsourceproxy.h 2011-03-27 00:50:47 +0000 +++ mixxx/src/soundsourceproxy.h 2013-04-21 19:06:15 +0000 @@ -46,7 +46,7 @@ static void loadPlugins(); int open(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); long unsigned length(); int parseHeader(); static int ParseHeader(TrackInfoObject* p); === modified file 'mixxx/src/soundsourcesndfile.cpp' --- mixxx/src/soundsourcesndfile.cpp 2012-01-07 07:40:11 +0000 +++ mixxx/src/soundsourcesndfile.cpp 2013-04-21 19:06:26 +0000 @@ -104,7 +104,7 @@ then size/2 samples are read from the mono file, and they are doubled into stereo. */ -unsigned SoundSourceSndFile::read(unsigned long size, const SAMPLE * destination) +unsigned SoundSourceSndFile::read(unsigned long size, const CSAMPLE * destination) { SAMPLE * dest = (SAMPLE *)destination; if (filelength > 0) === modified file 'mixxx/src/soundsourcesndfile.h' --- mixxx/src/soundsourcesndfile.h 2011-10-29 18:09:33 +0000 +++ mixxx/src/soundsourcesndfile.h 2013-04-21 19:06:33 +0000 @@ -28,7 +28,7 @@ ~SoundSourceSndFile(); int open(); long seek(long); - unsigned read(unsigned long size, const SAMPLE*); + unsigned read(unsigned long size, const CSAMPLE*); inline long unsigned length(); int parseHeader(); static QList supportedFileExtensions();