Changeset View
Changeset View
Standalone View
Standalone View
src/audiowrapper.h
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 72 | Q_PROPERTY(bool seekable | |||
---|---|---|---|---|---|
73 | READ seekable | 73 | READ seekable | ||
74 | NOTIFY seekableChanged) | 74 | NOTIFY seekableChanged) | ||
75 | 75 | | |||
76 | Q_PROPERTY(QAudio::Role audioRole | 76 | Q_PROPERTY(QAudio::Role audioRole | ||
77 | READ audioRole | 77 | READ audioRole | ||
78 | WRITE setAudioRole | 78 | WRITE setAudioRole | ||
79 | NOTIFY audioRoleChanged) | 79 | NOTIFY audioRoleChanged) | ||
80 | 80 | | |||
81 | Q_PROPERTY(ReplayGainSetting replayGainMode | ||||
82 | READ replayGainMode | ||||
83 | WRITE setReplayGainMode | ||||
84 | NOTIFY replayGainModeChanged) | ||||
85 | | ||||
81 | public: | 86 | public: | ||
82 | 87 | | |||
88 | enum ReplayGainSetting { | ||||
89 | NoReplayGain, | ||||
90 | ReplayGainAlbum, | ||||
91 | ReplayGainTrack, | ||||
92 | }; | ||||
93 | | ||||
94 | Q_ENUM(ReplayGainSetting) | ||||
95 | | ||||
83 | explicit AudioWrapper(QObject *parent = nullptr); | 96 | explicit AudioWrapper(QObject *parent = nullptr); | ||
84 | 97 | | |||
85 | ~AudioWrapper() override; | 98 | ~AudioWrapper() override; | ||
86 | 99 | | |||
87 | bool muted() const; | 100 | bool muted() const; | ||
88 | 101 | | |||
89 | qreal volume() const; | 102 | qreal volume() const; | ||
90 | 103 | | |||
91 | QUrl source() const; | 104 | QUrl source() const; | ||
92 | 105 | | |||
93 | QMediaPlayer::MediaStatus status() const; | 106 | QMediaPlayer::MediaStatus status() const; | ||
94 | 107 | | |||
95 | QMediaPlayer::State playbackState() const; | 108 | QMediaPlayer::State playbackState() const; | ||
96 | 109 | | |||
97 | QMediaPlayer::Error error() const; | 110 | QMediaPlayer::Error error() const; | ||
98 | 111 | | |||
99 | qint64 duration() const; | 112 | qint64 duration() const; | ||
100 | 113 | | |||
101 | qint64 position() const; | 114 | qint64 position() const; | ||
102 | 115 | | |||
103 | bool seekable() const; | 116 | bool seekable() const; | ||
104 | 117 | | |||
105 | QAudio::Role audioRole() const; | 118 | QAudio::Role audioRole() const; | ||
106 | 119 | | |||
120 | ReplayGainSetting replayGainMode() const; | ||||
121 | | ||||
107 | Q_SIGNALS: | 122 | Q_SIGNALS: | ||
108 | 123 | | |||
109 | void mutedChanged(bool muted); | 124 | void mutedChanged(bool muted); | ||
110 | 125 | | |||
111 | void volumeChanged(); | 126 | void volumeChanged(); | ||
112 | 127 | | |||
113 | void sourceChanged(); | 128 | void sourceChanged(); | ||
114 | 129 | | |||
Show All 14 Lines | |||||
129 | void playing(); | 144 | void playing(); | ||
130 | 145 | | |||
131 | void paused(); | 146 | void paused(); | ||
132 | 147 | | |||
133 | void stopped(); | 148 | void stopped(); | ||
134 | 149 | | |||
135 | void audioRoleChanged(); | 150 | void audioRoleChanged(); | ||
136 | 151 | | |||
152 | void replayGainModeChanged(); | ||||
153 | | ||||
137 | public Q_SLOTS: | 154 | public Q_SLOTS: | ||
138 | 155 | | |||
139 | void setMuted(bool muted); | 156 | void setMuted(bool muted); | ||
140 | 157 | | |||
141 | void setVolume(qreal volume); | 158 | void setVolume(qreal volume); | ||
142 | 159 | | |||
143 | void setSource(const QUrl &source); | 160 | void setSource(const QUrl &source); | ||
144 | 161 | | |||
145 | void setPosition(qint64 position); | 162 | void setPosition(qint64 position); | ||
146 | 163 | | |||
147 | void saveUndoPosition(qint64 position); | 164 | void saveUndoPosition(qint64 position); | ||
148 | 165 | | |||
149 | void restoreUndoPosition(); | 166 | void restoreUndoPosition(); | ||
150 | 167 | | |||
151 | void play(); | 168 | void play(); | ||
152 | 169 | | |||
153 | void pause(); | 170 | void pause(); | ||
154 | 171 | | |||
155 | void stop(); | 172 | void stop(); | ||
156 | 173 | | |||
157 | void seek(qint64 position); | 174 | void seek(qint64 position); | ||
158 | 175 | | |||
159 | void setAudioRole(QAudio::Role audioRole); | 176 | void setAudioRole(QAudio::Role audioRole); | ||
160 | 177 | | |||
178 | void setReplayGainMode(AudioWrapper::ReplayGainSetting mode); | ||||
179 | | ||||
161 | private Q_SLOTS: | 180 | private Q_SLOTS: | ||
162 | 181 | | |||
163 | void mediaStatusChanged(); | 182 | void mediaStatusChanged(); | ||
164 | 183 | | |||
165 | void playerStateChanged(); | 184 | void playerStateChanged(); | ||
166 | 185 | | |||
167 | void playerMutedChanged(); | 186 | void playerMutedChanged(); | ||
168 | 187 | | |||
Show All 13 Lines | 190 | private: | |||
182 | void playerPositionSignalChanges(qint64 newPosition); | 201 | void playerPositionSignalChanges(qint64 newPosition); | ||
183 | 202 | | |||
184 | void playerVolumeSignalChanges(); | 203 | void playerVolumeSignalChanges(); | ||
185 | 204 | | |||
186 | void playerMutedSignalChanges(bool isMuted); | 205 | void playerMutedSignalChanges(bool isMuted); | ||
187 | 206 | | |||
188 | void playerSeekableSignalChanges(bool isSeekable); | 207 | void playerSeekableSignalChanges(bool isSeekable); | ||
189 | 208 | | |||
209 | void resetVlcLayer(); | ||||
210 | | ||||
190 | friend class AudioWrapperPrivate; | 211 | friend class AudioWrapperPrivate; | ||
191 | 212 | | |||
192 | std::unique_ptr<AudioWrapperPrivate> d; | 213 | std::unique_ptr<AudioWrapperPrivate> d; | ||
193 | 214 | | |||
194 | }; | 215 | }; | ||
195 | 216 | | |||
196 | #endif // AUDIOWRAPPER_H | 217 | #endif // AUDIOWRAPPER_H |