From 8313d0f518d52916747fecf75a8232d829eee771 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 14 Feb 2023 01:02:35 -0500 Subject: [PATCH] let's try console --- CMakeLists.txt | 5 ++--- src/engine/platform/sound/c64_fp/array.cpp | 26 ++++++++++++++++++++++ src/engine/platform/sound/c64_fp/array.h | 6 ++++- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 src/engine/platform/sound/c64_fp/array.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7665e24f0..7d544ad7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -400,6 +400,7 @@ src/engine/platform/sound/c64/wave8580_PST.cc src/engine/platform/sound/c64/wave8580_P_T.cc src/engine/platform/sound/c64/wave8580__ST.cc +src/engine/platform/sound/c64_fp/array.cpp src/engine/platform/sound/c64_fp/Dac.cpp src/engine/platform/sound/c64_fp/EnvelopeGenerator.cpp src/engine/platform/sound/c64_fp/ExternalFilter.cpp @@ -763,9 +764,7 @@ if (WARNINGS_ARE_ERRORS) ) endif() -if (WIN32) - add_executable(furnace WIN32 ${USED_SOURCES}) -elseif(ANDROID AND NOT TERMUX) +if(ANDROID AND NOT TERMUX) add_library(furnace SHARED ${USED_SOURCES}) else() add_executable(furnace ${USED_SOURCES}) diff --git a/src/engine/platform/sound/c64_fp/array.cpp b/src/engine/platform/sound/c64_fp/array.cpp new file mode 100644 index 000000000..ccf8bed08 --- /dev/null +++ b/src/engine/platform/sound/c64_fp/array.cpp @@ -0,0 +1,26 @@ +/* + * This file is part of a modification to libsidplayfp, a SID player engine. + * The applied modification fixes compilation under recent version of GCC, + * which have tougher warnings against memory access problems. + * + * Copyright (C) 2011-2014 Leandro Nini + * Copyright (C) 2023 tildearrow + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "array.h" + +std::mutex counterOps; diff --git a/src/engine/platform/sound/c64_fp/array.h b/src/engine/platform/sound/c64_fp/array.h index 5291938c0..3407417f3 100644 --- a/src/engine/platform/sound/c64_fp/array.h +++ b/src/engine/platform/sound/c64_fp/array.h @@ -21,6 +21,10 @@ #ifndef ARRAY_H #define ARRAY_H +#include + +extern std::mutex counterOps; + /** * Counter. */ @@ -59,7 +63,7 @@ public: x(p.x), y(p.y) { count->increase(); } - ~matrix() { if (count->decrease() == 0) { delete count; delete [] data; } } + ~matrix() { counterOps.lock(); if (count->decrease() == 0) { delete count; delete [] data; } counterOps.unlock(); } unsigned int length() const { return x * y; }