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
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5
Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; version 2 of the License.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU 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
24
class
SoundPlayer
;
25
26
class
SoundClip
:
public
KeyFrame
27
{
28
public
:
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
56
private
:
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