Ocean
Loading...
Searching...
No Matches
MFSoundMedium.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MEDIA_MF_SOUND_MEDIUM_H
9#define META_OCEAN_MEDIA_MF_SOUND_MEDIUM_H
10
13
14#include "ocean/math/Numeric.h"
15
17
18namespace Ocean
19{
20
21namespace Media
22{
23
24namespace MediaFoundation
25{
26
27/**
28 * This class is the base class for all MediaFoundation sound mediums.
29 * @ingroup mediamf
30 */
31class OCEAN_MEDIA_MF_EXPORT MFSoundMedium :
32 public virtual MFMedium,
33 public virtual SoundMedium
34{
35 public:
36
37 /**
38 * Returns the volume of the sound in db.
39 * @see SoundMedium::soundVolume().
40 */
41 float soundVolume() const override;
42
43 /**
44 * Returns whether the sound medium is in a mute state.
45 * @see SoundMedium::soundMute().
46 */
47 bool soundMute() const override;
48
49 /**
50 * Sets the volume of the sound in db.
51 * @see SoundMedium::setSoundVolume().
52 */
53 bool setSoundVolume(const float volume) override;
54
55 /**
56 * Sets or un-sets the sound medium to a mute state.
57 * @see SoundMedium::setSoundMute().
58 */
59 bool setSoundMute(const bool mute) override;
60
61 /**
62 * Extracts the sound format of a given Media Foundation media type.
63 * @param mediaType Media Foundation media type
64 * @param soundType Resulting sound type
65 * @return True, if succeeded
66 */
67 static bool extractSoundFormat(IMFMediaType* mediaType, SoundType& soundType);
68
69 protected:
70
71 /**
72 * Creates a new sound medium by a given URL.
73 * @param url The URL of the sound medium
74 */
75 explicit MFSoundMedium(const std::string& url);
76
77 /**
78 * Destructs a MFSoundMedium object.
79 */
80 ~MFSoundMedium() override;
81
82 /**
83 * Builds the sound topology of this object.
84 * @return True, if succeeded
85 */
86 virtual bool buildSoundTopology();
87
88 /**
89 * Releases the sound topology of this object.
90 */
91 virtual void releaseSoundTopology();
92
93 protected:
94
95 /// The sound volume before mute state.
96 float nonMuteVolume_ = NumericF::minValue();
97};
98
99}
100
101}
102
103}
104
105#endif // META_OCEAN_MEDIA_MF_SOUND_MEDIUM_H
This is the base class for all MediaFoundation mediums.
Definition MFMedium.h:31
This class is the base class for all MediaFoundation sound mediums.
Definition MFSoundMedium.h:34
bool setSoundMute(const bool mute) override
Sets or un-sets the sound medium to a mute state.
virtual bool buildSoundTopology()
Builds the sound topology of this object.
static bool extractSoundFormat(IMFMediaType *mediaType, SoundType &soundType)
Extracts the sound format of a given Media Foundation media type.
virtual void releaseSoundTopology()
Releases the sound topology of this object.
bool setSoundVolume(const float volume) override
Sets the volume of the sound in db.
~MFSoundMedium() override
Destructs a MFSoundMedium object.
float soundVolume() const override
Returns the volume of the sound in db.
MFSoundMedium(const std::string &url)
Creates a new sound medium by a given URL.
bool soundMute() const override
Returns whether the sound medium is in a mute state.
Definition of a sound type composed by the sound frequency and channels.
Definition SoundMedium.h:50
This class is the base class for all sound mediums.
Definition SoundMedium.h:38
The namespace covering the entire Ocean framework.
Definition Accessor.h:15