2012-10-13 08:09:56 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-02-20 18:22:13 +00:00
|
|
|
#ifndef NANCY_SOUND_H
|
|
|
|
#define NANCY_SOUND_H
|
2012-10-13 08:09:56 +00:00
|
|
|
|
2021-01-23 15:21:56 +00:00
|
|
|
#include "audio/mixer.h"
|
|
|
|
|
2012-10-13 08:09:56 +00:00
|
|
|
namespace Common {
|
|
|
|
class SeekableReadStream;
|
|
|
|
}
|
|
|
|
|
2015-06-16 13:32:57 +00:00
|
|
|
namespace Audio {
|
2012-10-14 20:52:51 +00:00
|
|
|
class SeekableAudioStream;
|
2015-06-16 13:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Nancy {
|
2012-10-13 08:09:56 +00:00
|
|
|
|
2021-01-23 15:21:56 +00:00
|
|
|
class NancyEngine;
|
2021-03-25 23:17:07 +00:00
|
|
|
struct SoundDescription;
|
2021-01-23 15:21:56 +00:00
|
|
|
|
|
|
|
class SoundManager {
|
|
|
|
public:
|
2021-03-19 16:37:20 +00:00
|
|
|
SoundManager();
|
|
|
|
~SoundManager();
|
2021-01-23 15:21:56 +00:00
|
|
|
|
2021-03-19 16:37:20 +00:00
|
|
|
// Load a sound into a channel without starting it
|
|
|
|
void loadSound(const SoundDescription &description);
|
2021-02-20 18:22:13 +00:00
|
|
|
|
2021-03-19 16:37:20 +00:00
|
|
|
void playSound(uint16 channelID);
|
|
|
|
void playSound(const SoundDescription &description);
|
2021-03-13 15:16:02 +00:00
|
|
|
|
2021-03-19 16:37:20 +00:00
|
|
|
void pauseSound(uint16 channelID, bool pause);
|
|
|
|
void pauseSound(const SoundDescription &description, bool pause);
|
2021-03-13 15:16:02 +00:00
|
|
|
|
2021-03-20 17:52:39 +00:00
|
|
|
bool isSoundPlaying(uint16 channelID) const;
|
|
|
|
bool isSoundPlaying(const SoundDescription &description) const;
|
2021-03-13 15:16:02 +00:00
|
|
|
|
2021-03-19 16:37:20 +00:00
|
|
|
void stopSound(uint16 channelID);
|
|
|
|
void stopSound(const SoundDescription &description);
|
|
|
|
void stopAllSounds();
|
2021-01-23 15:21:56 +00:00
|
|
|
|
2021-03-19 16:37:20 +00:00
|
|
|
// Used when changing scenes
|
|
|
|
void stopAndUnloadSpecificSounds();
|
|
|
|
|
|
|
|
static Audio::SeekableAudioStream *makeHISStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
|
2021-02-20 18:22:13 +00:00
|
|
|
|
|
|
|
protected:
|
2021-03-19 16:37:20 +00:00
|
|
|
struct Channel {
|
|
|
|
Common::String name;
|
|
|
|
Audio::Mixer::SoundType type;
|
|
|
|
uint16 numLoops = 0;
|
|
|
|
uint volume = 0;
|
|
|
|
Audio::SeekableAudioStream *stream = nullptr;
|
|
|
|
Audio::SoundHandle handle;
|
|
|
|
};
|
|
|
|
|
|
|
|
void initSoundChannels();
|
|
|
|
Audio::Mixer *_mixer;
|
|
|
|
|
|
|
|
Channel _channels[32];
|
2021-01-23 15:21:56 +00:00
|
|
|
};
|
|
|
|
|
2012-10-13 08:09:56 +00:00
|
|
|
} // End of namespace Nancy
|
|
|
|
|
2021-02-20 18:22:13 +00:00
|
|
|
#endif // NANCY_SOUND_H
|