10 struct SourceGroupProps
{
14 SourceGroupProps() : mGain(1.0f
), mPitch(1.0f
) { }
17 class SourceGroupImpl
: SourceGroupProps
{
18 ContextImpl
*const mContext
;
20 Vector
<SourceImpl
*> mSources
;
21 Vector
<SourceGroupImpl
*> mSubGroups
;
23 SourceGroupProps mParentProps
;
24 SourceGroupImpl
*mParent
;
28 void applyPropTree(SourceGroupProps
&props
) const
31 props
.mPitch
*= mPitch
;
33 mParent
->applyPropTree(props
);
36 void update(ALfloat gain
, ALfloat pitch
);
38 void setParentGroup(SourceGroupImpl
*group
);
39 void unsetParentGroup();
41 void eraseSubGroup(SourceGroupImpl
*group
);
43 bool findInSubGroups(SourceGroupImpl
*group
) const;
45 void collectPlayingSourceIds(Vector
<ALuint
> &sourceids
) const;
46 void updatePausedStatus() const;
48 void collectPausedSourceIds(Vector
<ALuint
> &sourceids
) const;
49 void updatePlayingStatus() const;
51 void collectSourceIds(Vector
<ALuint
> &sourceids
) const;
52 void updateStoppedStatus() const;
55 SourceGroupImpl(ContextImpl
*context
, String name
)
56 : mContext(context
), mParent(nullptr), mName(std::move(name
))
59 ALfloat
getAppliedGain() const { return mGain
* mParentProps
.mGain
; }
60 ALfloat
getAppliedPitch() const { return mPitch
* mParentProps
.mPitch
; }
62 void addSource(Source source
);
63 void removeSource(Source source
);
65 void addSources(ArrayView
<Source
> sources
);
66 void removeSources(ArrayView
<Source
> sources
);
68 void addSubGroup(SourceGroup group
);
69 void removeSubGroup(SourceGroup group
);
71 Vector
<Source
> getSources() const;
73 Vector
<SourceGroup
> getSubGroups() const;
75 void setGain(ALfloat gain
);
76 ALfloat
getGain() const { return mGain
; }
78 void setPitch(ALfloat pitch
);
79 ALfloat
getPitch() const { return mPitch
; }
81 void pauseAll() const;
82 void resumeAll() const;
86 const String
&getName() const { return mName
; }
93 #endif /* SOURCEGROUP_H */