diff options
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 |