From ee711d8e3c9b0233c6d3ed5ddf2bd130c4f9dc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sun, 10 Jul 2022 15:19:16 +0200 Subject: [PATCH] supercollider: Upgrade 3.11.2 -> 3.12.2 / fix build with libsndfile 1.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- .../supercollider/supercollider.bb | 11 +- ...-macro-instead-of-redefining-the-str.patch | 218 ++++++++++++++++++ 2 files changed, 225 insertions(+), 4 deletions(-) create mode 100644 recipes-musicians/supercollider/supercollider/0001-libsndfile-use-a-macro-instead-of-redefining-the-str.patch diff --git a/recipes-musicians/supercollider/supercollider.bb b/recipes-musicians/supercollider/supercollider.bb index e344993..570f09d 100644 --- a/recipes-musicians/supercollider/supercollider.bb +++ b/recipes-musicians/supercollider/supercollider.bb @@ -3,12 +3,15 @@ HOMEPAGE = "http://supercollider.github.io/" LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -SRC_URI = "gitsm://github.com/supercollider/supercollider.git;branch=develop;protocol=https" -SRCREV = "206f24d865efa37264a0b42594f536ed834c1493" -PV = "3.11.2" +SRC_URI = " \ + gitsm://github.com/supercollider/supercollider.git;branch=develop;protocol=https \ + file://0001-libsndfile-use-a-macro-instead-of-redefining-the-str.patch \ +" +SRCREV = "7c4c983cbe98cb470928ac7345c4cf257afd2b55" +PV = "3.12.2" S = "${WORKDIR}/git" -inherit cmake_qt5 features_check mime mime-xdg +inherit cmake_qt5 features_check gtk-icon-cache mime mime-xdg REQUIRED_DISTRO_FEATURES = "x11" diff --git a/recipes-musicians/supercollider/supercollider/0001-libsndfile-use-a-macro-instead-of-redefining-the-str.patch b/recipes-musicians/supercollider/supercollider/0001-libsndfile-use-a-macro-instead-of-redefining-the-str.patch new file mode 100644 index 0000000..e31499b --- /dev/null +++ b/recipes-musicians/supercollider/supercollider/0001-libsndfile-use-a-macro-instead-of-redefining-the-str.patch @@ -0,0 +1,218 @@ +From b9dd70c4c8d61c93d7a70645e0bd18fa76e6834e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcin=20P=C4=85czkowski?= +Date: Mon, 18 Apr 2022 13:51:53 -0700 +Subject: [PATCH] libsndfile: use a macro instead of redefining the struct + +Co-Authored-By: Christof Ressi + +Upstream-Status: Accepted [https://github.com/supercollider/supercollider/commit/b9dd70c4c8d61c93d7a70645e0bd18fa76e6834e] +--- + include/plugin_interface/SC_SndBuf.h | 4 +-- + server/plugins/DiskIO_UGens.cpp | 29 +++++++++++---------- + server/scsynth/SC_HiddenWorld.h | 4 +++ + server/scsynth/SC_SequencedCommand.cpp | 10 +++---- + server/scsynth/SC_World.cpp | 4 +-- + server/supernova/sc/sc_plugin_interface.cpp | 4 +-- + 6 files changed, 30 insertions(+), 25 deletions(-) + +diff --git a/include/plugin_interface/SC_SndBuf.h b/include/plugin_interface/SC_SndBuf.h +index daccfef84..2cc129edb 100644 +--- a/include/plugin_interface/SC_SndBuf.h ++++ b/include/plugin_interface/SC_SndBuf.h +@@ -22,7 +22,7 @@ + + #include + +-typedef struct SNDFILE_tag SNDFILE; ++#define GETSNDFILE(x) ((SNDFILE*)x->sndfile) + + #ifdef SUPERNOVA + +@@ -145,7 +145,7 @@ struct SndBuf { + int mask; // for delay lines + int mask1; // for interpolating oscillators. + int coord; // used by fft ugens +- SNDFILE* sndfile; // used by disk i/o ++ void* sndfile; // used by disk i/o + // SF_INFO fileinfo; // used by disk i/o + #ifdef SUPERNOVA + bool isLocal; +diff --git a/server/plugins/DiskIO_UGens.cpp b/server/plugins/DiskIO_UGens.cpp +index 825d2d52a..3ace3ca8f 100644 +--- a/server/plugins/DiskIO_UGens.cpp ++++ b/server/plugins/DiskIO_UGens.cpp +@@ -111,7 +111,7 @@ void DiskIOMsg::Perform() { + sf_count_t count; + switch (mCommand) { + case kDiskCmd_Read: +- count = buf->sndfile ? sf_readf_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames) : 0; ++ count = buf->sndfile ? sf_readf_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames) : 0; + if (count < mFrames) { + memset(buf->data + (mPos + count) * buf->channels, 0, (mFrames - count) * buf->channels * sizeof(float)); + World_GetBuf(mWorld, mBufNum)->mask = mPos + count; +@@ -126,17 +126,17 @@ void DiskIOMsg::Perform() { + memset(buf->data + mPos * buf->channels, 0, mFrames * buf->channels * sizeof(float)); + goto leave; + } +- count = sf_readf_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames); ++ count = sf_readf_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames); + while (mFrames -= count) { +- sf_seek(buf->sndfile, 0, SEEK_SET); +- count = sf_readf_float(buf->sndfile, buf->data + (mPos + count) * buf->channels, mFrames); ++ sf_seek(GETSNDFILE(buf), 0, SEEK_SET); ++ count = sf_readf_float(GETSNDFILE(buf), buf->data + (mPos + count) * buf->channels, mFrames); + } + break; + case kDiskCmd_Write: + // printf("kDiskCmd_Write %d %p\n", mBufNum, buf->sndfile); + if (!buf->sndfile) + goto leave; +- count = sf_writef_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames); ++ count = sf_writef_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames); + break; + } + +@@ -287,14 +287,14 @@ void DiskIn_next(DiskIn* unit, int inNumSamples) { + if ((int)ZIN0(1)) { // loop + if (!bufr->sndfile) + memset(bufr->data + mPos * bufr->channels, 0, bufFrames2 * bufr->channels * sizeof(float)); +- count = sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2); ++ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2); + while (bufFrames2 -= count) { +- sf_seek(bufr->sndfile, 0, SEEK_SET); +- count = sf_readf_float(bufr->sndfile, bufr->data + (mPos + count) * bufr->channels, bufFrames2); ++ sf_seek(GETSNDFILE(bufr), 0, SEEK_SET); ++ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + (mPos + count) * bufr->channels, bufFrames2); + } + } else { // non-loop +- count = +- bufr->sndfile ? sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2) : 0; ++ count = bufr->sndfile ? sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2) ++ : 0; + if (count < bufFrames2) { + memset(bufr->data + (mPos + count) * bufr->channels, 0, + (bufFrames2 - count) * bufr->channels * sizeof(float)); +@@ -469,13 +469,14 @@ static void VDiskIn_request_buffer(VDiskIn* unit, float fbufnum, uint32 bufFrame + if ((int)ZIN0(2)) { // loop + if (!bufr->sndfile) + memset(bufr->data + mPos * bufr->channels, 0, bufFrames2 * bufr->channels * sizeof(float)); +- count = sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2); ++ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2); + while (bufFrames2 -= count) { +- sf_seek(bufr->sndfile, 0, SEEK_SET); +- count = sf_readf_float(bufr->sndfile, bufr->data + (mPos + count) * bufr->channels, bufFrames2); ++ sf_seek(GETSNDFILE(bufr), 0, SEEK_SET); ++ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + (mPos + count) * bufr->channels, bufFrames2); + } + } else { // non-loop +- count = bufr->sndfile ? sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2) : 0; ++ count = ++ bufr->sndfile ? sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2) : 0; + if (count < bufFrames2) { + memset(bufr->data + (mPos + count) * bufr->channels, 0, + (bufFrames2 - count) * bufr->channels * sizeof(float)); +diff --git a/server/scsynth/SC_HiddenWorld.h b/server/scsynth/SC_HiddenWorld.h +index 1782ae8e5..1f1d924e8 100644 +--- a/server/scsynth/SC_HiddenWorld.h ++++ b/server/scsynth/SC_HiddenWorld.h +@@ -37,6 +37,10 @@ + + #include "../../common/server_shm.hpp" + ++#ifndef NO_LIBSNDFILE ++# include ++#endif ++ + extern HashTable* gUnitDefLib; + + +diff --git a/server/scsynth/SC_SequencedCommand.cpp b/server/scsynth/SC_SequencedCommand.cpp +index 4227355f3..6f54e87a5 100644 +--- a/server/scsynth/SC_SequencedCommand.cpp ++++ b/server/scsynth/SC_SequencedCommand.cpp +@@ -375,7 +375,7 @@ bool BufFreeCmd::Stage2() { + mFreeData = buf->data; + #ifndef NO_LIBSNDFILE + if (buf->sndfile) +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + #endif + SndBuf_Init(buf); + return true; +@@ -600,7 +600,7 @@ bool BufReadCmd::Stage2() { + } + + if (buf->sndfile) +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + + if (mLeaveFileOpen) { + buf->sndfile = sf; +@@ -903,7 +903,7 @@ bool BufReadChannelCmd::Stage2() { + + leave: + if (buf->sndfile) +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + + if (mLeaveFileOpen) { + buf->sndfile = sf; +@@ -1014,7 +1014,7 @@ bool BufWriteCmd::Stage2() { + } + + if (buf->sndfile) +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + + if (mLeaveFileOpen) { + buf->sndfile = sf; +@@ -1057,7 +1057,7 @@ bool BufCloseCmd::Stage2() { + #else + SndBuf* buf = World_GetNRTBuf(mWorld, mBufIndex); + if (buf->sndfile) { +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + buf->sndfile = nullptr; + } + return true; +diff --git a/server/scsynth/SC_World.cpp b/server/scsynth/SC_World.cpp +index e6ee49023..e3de39e4c 100644 +--- a/server/scsynth/SC_World.cpp ++++ b/server/scsynth/SC_World.cpp +@@ -968,9 +968,9 @@ void World_Cleanup(World* world, bool unload_plugins) { + + #ifndef NO_LIBSNDFILE + if (nrtbuf->sndfile) +- sf_close(nrtbuf->sndfile); ++ sf_close(GETSNDFILE(nrtbuf)); + if (rtbuf->sndfile && rtbuf->sndfile != nrtbuf->sndfile) +- sf_close(rtbuf->sndfile); ++ sf_close(GETSNDFILE(rtbuf)); + #endif + } + +diff --git a/server/supernova/sc/sc_plugin_interface.cpp b/server/supernova/sc/sc_plugin_interface.cpp +index 0ca778730..2a938600a 100644 +--- a/server/supernova/sc/sc_plugin_interface.cpp ++++ b/server/supernova/sc/sc_plugin_interface.cpp +@@ -1041,7 +1041,7 @@ void sc_plugin_interface::buffer_close(uint32_t index) { + + if (buf->sndfile == nullptr) + return; +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + buf->sndfile = nullptr; + } + +@@ -1070,7 +1070,7 @@ void sc_plugin_interface::buffer_sync(uint32_t index) noexcept { + void sc_plugin_interface::free_buffer(uint32_t index) { + SndBuf* buf = world.mSndBufsNonRealTimeMirror + index; + if (buf->sndfile) +- sf_close(buf->sndfile); ++ sf_close(GETSNDFILE(buf)); + + sndbuf_init(buf); + } +-- +2.35.3 +