PaulStretch on Apple Silicon in 2022

It’s become something of a tradition – will the PaulStretch code still work n years later? The answer invariably is, yes!

Clone from github:

% git clone https://github.com/paulnasca/paulstretch_cpp.git
Cloning into 'paulstretch_cpp'…
remote: Enumerating objects: 166, done.
remote: Total 166 (delta 0), reused 0 (delta 0), pack-reused 166
Receiving objects: 100% (166/166), 92.98 KiB | 2.58 MiB/s, done.
Resolving deltas: 100% (101/101), done.

Look at previous notes and install dependencies:

% sudo port install fltk
% sudo port install audiofile
% sudo port install libmad
% sudo port install portaudio
% sudo port install fftw-3-single
% sudo port install mxml

Apply the following patch to XMLwrapper.cpp

% git diff XMLwrapper.cpp
diff --git a/XMLwrapper.cpp b/XMLwrapper.cpp
index 1efb66e..8fe17ad 100644
--- a/XMLwrapper.cpp
+++ b/XMLwrapper.cpp
@@ -29,7 +29,7 @@ int xml_k=0;
 char tabs[STACKSIZE+2];
 
 const char *XMLwrapper_whitespace_callback(mxml_node_t *node,int where){
-    const char *name=node->value.element.name;
+    const char *name=mxmlGetElement(node);
 
     if ((where==MXML_WS_BEFORE_OPEN)&&(!strcmp(name,"?xml"))) return(NULL);
     if ((where==MXML_WS_BEFORE_CLOSE)&&(!strcmp(name,"string"))) return(NULL);
@@ -407,10 +407,10 @@ void XMLwrapper::getparstr(const char *name,char *par,int maxstrlen){
     node=mxmlFindElement(peek(),peek(),"string","name",name,MXML_DESCEND_FIRST);
     
     if (node==NULL) return;
-    if (node->child==NULL) return;
-    if (node->child->type!=MXML_OPAQUE) return;
+    if (mxmlGetFirstChild(node)==NULL) return;
+    if (mxmlGetType(mxmlGetFirstChild(node))!=MXML_OPAQUE) return;
     
-    snprintf(par,maxstrlen,"%s",node->child->value.element.name);
+    snprintf(par,maxstrlen,"%s",mxmlGetText(mxmlGetFirstChild(node), NULL));
     
 };

Generate the UI:

% fluid -c GUI.fl
% fluid -c FreeEditUI.fl

And compile:

% g++ -ggdb -Wno-return-type GUI.cxx FreeEditUI.cxx *.cpp Input/*.cpp Output/*.cpp `fltk-config --cflags` \
 `fltk-config --ldflags`  -laudiofile -lfftw3f -lz -logg -lvorbis -lvorbisenc -lvorbisfile -lportaudio -lpthread -lmad -lmxml -o paulstretch
GUI.cxx:661:23: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
        const char *outstr=control.Render(control.get_input_filename(),outfilename,type,intype,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Ignore the warning and run the thing!

% ./paulstretch &

Wise words...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s