ScummVM API documentation
sound.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MEDIASTATION_ACTORS_SOUND_H
23 #define MEDIASTATION_ACTORS_SOUND_H
24 
25 #include "mediastation/actor.h"
26 #include "mediastation/audio.h"
27 #include "mediastation/datafile.h"
28 #include "mediastation/clients.h"
29 #include "mediastation/mediascript/scriptvalue.h"
30 #include "mediastation/mediascript/scriptconstants.h"
31 
32 namespace MediaStation {
33 
34 class SoundActor : public Actor, public ChannelClient, public SoundClient, public ImtDeviceUser {
35 public:
36  SoundActor() : Actor(kActorTypeSound), _sequence(this) {};
37  ~SoundActor();
38 
39  virtual void readParameter(Chunk &chunk, ActorHeaderSectionType paramType) override;
40  virtual ScriptValue callMethod(BuiltInMethod methodId, Common::Array<ScriptValue> &args) override;
41  virtual void readChunk(Chunk &chunk) override;
42  virtual bool isActive() const override { return _playState == kSoundPlayStatePlaying; }
43  virtual bool giveUpDevice() override;
44 
45  virtual void onEvent(const ActorEvent &event) override;
46  virtual void timerEvent(const TimerEvent &event) override;
47  virtual void soundPlayStateChanged(SoundPlayState state, SoundStopReason why) override;
48 
49  void start();
50  void stop();
51  void pause();
52  void resume(bool restart);
53 
54 private:
55  ImtStreamFeed *_streamFeed = nullptr;
56  bool _isLoadedFromChunk = false;
57  bool _discardAfterUse = false;
58  SoundPlayState _playState = kSoundPlayStateStopped;
59  AudioSequence _sequence;
60 
61  void openStream();
62 };
63 
64 } // End of namespace MediaStation
65 
66 #endif
Definition: actor.h:34
Definition: audio.h:50
Definition: datafile.h:196
Definition: datafile.h:99
Definition: datafile.h:160
Definition: events.h:103
Definition: events.h:94
Definition: sound.h:34
Definition: audio.h:56
Definition: clients.h:52
Definition: actor.h:226
Definition: scriptvalue.h:35