libscratchcpp
A library for C++ based Scratch project players
Toggle main menu visibility
Loading...
Searching...
No Matches
sound.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: Apache-2.0
2
3
#pragma once
4
5
#include "spimpl.h"
6
7
#include "
asset.h
"
8
9
namespace
libscratchcpp
10
{
11
12
class
Thread
;
13
class
SoundPrivate;
14
16
class
LIBSCRATCHCPP_EXPORT
Sound
:
public
Asset
17
{
18
public
:
19
enum class
Effect
20
{
21
Pitch,
22
Pan
23
};
24
25
Sound
(
const
std::string &name,
const
std::string &
id
,
const
std::string &format);
26
Sound
(
const
Sound
&) =
delete
;
27
virtual
~Sound
() { }
28
29
int
rate()
const
;
30
void
setRate(
int
newRate);
31
32
int
sampleCount()
const
;
33
void
setSampleCount(
int
newSampleCount);
34
35
virtual
void
setVolume(
double
volume);
36
virtual
void
setEffect(Effect effect,
double
value);
37
38
virtual
void
start(
Thread
*owner =
nullptr
);
39
virtual
void
stop();
40
41
virtual
bool
isPlaying()
const
;
42
43
std::shared_ptr<Sound> clone()
const
;
44
45
Thread
*owner()
const
;
46
47
protected
:
48
void
processData(
unsigned
int
size,
void
*data)
override
;
49
virtual
bool
isClone()
const override
;
50
51
private
:
52
void
stopCloneSounds();
53
54
spimpl::unique_impl_ptr<SoundPrivate> impl;
55
};
56
57
}
// namespace libscratchcpp
asset.h
libscratchcpp::Asset::Asset
Asset(const std::string &name, const std::string &id, const std::string &format)
Definition
asset.cpp:10
libscratchcpp::Sound
The Sound class represents a Scratch sound.
Definition
sound.h:17
libscratchcpp::Sound::~Sound
virtual ~Sound()
Definition
sound.h:27
libscratchcpp::Sound::Sound
Sound(const Sound &)=delete
libscratchcpp::Sound::Effect
Effect
Definition
sound.h:20
libscratchcpp::Sound::Sound
Sound(const std::string &name, const std::string &id, const std::string &format)
Definition
sound.cpp:15
libscratchcpp::Thread
The Thread class represents a running Scratch script.
Definition
thread.h:19
LIBSCRATCHCPP_EXPORT
#define LIBSCRATCHCPP_EXPORT
Definition
global.h:17
libscratchcpp
The main namespace of the library.
Definition
asset.h:10
include
scratchcpp
sound.h
Generated by
1.17.0