<commit_before>// Copyright 2015-2019 <NAME>. All rights reserved.

#ifndef OUZEL_AUDIO_MIXER_OBJECT_HPP
#define OUZEL_AUDIO_MIXER_OBJECT_HPP

#include <cstdint>
#include <vector>
#include "math/Quaternion.hpp"
#include "math/Vector.hpp"

namespace ouzel
{
    namespace audio
    {
        namespace mixer
        {
            class Object
            {
            public:
                Object() noexcept = default;
                virtual ~Object()
                {
                    if (parent)
                        parent->removeChild(*this);
                }

                Object(const Object&) = delete;
                Object& operator=(const Object&) = delete;

                Object(Object&&) = delete;
                Object& operator=(Object&&) = delete;

                void addChild(Object& child)
                {
                    if (child.parent != this)
                    {
                        if (child.parent)
                            child.parent->removeChild(child);

                        auto i = std::find(children.begin(), children.end(), &child);
                        if (i == children.end())
                        {
                            child.parent = this;
                            children.push_back(&child);
                        }
                    }
                }

                void removeChild(Object& child)
                {
                    if (child.parent == this)
                    {
                        auto i = std::find(children.begin(), children.end(), &child);
                        if (i != children.end())
                        {
                            child.parent = this;
                            children.erase(i);
                        }
                    }
                }

                // TODO: make pure virtual
                virtual void getSamples(uint32_t frames, uint16_t channels, uint32_t sampleRate, std::vector<float>& samples)
                {
                }

            protected:
                Object* parent = nullptr;
                std::vector<Object*> children;
            };
        }
    } // namespace audio
} // namespace ouzel

#endif // OUZEL_AUDIO_MIXER_OBJECT_HPP<commit_msg>Store pointer to source in the mixer::Object<commit_after>// Copyright 2015-2019 <NAME>. All rights reserved.

#ifndef OUZEL_AUDIO_MIXER_OBJECT_HPP
#define OUZEL_AUDIO_MIXER_OBJECT_HPP

#include <cstdint>
#include <memory>
#include <vector>
#include "audio/mixer/Source.hpp"
#include "math/Quaternion.hpp"
#include "math/Vector.hpp"

namespace ouzel
{
    namespace audio
    {
        namespace mixer
        {
            class Object
            {
            public:
                Object() noexcept = default;
                Object(std::unique_ptr<Source> initSource) noexcept:
                    source(std::move(initSource))
                {
                }

                virtual ~Object()
                {
                    if (parent)
                        parent->removeChild(*this);
                }

                Object(const Object&) = delete;
                Object& operator=(const Object&) = delete;

                Object(Object&&) = delete;
                Object& operator=(Object&&) = delete;

                void addChild(Object& child)
                {
                    if (child.parent != this)
                    {
                        if (child.parent)
                            child.parent->removeChild(child);

                        auto i = std::find(children.begin(), children.end(), &child);
                        if (i == children.end())
                        {
                            child.parent = this;
                            children.push_back(&child);
                        }
                    }
                }

                void removeChild(Object& child)
                {
                    if (child.parent == this)
                    {
                        auto i = std::find(children.begin(), children.end(), &child);
                        if (i != children.end())
                        {
                            child.parent = this;
                            children.erase(i);
                        }
                    }
                }

                // TODO: make non-virtual
                virtual void getSamples(uint32_t frames, uint16_t channels, uint32_t sampleRate, std::vector<float>& samples)
                {
                    if (source)
                        source->getSamples(frames, channels, sampleRate, samples);
                }

            protected:
                Object* parent = nullptr;
                std::vector<Object*> children;
                std::unique_ptr<Source> source;
            };
        }
    } // namespace audio
} // namespace ouzel

#endif // OUZEL_AUDIO_MIXER_OBJECT_HPP
{'fraction_non_alphanumeric': 0.09389671361502347, 'fraction_numerical': 0.005715452133088385, 'mean_word_length': 1.023121387283237, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2618009', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1117, 'n_words': 242}