OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_AudioWorkgroup.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23 namespace juce
24{
25
26//==============================================================================
35 class WorkgroupToken
36{
37 public:
39 class TokenProvider;
40
42 using Erased = FixedSizeFunction<64, const TokenProvider*()>;
43
48 explicit WorkgroupToken (Erased e) : erased (std::move (e)) {}
49
55 WorkgroupToken() = default;
56
60 ~WorkgroupToken() = default;
61
63 WorkgroupToken (const WorkgroupToken&) = delete;
64
65 WorkgroupToken (WorkgroupToken&&) noexcept = default;
66
68 WorkgroupToken& operator= (const WorkgroupToken&) = delete;
69
70 WorkgroupToken& operator= (WorkgroupToken&&) = default;
71
73 explicit operator bool() const { return getTokenProvider() != nullptr; }
74
80 [[nodiscard]] const TokenProvider* getTokenProvider() const { return erased != nullptr ? erased() : nullptr; }
81
86 void reset() { erased = nullptr; }
87
88 private:
89 Erased erased;
90};
91
92//==============================================================================
141 class AudioWorkgroup
142{
143 public:
145 class WorkgroupProvider;
146
148 using Erased = FixedSizeFunction<64, const WorkgroupProvider*()>;
149
154 explicit AudioWorkgroup (Erased e) : erased (std::move (e)) {}
155
157 AudioWorkgroup (AudioWorkgroup&&) = default;
158
160 AudioWorkgroup& operator= (AudioWorkgroup&&) = default;
161
163 AudioWorkgroup (const AudioWorkgroup&);
164
166 AudioWorkgroup& operator= (const AudioWorkgroup& other)
167 {
168 AudioWorkgroup { other }.swap (*this);
169 return *this;
170 }
171
173 AudioWorkgroup() = default;
174
189 void join (WorkgroupToken& token) const;
190
192 bool operator== (const AudioWorkgroup& other) const;
193
195 bool operator!= (const AudioWorkgroup& other) const { return ! operator== (other); }
196
198 explicit operator bool() const;
199
204 void reset() { erased = nullptr; }
205
211 size_t getMaxParallelThreadCount() const;
212
213 private:
214 const WorkgroupProvider* getWorkgroupProvider() const { return erased != nullptr ? erased() : nullptr; }
215
216 void swap (AudioWorkgroup& other) noexcept { std::swap (other.erased, erased); }
217
218 Erased erased;
219};
220
221} // namespace juce
juce::AudioWorkgroup
Definition juce_AudioWorkgroup.h:142
juce::AudioWorkgroup::operator!=
bool operator!=(const AudioWorkgroup &other) const
Definition juce_AudioWorkgroup.h:195
juce::AudioWorkgroup::AudioWorkgroup
AudioWorkgroup(Erased e)
Definition juce_AudioWorkgroup.h:154
juce::AudioWorkgroup::reset
void reset()
Definition juce_AudioWorkgroup.h:204
juce::AudioWorkgroup::operator=
AudioWorkgroup & operator=(AudioWorkgroup &&)=default
juce::AudioWorkgroup::AudioWorkgroup
AudioWorkgroup(AudioWorkgroup &&)=default
juce::AudioWorkgroup::getMaxParallelThreadCount
size_t getMaxParallelThreadCount() const
Definition juce_AudioWorkgroup.cpp:207
juce::AudioWorkgroup::AudioWorkgroup
AudioWorkgroup()=default
juce::AudioWorkgroup::operator==
bool operator==(const AudioWorkgroup &other) const
Definition juce_AudioWorkgroup.cpp:187
juce::AudioWorkgroup::join
void join(WorkgroupToken &token) const
Definition juce_AudioWorkgroup.cpp:192
juce::AudioWorkgroup::Erased
FixedSizeFunction< 64, const WorkgroupProvider *()> Erased
Definition juce_AudioWorkgroup.h:148
juce::WorkgroupToken
Definition juce_AudioWorkgroup.h:36
juce::WorkgroupToken::WorkgroupToken
WorkgroupToken()=default
juce::WorkgroupToken::WorkgroupToken
WorkgroupToken(Erased e)
Definition juce_AudioWorkgroup.h:48
juce::WorkgroupToken::~WorkgroupToken
~WorkgroupToken()=default
juce::WorkgroupToken::reset
void reset()
Definition juce_AudioWorkgroup.h:86
juce::WorkgroupToken::getTokenProvider
const TokenProvider * getTokenProvider() const
Definition juce_AudioWorkgroup.h:80
juce::WorkgroupToken::Erased
FixedSizeFunction< 64, const TokenProvider *()> Erased
Definition juce_AudioWorkgroup.h:42
juce::WorkgroupToken::WorkgroupToken
WorkgroupToken(const WorkgroupToken &)=delete