Switchboard Extension SDK
Loading...
Searching...
No Matches
AudioBus.hpp
1//
2// AudioBus.hpp
3// SwitchboardSDK
4//
5// Created by Balázs Kiss on 2022. 03. 19..
6// Copyright © 2022. Synervoz Inc. All rights reserved.
7//
8
9#pragma once
10
11#include "AudioBuffer.hpp"
12#include "AudioBusFormat.hpp"
13
14namespace switchboard {
15
21struct AudioBus {
22 SB_WASM_EXPORT(AudioBus)
23
24
28 AudioBuffer<float>* buffer = nullptr;
29
33 AudioBus() = default;
34
41
47 [[nodiscard]] AudioBusFormat getFormat() const;
48
54 void setFormat(const AudioBusFormat& newFormat);
55
61 SB_WASM AudioBuffer<float>* getBuffer() const;
62
68 SB_WASM void setBuffer(AudioBuffer<float>* newBuffer);
69
75 [[nodiscard]] bool isConnected() const;
76
80 SB_WASM void copyFrom(const AudioBus& srcAudioBus);
81
85 void clear();
86
87private:
88 AudioBusFormat format;
89};
90
91}
Provides an abstraction around raw audio buffers stored in memory.
Definition AudioBuffer.hpp:21
Describes the format of an AudioBus instance without the need for the audio data.
Definition AudioBusFormat.hpp:22
SB_WASM void setBuffer(AudioBuffer< float > *newBuffer)
Sets the audio buffer of the audio bus.
bool isConnected() const
Checks if the audio bus is connected to another audio bus.
void setFormat(const AudioBusFormat &newFormat)
Sets the format of the audio bus.
SB_WASM AudioBuffer< float > * getBuffer() const
Gets the audio buffer of the audio bus.
AudioBus()=default
Default audioBus constructor.
AudioBusFormat getFormat() const
Gets the format of the audio bus.
void clear()
Sets the content of the audio bus to zero.
AudioBuffer< float > * buffer
The audio buffer that contains the audio data.
Definition AudioBus.hpp:28
SB_WASM void copyFrom(const AudioBus &srcAudioBus)
Copies another AudioBus instance.