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
  • structure
soundclip.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#ifndef SOUNDCLIP_H
19#define SOUNDCLIP_H
20
21#include <memory>
22#include "keyframe.h"
23
24class SoundPlayer;
25
26class SoundClip : public KeyFrame
27{
28public:
29 explicit SoundClip();
30 explicit SoundClip(const SoundClip&);
31 ~SoundClip() override;
32 SoundClip& operator=(const SoundClip& a);
33
34 SoundClip* clone() const override;
35
36 Status init(const QString& strSoundFile);
37 bool isValid() const;
38
39 void setSoundClipName(const QString& sName) { mOriginalSoundClipName = sName; }
40 QString soundClipName() const { return mOriginalSoundClipName; }
41
42 void attachPlayer(SoundPlayer* player);
43 void detachPlayer();
44 SoundPlayer* player() const { return mPlayer.get(); }
45
46 void play();
47 void playFromPosition(int frameNumber, int fps);
48 void pause();
49 void stop();
50
51 int64_t duration() const;
52 void setDuration(const int64_t& duration);
53
54 void updateLength(int fps);
55
56private:
57 std::shared_ptr<SoundPlayer> mPlayer;
58
59 QString mOriginalSoundClipName;
60
61 // Duration in seconds.
62 // This is stored to update the length of the frame when the FPS changes.
63 int64_t mDuration = 0;
64};
65
66#endif // SOUNDCLIP_H
KeyFrame
Definition: keyframe.h:30
SoundClip
Definition: soundclip.h:27
SoundPlayer
Definition: soundplayer.h:30
Status
Definition: pencilerror.h:40
QString
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39