Revert irrelevant changes
This commit is contained in:
@@ -160,8 +160,6 @@ INCLUDE_DIRECTORIES(
|
||||
${Qt5Xml_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src/3rdparty/mingw-std-threads")
|
||||
|
||||
SET(QT_LIBRARIES
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
@@ -188,6 +186,9 @@ IF(EXISTS "${QT_TRANSLATIONS_DIR}")
|
||||
ADD_DEFINITIONS(-D'QT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}"')
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(Qt5Test)
|
||||
SET(QT_QTTEST_LIBRARY Qt5::Test)
|
||||
|
||||
# check for libsndfile
|
||||
FIND_PACKAGE(SndFile REQUIRED)
|
||||
IF(NOT SNDFILE_FOUND)
|
||||
@@ -441,7 +442,7 @@ ENDIF(NOT LMMS_HAVE_ALSA)
|
||||
IF(WANT_JACK)
|
||||
IF(WANT_WEAKJACK)
|
||||
SET(LMMS_HAVE_WEAKJACK TRUE)
|
||||
SET(WEAKJACK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack)
|
||||
SET(WEAKJACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack)
|
||||
SET(JACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/jack2/common)
|
||||
SET(STATUS_JACK "OK (weak linking enabled)")
|
||||
# use dlsym instead
|
||||
|
||||
@@ -108,7 +108,7 @@ chmod +x "${APPDIR}usr/bin/lmms"
|
||||
unset LD_LIBRARY_PATH
|
||||
|
||||
# Ensure linuxdeployqt can find shared objects
|
||||
export LD_LIBRARY_PATH="${APPDIR}"usr/lib/:"${APPDIR}"usr/lib/lmms/:"${APPDIR}"usr/lib/lmms/optional:"$LD_LIBRARY_PATH"
|
||||
export LD_LIBRARY_PATH="${APPDIR}"usr/lib/lmms/:"${APPDIR}"usr/lib/lmms/optional:"$LD_LIBRARY_PATH"
|
||||
|
||||
# Move executables so linuxdeployqt can find them
|
||||
ZYNLIB="${APPDIR}usr/lib/lmms/RemoteZynAddSubFx"
|
||||
|
||||
@@ -5,14 +5,10 @@
|
||||
|
||||
INCLUDE(GenQrc)
|
||||
|
||||
FUNCTION(BUILD_PLUGIN PLUGIN_NAME)
|
||||
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "DESTINATION;LINK;EXPORT_BASE_NAME" "MOCFILES;EMBEDDED_RESOURCES;UICFILES" ${ARGN})
|
||||
MACRO(BUILD_PLUGIN PLUGIN_NAME)
|
||||
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "LINK;EXPORT_BASE_NAME" "MOCFILES;EMBEDDED_RESOURCES;UICFILES" ${ARGN})
|
||||
SET(PLUGIN_SOURCES ${PLUGIN_UNPARSED_ARGUMENTS})
|
||||
|
||||
IF(NOT PLUGIN_DESTINATION)
|
||||
SET(PLUGIN_DESTINATION "${PLUGIN_DIR}")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/include")
|
||||
|
||||
ADD_DEFINITIONS(-DPLUGIN_NAME=${PLUGIN_NAME})
|
||||
@@ -60,17 +56,26 @@ FUNCTION(BUILD_PLUGIN PLUGIN_NAME)
|
||||
|
||||
ADD_LIBRARY(${PLUGIN_NAME} ${PLUGIN_LINK} ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT})
|
||||
|
||||
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml lmmslib)
|
||||
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml)
|
||||
|
||||
IF(LMMS_BUILD_WIN32)
|
||||
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} lmms)
|
||||
ENDIF(LMMS_BUILD_WIN32)
|
||||
|
||||
INSTALL(TARGETS ${PLUGIN_NAME}
|
||||
LIBRARY DESTINATION "${PLUGIN_DESTINATION}"
|
||||
RUNTIME DESTINATION "${PLUGIN_DESTINATION}"
|
||||
LIBRARY DESTINATION "${PLUGIN_DIR}"
|
||||
RUNTIME DESTINATION "${PLUGIN_DIR}"
|
||||
)
|
||||
|
||||
IF(LMMS_BUILD_APPLE AND "${PLUGIN_LINK}" STREQUAL "SHARED")
|
||||
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
ENDIF()
|
||||
IF(LMMS_BUILD_WIN32 AND STRIP)
|
||||
IF(LMMS_BUILD_APPLE)
|
||||
IF ("${PLUGIN_LINK}" STREQUAL "SHARED")
|
||||
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
ELSE()
|
||||
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"")
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${PLUGIN_NAME} lmms)
|
||||
ENDIF(LMMS_BUILD_APPLE)
|
||||
IF(LMMS_BUILD_WIN32)
|
||||
IF(STRIP)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} "$<TARGET_FILE:${PLUGIN_NAME}>")
|
||||
ENDIF()
|
||||
@@ -92,4 +97,5 @@ FUNCTION(BUILD_PLUGIN PLUGIN_NAME)
|
||||
|
||||
SET_PROPERTY(GLOBAL APPEND PROPERTY PLUGINS_BUILT ${PLUGIN_NAME})
|
||||
GET_PROPERTY(PLUGINS_BUILT GLOBAL PROPERTY PLUGINS_BUILT)
|
||||
ENDFUNCTION(BUILD_PLUGIN)
|
||||
ENDMACRO(BUILD_PLUGIN)
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
IF(WIN32)
|
||||
SET(LMMS_BUILD_WIN32 1)
|
||||
ELSEIF(APPLE)
|
||||
@@ -109,27 +107,3 @@ IF(LMMS_BUILD_APPLE)
|
||||
STRING(REGEX REPLACE "\\.[0-9]*$" "" APPLE_OS_VER "${APPLE_OS_VER}")
|
||||
SET(CMAKE_MACOSX_RPATH 1)
|
||||
ENDIF()
|
||||
|
||||
# Detect MinGW
|
||||
IF(WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(MINGW TRUE)
|
||||
ENDIF()
|
||||
|
||||
# Detect MINGW thread support
|
||||
IF(MINGW)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::mutex m;
|
||||
std::this_thread::yield();
|
||||
return 0;
|
||||
}
|
||||
" HAS_STD_THREADS)
|
||||
IF(NOT HAS_STD_THREADS)
|
||||
SET(NEED_MINGW_THREADS_REPLACEMENT TRUE)
|
||||
ELSE()
|
||||
SET(NEED_MINGW_THREADS_REPLACEMENT FALSE)
|
||||
ENDIF()
|
||||
MESSAGE(NEED_MINGW_THREADS_REPLACEMENT ${NEED_MINGW_THREADS_REPLACEMENT})
|
||||
ENDIF()
|
||||
|
||||
@@ -5,16 +5,13 @@ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
set(MINGW_PREFIX /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
SET(ENV{PKG_CONFIG} /usr/bin/${TOOLCHAIN_PREFIX}-pkg-config)
|
||||
|
||||
IF(WIN64)
|
||||
SET(TOOLCHAIN_PREFIX32 ${CMAKE_SYSTEM_PROCESSOR32}-w64-mingw32)
|
||||
SET(CMAKE_C_COMPILER32 ${TOOLCHAIN_PREFIX32}-gcc)
|
||||
SET(CMAKE_CXX_COMPILER32 ${TOOLCHAIN_PREFIX32}-g++)
|
||||
set(MINGW_PREFIX32 /usr/${TOOLCHAIN_PREFIX32})
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/WinCrossCompile.cmake)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QMutexLocker>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "PlayHandle.h"
|
||||
|
||||
class EffectChain;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "Model.h"
|
||||
#include "TimePos.h"
|
||||
#include "ValueBuffer.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ModelVisitor.h"
|
||||
|
||||
// simple way to map a property of a view to a model
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
class LMMS_EXPORT AutomationTrack : public Track
|
||||
class AutomationTrack : public Track
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QStaticText>
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "TrackContentObjectView.h"
|
||||
#include "Track.h"
|
||||
#include "TrackView.h"
|
||||
@@ -40,7 +39,7 @@ class TrackLabelButton;
|
||||
class TrackContainer;
|
||||
|
||||
|
||||
class LMMS_EXPORT BBTCO : public TrackContentObject
|
||||
class BBTCO : public TrackContentObject
|
||||
{
|
||||
public:
|
||||
BBTCO( Track * _track );
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_constants.h"
|
||||
#include "interpolation.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
template<ch_cnt_t CHANNELS=DEFAULT_CHANNELS> class BasicFilters;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QDomDocument>
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ProjectVersion.h"
|
||||
|
||||
class QTextStream;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_math.h"
|
||||
#include "interpolation.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
// brief usage
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define DETUNING_HELPER_H
|
||||
|
||||
#include "InlineAutomation.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class DetuningHelper : public InlineAutomation
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "Mixer.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "TempoSyncKnobModel.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class EffectChain;
|
||||
class EffectControls;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QString>
|
||||
#include "lmms_export.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "Plugin.h"
|
||||
#include "TimePos.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#ifndef MAINAPPLICATION_H
|
||||
#define MAINAPPLICATION_H
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -36,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(LMMS_BUILD_WIN32)
|
||||
class LMMS_EXPORT MainApplication : public QApplication, public QAbstractNativeEventFilter
|
||||
class MainApplication : public QApplication, public QAbstractNativeEventFilter
|
||||
#else
|
||||
class MainApplication : public QApplication
|
||||
#endif
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#ifndef MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
#include <QtCore/QBasicTimer>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QList>
|
||||
@@ -45,7 +43,7 @@ class PluginView;
|
||||
class ToolButton;
|
||||
|
||||
|
||||
class LMMS_EXPORT MainWindow : public QMainWindow
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -63,7 +61,7 @@ public:
|
||||
void addSpacingToToolBar( int _size );
|
||||
|
||||
// wrap the widget with a window decoration and add it to the workspace
|
||||
SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags = QFlag(0));
|
||||
LMMS_EXPORT SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags = QFlag(0));
|
||||
|
||||
|
||||
///
|
||||
|
||||
42
include/MemoryHelper.h
Normal file
42
include/MemoryHelper.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Simon Symeonidis <lethaljellybean/at/gmail/com>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MEMORY_HELPER_H
|
||||
#define MEMORY_HELPER_H
|
||||
|
||||
/**
|
||||
* Helper class to alocate aligned memory and free it.
|
||||
*/
|
||||
class MemoryHelper {
|
||||
public:
|
||||
|
||||
static void* alignedMalloc( size_t );
|
||||
|
||||
static void alignedFree( void* );
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Memory.h
|
||||
* MemoryManager.h
|
||||
*
|
||||
* Copyright (c) 2017 Lukas W <lukaswhl/at/gmail.com>
|
||||
* Copyright (c) 2014 Simon Symeonidis <lethaljellybean/at/gmail/com>
|
||||
* Copyright (c) 2014 Vesa Kivimäki
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2007-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
@@ -32,36 +31,25 @@
|
||||
#include <vector>
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "NiftyCounter.h"
|
||||
|
||||
class LMMS_EXPORT MemoryManager
|
||||
{
|
||||
public:
|
||||
struct ThreadGuard
|
||||
{
|
||||
ThreadGuard();
|
||||
~ThreadGuard();
|
||||
};
|
||||
|
||||
static void * alloc( size_t size );
|
||||
static void free( void * ptr );
|
||||
|
||||
private:
|
||||
static void initialize();
|
||||
static void deinitialize();
|
||||
static void thread_initialize();
|
||||
static void thread_deinitialize();
|
||||
public:
|
||||
typedef NiftyCounter<MemoryManager::initialize, MemoryManager::deinitialize> MmCounter;
|
||||
typedef NiftyCounterTL<MemoryManager::thread_initialize, MemoryManager::thread_deinitialize> ThreadGuard;
|
||||
};
|
||||
|
||||
static MemoryManager::MmCounter _mm_counter;
|
||||
static thread_local MemoryManager::MmCounter _mm_thread_counter;
|
||||
|
||||
template<typename T>
|
||||
class LMMS_EXPORT MmAllocator
|
||||
struct MmAllocator
|
||||
{
|
||||
public:
|
||||
MmAllocator() = default;
|
||||
template< class U > MmAllocator( const MmAllocator<U>& other ) {}
|
||||
typedef T value_type;
|
||||
template<class U> struct rebind { typedef MmAllocator<U> other; };
|
||||
|
||||
template<class U> struct rebind { typedef MmAllocator<U> other; };
|
||||
|
||||
T* allocate( std::size_t n )
|
||||
{
|
||||
@@ -76,36 +64,6 @@ public:
|
||||
typedef std::vector<T, MmAllocator<T> > vector;
|
||||
};
|
||||
|
||||
class _AlignedAllocator_Base
|
||||
{
|
||||
protected:
|
||||
void* alloc_impl( size_t alignment, size_t size );
|
||||
void dealloc_impl( void* p );
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class AlignedAllocator : _AlignedAllocator_Base
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
template<class U> struct rebind { typedef AlignedAllocator<U> other; };
|
||||
|
||||
AlignedAllocator( size_t alignment = 16 )
|
||||
: alignment(alignment) {}
|
||||
|
||||
T* allocate( std::size_t n )
|
||||
{
|
||||
return reinterpret_cast<T*>( alloc_impl( alignment, sizeof(T) * n ) );
|
||||
}
|
||||
|
||||
void deallocate( T* p, std::size_t )
|
||||
{
|
||||
dealloc_impl( p );
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t alignment;
|
||||
};
|
||||
|
||||
#define MM_OPERATORS \
|
||||
public: \
|
||||
@@ -26,7 +26,7 @@
|
||||
#define MIDI_EVENT_PROCESSOR_H
|
||||
|
||||
#include "MidiEvent.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "TimePos.h"
|
||||
|
||||
// all classes being able to process MIDI-events should inherit from this
|
||||
|
||||
@@ -27,11 +27,10 @@
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "MicroTimer.h"
|
||||
|
||||
class LMMS_EXPORT MixerProfiler
|
||||
class MixerProfiler
|
||||
{
|
||||
public:
|
||||
MixerProfiler();
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#ifndef MODELVISITOR_H
|
||||
#define MODELVISITOR_H
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
class AutomatableModel;
|
||||
class BoolModel;
|
||||
class IntModel;
|
||||
@@ -34,7 +32,7 @@ class FloatModel;
|
||||
class ComboBoxModel;
|
||||
class TempoSyncKnobModel;
|
||||
|
||||
class LMMS_EXPORT ModelVisitor
|
||||
class ModelVisitor
|
||||
{
|
||||
template<class ParentType = AutomatableModel, class ModelType>
|
||||
void up(ModelType& m) { visit(static_cast<ParentType&>(m)); }
|
||||
@@ -48,7 +46,7 @@ public:
|
||||
virtual ~ModelVisitor();
|
||||
};
|
||||
|
||||
class LMMS_EXPORT ConstModelVisitor
|
||||
class ConstModelVisitor
|
||||
{
|
||||
template<class ParentType = AutomatableModel, class ModelType>
|
||||
void up(const ModelType& m) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
#include "ThreadableJob.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "JournallingObject.h"
|
||||
#include "Model.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
class QWidget;
|
||||
|
||||
@@ -31,13 +31,12 @@
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include <limits>
|
||||
#include "lmms_export.h"
|
||||
|
||||
/*! \brief Version number parsing and comparison
|
||||
*
|
||||
* Parses and compares version information. i.e. "1.0.3" < "1.0.10"
|
||||
*/
|
||||
class LMMS_EXPORT ProjectVersion
|
||||
class ProjectVersion
|
||||
{
|
||||
public:
|
||||
enum CompareType : int { None = 0, Major=1, Minor=2, Release=3, Stage=4, Build=5, All = std::numeric_limits<int>::max() };
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "OutputSettings.h"
|
||||
|
||||
|
||||
class LMMS_EXPORT RenderManager : public QObject
|
||||
class RenderManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QObject>
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_math.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
/** \brief A basic LMMS ring buffer for single-thread use. For thread and realtime safe alternative see LocklessRingBuffer.
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_math.h"
|
||||
#include "shared_object.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
class QPainter;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "lmms_export.h"
|
||||
|
||||
class LMMS_EXPORT ValueBuffer : public std::vector<float>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "Gb_Apu.h"
|
||||
#include "Multi_Buffer.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class Gb_Apu_Buffer : public Gb_Apu {
|
||||
MM_OPERATORS
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "Knob.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "gig.h"
|
||||
|
||||
class GigInstrumentView;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "EffectChain.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ValueBuffer.h"
|
||||
#include "Song.h"
|
||||
|
||||
|
||||
@@ -47,5 +47,3 @@ ENDIF()
|
||||
IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
|
||||
SET_TARGET_PROPERTIES(veal PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(veal lmmslib)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "AutomatableModel.h"
|
||||
#include "Graph.h"
|
||||
#include "Instrument.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
class ExprFrontData;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "Knob.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class oscillator;
|
||||
class bitInvaderView;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
INCLUDE(BuildPlugin)
|
||||
|
||||
BUILD_PLUGIN(kicker kicker.cpp kicker.h KickerOsc.h MOCFILES kicker.h EMBEDDED_RESOURCES artwork.png logo.png)
|
||||
BUILD_PLUGIN(kicker kicker.cpp kicker.h MOCFILES kicker.h EMBEDDED_RESOURCES artwork.png logo.png)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "lmms_math.h"
|
||||
#include "interpolation.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
template<class FX = DspEffectLibrary::StereoBypass>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "TempoSyncKnob.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
#define makeknob( name, x, y, hint, unit, oname ) \
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "InstrumentView.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class PixmapButton;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "LcdSpinBox.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "fluidsynthshims.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class sf2InstrumentView;
|
||||
class sf2Font;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "Graph.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
enum SfxrWaves
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "BufferManager.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Engine.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <QVector>
|
||||
|
||||
#include "vibrating_string.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
class stringContainer
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "NotePlayHandle.h"
|
||||
#include "PixmapButton.h"
|
||||
#include <samplerate.h>
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
#define makeknob( name, x, y, hint, unit, oname ) \
|
||||
|
||||
5
src/3rdparty/rpmalloc/CMakeLists.txt
vendored
5
src/3rdparty/rpmalloc/CMakeLists.txt
vendored
@@ -7,10 +7,7 @@ target_include_directories(rpmalloc PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rpmalloc/rpmalloc
|
||||
)
|
||||
|
||||
set_target_properties(rpmalloc PROPERTIES
|
||||
C_STANDARD 11
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
set_property(TARGET rpmalloc PROPERTY C_STANDARD 11)
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(rpmalloc
|
||||
|
||||
@@ -21,6 +21,14 @@ ADD_SUBDIRECTORY(gui)
|
||||
ADD_SUBDIRECTORY(tracks)
|
||||
|
||||
QT5_WRAP_UI(LMMS_UI_OUT ${LMMS_UIS})
|
||||
INCLUDE_DIRECTORIES(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/include"
|
||||
"${RINGBUFFER_DIR}/include"
|
||||
)
|
||||
|
||||
IF(WIN32 AND MSVC)
|
||||
SET(WINRC "${CMAKE_BINARY_DIR}/lmms.rc")
|
||||
@@ -41,6 +49,60 @@ ADD_GEN_QRC(LMMS_RCC_OUT lmms.qrc
|
||||
"${CONTRIBUTORS}"
|
||||
)
|
||||
|
||||
# Paths relative to lmms executable
|
||||
FILE(RELATIVE_PATH LIB_DIR_RELATIVE "/${BIN_DIR}" "/${LIB_DIR}")
|
||||
FILE(RELATIVE_PATH PLUGIN_DIR_RELATIVE "/${BIN_DIR}" "/${PLUGIN_DIR}")
|
||||
ADD_DEFINITIONS(-DLIB_DIR="${LIB_DIR_RELATIVE}" -DPLUGIN_DIR="${PLUGIN_DIR_RELATIVE}" ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS})
|
||||
INCLUDE_DIRECTORIES(
|
||||
${JACK_INCLUDE_DIRS}
|
||||
${SAMPLERATE_INCLUDE_DIRS}
|
||||
${SNDFILE_INCLUDE_DIRS}
|
||||
${SNDIO_INCLUDE_DIRS}
|
||||
${FFTW3F_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
IF(NOT ("${SDL2_INCLUDE_DIR}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${SDL2_INCLUDE_DIR}")
|
||||
ELSEIF(NOT ("${SDL_INCLUDE_DIR}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${SDL_INCLUDE_DIR}")
|
||||
ENDIF()
|
||||
|
||||
IF(LMMS_HAVE_WEAKJACK)
|
||||
LIST(APPEND LMMS_SRCS "${WEAKJACK_INCLUDE_DIRS}/weak_libjack.c")
|
||||
LIST(APPEND LMMS_INCLUDES "${WEAKJACK_INCLUDE_DIRS}/weak_libjack.h")
|
||||
INCLUDE_DIRECTORIES("${WEAKJACK_INCLUDE_DIRS}")
|
||||
ADD_DEFINITIONS(-DUSE_WEAK_JACK=1 -DNO_JACK_METADATA=1)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${PORTAUDIO_INCLUDE_DIR}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${PORTAUDIO_INCLUDE_DIR}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${PULSEAUDIO_INCLUDE_DIR}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${PULSEAUDIO_INCLUDE_DIR}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${OGGVORBIS_INCLUDE_DIR}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${OGGVORBIS_INCLUDE_DIR}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${LAME_INCLUDE_DIRS}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES("${LAME_INCLUDE_DIRS}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${LV2_INCLUDE_DIRS}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES(${LV2_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${LILV_INCLUDE_DIRS}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES(${LILV_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ("${SUIL_INCLUDE_DIRS}" STREQUAL ""))
|
||||
INCLUDE_DIRECTORIES(${SUIL_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
LIST(APPEND LMMS_SRCS "${RINGBUFFER_DIR}/src/lib/ringbuffer.cpp")
|
||||
|
||||
# Use libraries in non-standard directories (e.g., another version of Qt)
|
||||
IF(LMMS_BUILD_LINUX)
|
||||
LINK_LIBRARIES(-Wl,--enable-new-dtags)
|
||||
@@ -48,63 +110,35 @@ IF(LMMS_BUILD_LINUX)
|
||||
ENDIF()
|
||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
ADD_LIBRARY(lmmslib SHARED
|
||||
ADD_LIBRARY(lmmsobjs OBJECT
|
||||
${LMMS_SRCS}
|
||||
${LMMS_INCLUDES}
|
||||
${LMMS_UI_OUT}
|
||||
${LMMS_RCC_OUT}
|
||||
${RINGBUFFER_DIR}/src/lib/ringbuffer.cpp
|
||||
$<$<BOOL:${LMMS_HAVE_WEAKJACK}>:
|
||||
${WEAKJACK_INCLUDE_DIR}/weak_libjack.c
|
||||
${WEAKJACK_INCLUDE_DIR}/weak_libjack.h
|
||||
>
|
||||
)
|
||||
|
||||
GENERATE_EXPORT_HEADER(lmmslib
|
||||
GENERATE_EXPORT_HEADER(lmmsobjs
|
||||
BASE_NAME lmms
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(lmms
|
||||
core/main.cpp
|
||||
$<TARGET_OBJECTS:lmmsobjs>
|
||||
"${WINRC}"
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(lmmslib PUBLIC
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/include"
|
||||
"${RINGBUFFER_DIR}/include"
|
||||
${JACK_INCLUDE_DIRS}
|
||||
${SAMPLERATE_INCLUDE_DIRS}
|
||||
${SNDFILE_INCLUDE_DIRS}
|
||||
${SNDIO_INCLUDE_DIRS}
|
||||
${FFTW3F_INCLUDE_DIRS}
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${SDL_INCLUDE_DIR}
|
||||
${PORTAUDIO_INCLUDE_DIR}
|
||||
${PULSEAUDIO_INCLUDE_DIR}
|
||||
${OGGVORBIS_INCLUDE_DIR}
|
||||
${LAME_INCLUDE_DIRS}
|
||||
${LV2_INCLUDE_DIRS}
|
||||
${LILV_INCLUDE_DIRS}
|
||||
${SUIL_INCLUDE_DIRS}
|
||||
${WEAKJACK_INCLUDE_DIR}
|
||||
TARGET_INCLUDE_DIRECTORIES(lmms
|
||||
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
# Paths relative to lmms executable
|
||||
FILE(RELATIVE_PATH LIB_DIR_RELATIVE "/${BIN_DIR}" "/${LIB_DIR}")
|
||||
FILE(RELATIVE_PATH PLUGIN_DIR_RELATIVE "/${BIN_DIR}" "/${PLUGIN_DIR}")
|
||||
TARGET_COMPILE_DEFINITIONS(lmmslib
|
||||
PRIVATE
|
||||
LIB_DIR="${LIB_DIR_RELATIVE}"
|
||||
PLUGIN_DIR="${PLUGIN_DIR_RELATIVE}"
|
||||
PUBLIC
|
||||
${PULSEAUDIO_DEFINITIONS}
|
||||
${PORTAUDIO_DEFINITIONS}
|
||||
$<$<BOOL:${LMMS_HAVE_WEAKJACK}>:USE_WEAK_JACK=1 NO_JACK_METADATA=1>
|
||||
# CMake doesn't define target_EXPORTS for OBJECT libraries.
|
||||
# See the documentation of DEFINE_SYMBOL for details.
|
||||
# Also add LMMS_STATIC_DEFINE for targets linking against it.
|
||||
TARGET_COMPILE_DEFINITIONS(lmmsobjs
|
||||
PRIVATE -Dlmmsobjs_EXPORTS
|
||||
INTERFACE -DLMMS_STATIC_DEFINE
|
||||
)
|
||||
TARGET_COMPILE_DEFINITIONS(lmms
|
||||
PRIVATE $<TARGET_PROPERTY:lmmsobjs,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
|
||||
# Set Visual Studio startup project to lmms
|
||||
@@ -131,7 +165,7 @@ IF(LMMS_BUILD_HAIKU)
|
||||
SET(EXTRA_LIBRARIES "-lnetwork")
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(lmmslib
|
||||
SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${QT_LIBRARIES}
|
||||
${ASOUND_LIBRARY}
|
||||
@@ -153,9 +187,39 @@ TARGET_LINK_LIBRARIES(lmmslib
|
||||
rpmalloc
|
||||
cds
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(lmms lmmslib)
|
||||
|
||||
IF(NOT LMMS_BUILD_WIN32)
|
||||
# Expose required libs for tests binary
|
||||
SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS} PARENT_SCOPE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(lmms
|
||||
${LMMS_REQUIRED_LIBS}
|
||||
)
|
||||
|
||||
FOREACH(LIB ${LMMS_REQUIRED_LIBS})
|
||||
IF(TARGET ${LIB})
|
||||
GET_TARGET_PROPERTY(INCLUDE_DIRS ${LIB} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
IF(INCLUDE_DIRS)
|
||||
TARGET_INCLUDE_DIRECTORIES(lmmsobjs PRIVATE ${INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
IF(LMMS_BUILD_WIN32)
|
||||
SET_TARGET_PROPERTIES(lmms PROPERTIES
|
||||
ENABLE_EXPORTS ON
|
||||
)
|
||||
IF(LMMS_BUILD_MSYS)
|
||||
# ENABLE_EXPORTS property has no effect in some MSYS2 configurations.
|
||||
# Add the linker flag manually to create liblmms.dll.a import library
|
||||
SET_PROPERTY(TARGET lmms
|
||||
APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--out-implib,liblmms.dll.a"
|
||||
)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(NOT LMMS_BUILD_APPLE)
|
||||
SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E")
|
||||
ENDIF(NOT LMMS_BUILD_APPLE)
|
||||
|
||||
if(CMAKE_INSTALL_MANDIR)
|
||||
SET(INSTALL_MANDIR ${CMAKE_INSTALL_MANDIR})
|
||||
ELSE(CMAKE_INSTALL_MANDIR)
|
||||
@@ -166,7 +230,4 @@ IF(NOT LMMS_BUILD_WIN32)
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
|
||||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS lmms lmmslib
|
||||
RUNTIME DESTINATION "${BIN_DIR}"
|
||||
LIBRARY DESTINATION "${LIB_DIR}"
|
||||
)
|
||||
INSTALL(TARGETS lmms RUNTIME DESTINATION "${BIN_DIR}")
|
||||
|
||||
@@ -32,7 +32,8 @@ set(LMMS_SRCS
|
||||
core/LadspaManager.cpp
|
||||
core/LfoController.cpp
|
||||
core/LinkedModelGroups.cpp
|
||||
core/Memory.cpp
|
||||
core/MemoryHelper.cpp
|
||||
core/MemoryManager.cpp
|
||||
core/MemoryPool.cpp
|
||||
core/MeterModel.cpp
|
||||
core/MicroTimer.cpp
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Mixer.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
|
||||
|
||||
InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking::ChordTable::s_initTable[] =
|
||||
{
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "octave" ), { 0, -1 } },
|
||||
|
||||
65
src/core/MemoryHelper.cpp
Normal file
65
src/core/MemoryHelper.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Simon Symeonidis <lethaljellybean/at/gmail/com>
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "MemoryHelper.h"
|
||||
|
||||
/**
|
||||
* Allocate a number of bytes and return them.
|
||||
* @param byteNum is the number of bytes
|
||||
*/
|
||||
void* MemoryHelper::alignedMalloc( size_t byteNum )
|
||||
{
|
||||
char *ptr, *ptr2, *aligned_ptr;
|
||||
int align_mask = ALIGN_SIZE - 1;
|
||||
|
||||
ptr = static_cast<char*>( malloc( byteNum + ALIGN_SIZE + sizeof( int ) ) );
|
||||
|
||||
if( ptr == NULL ) return NULL;
|
||||
|
||||
ptr2 = ptr + sizeof( int );
|
||||
aligned_ptr = ptr2 + ( ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) );
|
||||
|
||||
ptr2 = aligned_ptr - sizeof( int );
|
||||
*( ( int* ) ptr2 ) = ( int )( aligned_ptr - ptr );
|
||||
|
||||
return aligned_ptr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free an aligned buffer
|
||||
* @param _buffer is the buffer to free
|
||||
*/
|
||||
void MemoryHelper::alignedFree( void* _buffer )
|
||||
{
|
||||
if( _buffer )
|
||||
{
|
||||
int *ptr2 = static_cast<int*>( _buffer ) - 1;
|
||||
_buffer = static_cast<char*>( _buffer ) - *ptr2;
|
||||
free( _buffer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/*
|
||||
* Memory.cpp
|
||||
* MemoryManager.cpp
|
||||
*
|
||||
* Copyright (c) 2018 Lukas W <lukaswhl/at/gmail.com>
|
||||
* Copyright (c) 2014 Simon Symeonidis <lethaljellybean/at/gmail/com>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2017 Lukas W <lukaswhl/at/gmail.com>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
@@ -25,11 +23,40 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include "rpmalloc.h"
|
||||
|
||||
/// Global static object handling rpmalloc intializing and finalizing
|
||||
struct MemoryManagerGlobalGuard {
|
||||
MemoryManagerGlobalGuard() {
|
||||
rpmalloc_initialize();
|
||||
}
|
||||
~MemoryManagerGlobalGuard() {
|
||||
rpmalloc_finalize();
|
||||
}
|
||||
} static mm_global_guard;
|
||||
|
||||
|
||||
namespace {
|
||||
static thread_local size_t thread_guard_depth;
|
||||
}
|
||||
|
||||
MemoryManager::ThreadGuard::ThreadGuard()
|
||||
{
|
||||
if (thread_guard_depth++ == 0) {
|
||||
rpmalloc_thread_initialize();
|
||||
}
|
||||
}
|
||||
|
||||
MemoryManager::ThreadGuard::~ThreadGuard()
|
||||
{
|
||||
if (--thread_guard_depth == 0) {
|
||||
rpmalloc_thread_finalize();
|
||||
}
|
||||
}
|
||||
|
||||
static thread_local MemoryManager::ThreadGuard local_mm_thread_guard{};
|
||||
|
||||
void* MemoryManager::alloc(size_t size)
|
||||
@@ -48,33 +75,3 @@ void MemoryManager::free(void * ptr)
|
||||
Q_ASSERT_X(rpmalloc_is_thread_initialized(), "MemoryManager::free", "Thread not initialized");
|
||||
return rpfree(ptr);
|
||||
}
|
||||
|
||||
void MemoryManager::initialize()
|
||||
{
|
||||
rpmalloc_initialize();
|
||||
}
|
||||
|
||||
void MemoryManager::deinitialize()
|
||||
{
|
||||
rpmalloc_finalize();
|
||||
}
|
||||
|
||||
void MemoryManager::thread_initialize()
|
||||
{
|
||||
rpmalloc_thread_initialize();
|
||||
}
|
||||
|
||||
void MemoryManager::thread_deinitialize()
|
||||
{
|
||||
rpmalloc_thread_finalize();
|
||||
}
|
||||
|
||||
void* _AlignedAllocator_Base::alloc_impl(size_t alignment, size_t size )
|
||||
{
|
||||
return rpaligned_alloc(alignment, size);
|
||||
}
|
||||
|
||||
void _AlignedAllocator_Base::dealloc_impl(void* p)
|
||||
{
|
||||
rpfree(p);
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "libcds.h"
|
||||
#include <cds/container/vyukov_mpmc_cycle_queue.h>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class _MemoryPool_Private : MmAllocator<char>
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "NotePlayHandle.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "Memory.h"
|
||||
#include "MemoryHelper.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "BufferPool.h"
|
||||
|
||||
@@ -136,9 +136,9 @@ Mixer::Mixer( bool renderOnly ) :
|
||||
// now that framesPerPeriod is fixed initialize global BufferPool
|
||||
BufferPool::init( m_framesPerPeriod );
|
||||
|
||||
AlignedAllocator<surroundSampleFrame> alloc;
|
||||
m_outputBufferRead = alloc.allocate(m_framesPerPeriod);
|
||||
m_outputBufferWrite = alloc.allocate(m_framesPerPeriod);
|
||||
int outputBufferSize = m_framesPerPeriod * sizeof(surroundSampleFrame);
|
||||
m_outputBufferRead = static_cast<surroundSampleFrame *>(MemoryHelper::alignedMalloc(outputBufferSize));
|
||||
m_outputBufferWrite = static_cast<surroundSampleFrame *>(MemoryHelper::alignedMalloc(outputBufferSize));
|
||||
|
||||
MixHelpers::clear(m_outputBufferRead, m_framesPerPeriod);
|
||||
MixHelpers::clear(m_outputBufferWrite, m_framesPerPeriod);
|
||||
@@ -182,9 +182,8 @@ Mixer::~Mixer()
|
||||
delete m_midiClient;
|
||||
delete m_audioDev;
|
||||
|
||||
AlignedAllocator<surroundSampleFrame> alloc;
|
||||
alloc.deallocate(m_outputBufferRead, m_framesPerPeriod);
|
||||
alloc.deallocate(m_outputBufferWrite, m_framesPerPeriod);
|
||||
MemoryHelper::alignedFree(m_outputBufferRead);
|
||||
MemoryHelper::alignedFree(m_outputBufferWrite);
|
||||
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "Mixer.h"
|
||||
#include "Song.h"
|
||||
|
||||
|
||||
NotePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) :
|
||||
m_value( detuning ? detuning->automationPattern()->valueAt( 0 ) : 0 )
|
||||
{
|
||||
|
||||
@@ -6,8 +6,6 @@ INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/src")
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
FIND_PACKAGE(Qt5Test)
|
||||
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
# FIXME: remove this once we export include directories for LMMS
|
||||
@@ -19,6 +17,7 @@ ADD_EXECUTABLE(tests
|
||||
EXCLUDE_FROM_ALL
|
||||
main.cpp
|
||||
QTestSuite
|
||||
$<TARGET_OBJECTS:lmmsobjs>
|
||||
|
||||
src/core/AutomatableModelTest.cpp
|
||||
src/core/ProjectVersionTest.cpp
|
||||
@@ -27,4 +26,8 @@ ADD_EXECUTABLE(tests
|
||||
|
||||
src/tracks/AutomationTrackTest.cpp
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(tests lmmslib Qt5::Test)
|
||||
TARGET_COMPILE_DEFINITIONS(tests
|
||||
PRIVATE $<TARGET_PROPERTY:lmmsobjs,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(tests ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(tests ${LMMS_REQUIRED_LIBS})
|
||||
|
||||
Reference in New Issue
Block a user