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 #pragma once
23 
24 #include "audio/audiostream.h"
25 #include "audio/mixer.h"
26 #include "audio/decoders/raw.h"
27 
28 #include "cryo/cryolib.h"
29 
30 namespace Cryo {
31 
32 class CryoEngine;
33 
35 private:
36  Audio::Mixer *_mixer;
37  Audio::QueuingAudioStream *_audioStream;
38  Audio::SoundHandle _soundHandle;
39  unsigned int _sampleRate;
40  bool _stereo;
41  unsigned int _bufferFlags;
42 
43  void applyVolumeChange();
44 
45 public:
46  CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits = false);
47  ~CSoundChannel();
48 
49  // Queue a new buffer, cancel any previously queued buffers if playNow is set
50  void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true);
51 
52  // Play any queued buffers
53  void play();
54 
55  // Stop playing and purge play queue
56  void stop();
57 
58  // How many buffers in queue (including currently playing one)
59  unsigned int numQueued();
60 
61  // Volume control
62  int _volumeLeft, _volumeRight;
63  unsigned int getVolume();
64  void setVolume(unsigned int volumeLeft, unsigned int volumeRight);
65  void setVolumeLeft(unsigned int volume);
66  void setVolumeRight(unsigned int volume);
67 };
68 
69 }
Definition: sound.h:34
Definition: mixer.h:49
Definition: mixer.h:59
Definition: audiostream.h:370
Definition: cryo.h:41