//
//  AudioSourceNode.hpp
//  SwitchboardSDK
//
//  Created by Balázs Kiss on 2022. 06. 03..
//  Copyright © 2022. Synervoz Inc. All rights reserved.
//

#pragma once

#include <switchboard/export.h>
#include <switchboard_core/AudioBusList.hpp>
#include <switchboard_core/AudioNode.hpp>

namespace switchboard {

/**
 * AudioSourceNode class.
 * @brief A node that produces audio and only has outgoing connections.
 */
class SWITCHBOARDSDK_EXPORT AudioSourceNode : public AudioNode {
public:

    /**
     * @brief AudioSourceNode constructor.
     * @details Initializes an AudioSourceNode with the specified number of output buses.
     *
     * @param numberOfOutputBuses The number of output buses for the audio source node.
     */
    explicit AudioSourceNode(const uint numberOfOutputBuses)
        : AudioNode(0, numberOfOutputBuses) {};

    /**
     * @brief Sets bus formats.
     * @details Should be overridden by subclasses.
     *
     * @param busFormats The bus formats to set.
     *
     * @returns True if the bus formats were set successfully, false otherwise.
     */
    virtual bool setBusFormats(AudioBusFormatList& busFormats) = 0;

    /**
     * @brief Produces audio data in the given buses.
     * @details Should be overridden by subclasses.
     *
     * @param buses The buses that should be filled with audio data.
     *
     * @returns True if audio was produced successfully, false otherwise.
     */
    virtual bool produce(AudioBusList& buses) = 0;
};

}
