ScummVM API documentation
sound_object.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef BAGEL_BAGLIB_SOUND_OBJECT_H
24#define BAGEL_BAGLIB_SOUND_OBJECT_H
25
26#include "bagel/spacebar/baglib/object.h"
27#include "bagel/spacebar/baglib/bagel.h"
28#include "bagel/boflib/sound.h"
29
30namespace Bagel {
31namespace SpaceBar {
32
37private:
38 static CBofSound *_pMidiSound; // There is only one allowed at a time
39 CBofSound *_pSound;
40
41 uint16 _wFlags;
42 int _nLoops;
43 byte _nVol;
44
45protected:
46 byte _bWait;
47
48public:
50 virtual ~CBagSoundObject();
51 static void initialize();
52
53 void killSound();
54 void newSound(CBofWindow *pWin);
55
56 // Return true if the Object had members that are properly initialized/de-initialized
57 ErrorCode attach() override {
58 return attach((CBofWindow *)CBagel::getBagApp()->getMasterWnd());
59 }
60 ErrorCode attach(CBofWindow *pWnd);
61 bool isAttached() override {
62 return _pSound != nullptr;
63 }
64 ErrorCode detach() override;
65
66 CBofSound *getLastMidi() {
67 return _pMidiSound;
68 }
69
70 CBofSound *getSound() {
71 return _pSound;
72 }
73
74 void setWave() {
75 _wFlags = SOUND_WAVE;
76 }
77 void setMidi() {
78 _wFlags = (SOUND_MIDI | SOUND_LOOP);
79 }
80
81 // Gives ability to sound over certain sounds
82 void setSoundOver() {
83 _wFlags |= SOUND_OVEROK;
84 }
85
86 void setSync(bool b = true);
87 void setASync(bool b = true) {
88 setSync(!b);
89 }
90 bool isSync() {
91 return _wFlags & SOUND_ASYNCH;
92 }
93
94 void setMix() {
95 _wFlags = SOUND_MIX;
96 }
97 void setQueue(bool b = true);
98
99 bool runObject() override;
100
101 void setVolume(int nVol);
102 int getVolume();
103
104 void setNumOfLoops(int n);
105
106 int getProperty(const CBofString &sProp) override;
107 void setProperty(const CBofString &sProp, int nVal) override;
108
113 ParseCodes setInfo(CBagIfstream &istr) override;
114
115 // Added properties to sound object
116 bool isPlaying();
117 bool isQueued();
118
119 void setPlaying(bool bVal = true);
120};
121
122} // namespace SpaceBar
123} // namespace Bagel
124
125#endif
Definition: sound.h:77
Definition: string.h:38
Definition: ifstream.h:32
Definition: object.h:86
Definition: sound_object.h:36
ParseCodes setInfo(CBagIfstream &istr) override
Definition: window.h:53