Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
soundplayer.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6This program is free software; you can redistribute it and/or
7modify it under the terms of the GNU General Public License
8as published by the Free Software Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15*/
16
17#ifndef SOUNDPLAYER_H
18#define SOUNDPLAYER_H
19
20#include <memory>
21#include <QObject>
22#include <QBuffer>
23#include "pencilerror.h"
24#include "keyframe.h"
25
26class SoundClip;
27class QMediaPlayer;
28
29class SoundPlayer : public QObject, public KeyFrameEventListener
30{
31 Q_OBJECT
32public:
33 SoundPlayer();
34 ~SoundPlayer() override;
35
36 void init(SoundClip*);
37 void onKeyFrameDestroy(KeyFrame*) override;
38 bool isValid();
39
40 void play();
41 void pause();
42 void stop();
43
44 int64_t duration();
45 SoundClip* clip() { return mSoundClip; }
46
47 void setMediaPlayerPosition(qint64 pos);
48
49signals:
50 void corruptedSoundFile(SoundClip*);
51 void durationChanged(SoundPlayer*, int64_t duration);
52
53private:
54 void makeConnections();
55
56 SoundClip* mSoundClip = nullptr;
57 QMediaPlayer* mMediaPlayer = nullptr;
58 QBuffer mBuffer;
59};
60
61#endif // SOUNDPLAYER_H
KeyFrameEventListener
Definition: keyframe.h:75
KeyFrame
Definition: keyframe.h:30
SoundClip
Definition: soundclip.h:27
SoundPlayer
Definition: soundplayer.h:30
QBuffer
QObject
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39