diff options
author | Colin Snover | 2017-09-24 01:47:37 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-24 22:56:57 -0500 |
commit | 21337e4cf63fa1c4248bbb2b6173f121a126fed8 (patch) | |
tree | b4ec5f887226e0df01cb80d767002478c66115d3 /engines/sci/sound | |
parent | d9dfca2fcbe89d3d5e783599466a1a5db6f3dc87 (diff) | |
download | scummvm-rg350-21337e4cf63fa1c4248bbb2b6173f121a126fed8.tar.gz scummvm-rg350-21337e4cf63fa1c4248bbb2b6173f121a126fed8.tar.bz2 scummvm-rg350-21337e4cf63fa1c4248bbb2b6173f121a126fed8.zip |
SCI32: Implement per-channel audio panning
Used by RAMA, in various places, starting with the refrigerator
at base camp after the cable car at the beginning of the game.
Diffstat (limited to 'engines/sci/sound')
-rw-r--r-- | engines/sci/sound/audio32.cpp | 21 | ||||
-rw-r--r-- | engines/sci/sound/audio32.h | 10 |
2 files changed, 31 insertions, 0 deletions
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index 2f30f7dd79..2f7338ea63 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -1312,6 +1312,27 @@ void Audio32::kernelLoop(const int argc, const reg_t *const argv) { setLoop(channelIndex, loop); } +void Audio32::kernelPan(const int argc, const reg_t *const argv) { + Common::StackLock lock(_mutex); + + const int16 channelIndex = findChannelByArgs(argc, argv, 1, argc == 3 ? argv[2] : NULL_REG); + const int16 pan = argv[0].toSint16(); + if (channelIndex != kNoExistingChannel) { + setPan(channelIndex, pan); + } else { + warning("Attempt to pan a channel that does not exist"); + } +} + +void Audio32::kernelPanOff(const int argc, const reg_t *const argv) { + Common::StackLock lock(_mutex); + + const int16 channelIndex = findChannelByArgs(argc, argv, 0, argc == 2 ? argv[1] : NULL_REG); + if (channelIndex != kNoExistingChannel) { + setPan(channelIndex, -1); + } +} + #pragma mark - #pragma mark Debugging diff --git a/engines/sci/sound/audio32.h b/engines/sci/sound/audio32.h index 8b8ec2a6b5..71f5883541 100644 --- a/engines/sci/sound/audio32.h +++ b/engines/sci/sound/audio32.h @@ -508,6 +508,14 @@ public: setLoop(findChannelById(resourceId, soundNode), loop); } + /** + * Sets the stereo panning for the given channel. + */ + void setPan(const int16 channelIndex, const int16 pan) { + Common::StackLock lock(_mutex); + getChannel(channelIndex).pan = pan; + } + private: /** * The tick when audio was globally paused. @@ -644,6 +652,8 @@ public: reg_t kernelMixing(const int argc, const reg_t *const argv); reg_t kernelFade(const int argc, const reg_t *const argv); void kernelLoop(const int argc, const reg_t *const argv); + void kernelPan(const int argc, const reg_t *const argv); + void kernelPanOff(const int argc, const reg_t *const argv); #pragma mark - #pragma mark Debugging |