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