Remove MemoryHelper (#7335)

* remove memory helper and replace alignedMalloc with stl version

* it's aligned_alloc

* forgot about destructor

* switch to unique pointers

Co-authored-by: saker <sakertooth@gmail.com>

* compile fix

---------

Co-authored-by: saker <sakertooth@gmail.com>
This commit is contained in:
Rossmaxx
2024-06-24 21:22:19 +05:30
committed by GitHub
parent a1f7753a94
commit aaca5fbd0e
6 changed files with 11 additions and 137 deletions

View File

@@ -34,6 +34,7 @@
#include <QThread>
#include <samplerate.h>
#include <memory>
#include <vector>
#include "lmms_basics.h"
@@ -380,8 +381,8 @@ private:
int m_inputBufferRead;
int m_inputBufferWrite;
surroundSampleFrame * m_outputBufferRead;
surroundSampleFrame * m_outputBufferWrite;
std::unique_ptr<surroundSampleFrame[]> m_outputBufferRead;
std::unique_ptr<surroundSampleFrame[]> m_outputBufferWrite;
// worker thread stuff
std::vector<AudioEngineWorkerThread *> m_workers;

View File

@@ -1,49 +0,0 @@
/*
* 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 LMMS_MEMORY_HELPER_H
#define LMMS_MEMORY_HELPER_H
#include <cstddef>
namespace lmms
{
/**
* Helper class to alocate aligned memory and free it.
*/
class MemoryHelper {
public:
static void* alignedMalloc( size_t );
static void alignedFree( void* );
private:
};
} // namespace lmms
#endif // LMMS_MEMORY_HELPER_H

View File

@@ -128,7 +128,6 @@ constexpr char LADSPA_PATH_SEPERATOR =
using sampleFrame = std::array<sample_t, DEFAULT_CHANNELS>;
using surroundSampleFrame = std::array<sample_t, SURROUND_CHANNELS>;
constexpr std::size_t LMMS_ALIGN_SIZE = 16;
#define LMMS_STRINGIFY(s) LMMS_STR(s)