mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
LibDSP: Refactor OOP non-functionally
* Don't inherit from Core::Object everywhere, that's overkill. Use RefCounted instead. * Change some constructor visibilites to facilitate the above. * default-implement all virtual destructors if possible. * Drive-by include hygiene.
This commit is contained in:
parent
3cfa9b63b5
commit
4a6ebb8beb
9 changed files with 48 additions and 46 deletions
|
@ -1,27 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2021, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||
* Copyright (c) 2021-2022, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Music.h"
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibDSP/Music.h>
|
||||
|
||||
namespace LibDSP {
|
||||
|
||||
// A clip is a self-contained snippet of notes or audio that can freely move inside and in between tracks.
|
||||
class Clip : public Core::Object {
|
||||
C_OBJECT_ABSTRACT(Clip)
|
||||
class Clip : public RefCounted<Clip> {
|
||||
public:
|
||||
Clip(u32 start, u32 length)
|
||||
: m_start(start)
|
||||
, m_length(length)
|
||||
{
|
||||
}
|
||||
virtual ~Clip() = default;
|
||||
|
||||
u32 start() const { return m_start; }
|
||||
|
@ -29,6 +23,12 @@ public:
|
|||
u32 end() const { return m_start + m_length; }
|
||||
|
||||
protected:
|
||||
Clip(u32 start, u32 length)
|
||||
: m_start(start)
|
||||
, m_length(length)
|
||||
{
|
||||
}
|
||||
|
||||
u32 m_start;
|
||||
u32 m_length;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue