porres / pd-soundtouch

2 stars 1 forks source link

build with pd-lib-builder #1

Open katjav opened 3 years ago

katjav commented 3 years ago

Building with pd-lib-builder on Linux 64 bit succeeded with this basic makefile (not complete with help patch etc.):

# Makefile for pure data class soundtouch~
lib.name := soundtouch

soundtouch~.class.sources := \
AAFilter.cpp \
cpu_detect_x86_gcc.cpp \
mmx_optimized.cpp \
FIFOSampleBuffer.cpp \
RateTransposer.cpp \
FIRFilter.cpp \
sse_optimized.cpp \
TDStretch.cpp \
SoundTouch.cpp \
soundtouch~.cpp

cflags := -I ./include

include Makefile.pdlibbuilder
Lucarda commented 3 years ago

I get this error on Windows64 with the pd-lib-builder makefile:

FIFOSampleBuffer.cpp: In member function 'void soundtouch::FIFOSampleBuffer::ensureCapacity(uint)':
FIFOSampleBuffer.cpp:181:39: error: cast from 'soundtouch::SAMPLETYPE*' {aka 'float*'} to 'ulong' {aka 'long unsigned int'} loses precision [-fpermissive]
  181 |         temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
      | 

If I add -fpermissive to the cflags compilation finishes but the object crashes Pd

porres commented 3 years ago

I get "cpu_detect_x86_gcc.cpp:42:10: fatal error: 'stdexcept' file not found"

include

katjav commented 3 years ago

Forgot to mention I used pd-lib-builder within the original soundtouch~ project as on http://www.katjaas.nl/pitchshift/soundtouch~.html. The cast error on Win64 might be solved with the new SoundTouch version. On Linux at least the current version from https://gitlab.com/soundtouch/soundtouch (at commit 65335143) builds with pd-lib-builder and works correctly. Only thing is you have to add files to the sources variable in the makefile, making this list:

soundtouch~.class.sources := \
AAFilter.cpp \
cpu_detect_x86.cpp \
mmx_optimized.cpp \
FIFOSampleBuffer.cpp \
RateTransposer.cpp \
FIRFilter.cpp \
InterpolateCubic.cpp \
InterpolateLinear.cpp \
InterpolateShannon.cpp \
sse_optimized.cpp \
TDStretch.cpp \
SoundTouch.cpp \
soundtouch~.cpp
Lucarda commented 3 years ago

I downloaded https://gitlab.com/soundtouch/soundtouch and did this folder struture:

[pd-lib-builder]
[soundtouch-master]
Makefile
README.md
soundtouch~.cpp
soundtouch~.h
soundtouch~-help.pd

then I cd soundtouch-master

and run:

./bootstarp
./configure
cd ../
make install

The [soundtouch~] object works Ok on Win64.

This is the Makefile:

# Makefile for pure data class soundtouch~
lib.name := soundtouch

STDIR = ./soundtouch-master/source/SoundTouch

soundtouch~.class.sources := \
${STDIR}/AAFilter.cpp \
${STDIR}/cpu_detect_x86.cpp \
${STDIR}/mmx_optimized.cpp \
${STDIR}/FIFOSampleBuffer.cpp \
${STDIR}/RateTransposer.cpp \
${STDIR}/FIRFilter.cpp \
${STDIR}/InterpolateCubic.cpp \
${STDIR}/InterpolateLinear.cpp \
${STDIR}/InterpolateShannon.cpp \
${STDIR}/sse_optimized.cpp \
${STDIR}/TDStretch.cpp \
${STDIR}/SoundTouch.cpp \
soundtouch~.cpp

cflags := -I ./soundtouch-master/include 

datafiles = \
README.md \
soundtouch~-help.pd \

# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
PDLIBBUILDER_DIR=pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder