Sound: implement reInitCmd (initNoInterp only for now)

This commit is contained in:
Iliyas Jorio 2021-03-17 20:29:58 +01:00
parent b3393c89f6
commit de0725ae16
1 changed files with 11 additions and 1 deletions

View File

@ -146,6 +146,12 @@ public:
source.Clear();
}
void SetInitializationParameters(long initBits)
{
interpolate = !(initBits & initNoInterp);
source.SetInterpolation(interpolate);
}
void ApplyParametersToSource(uint32_t mask, bool evenIfInactive = false)
{
if (!evenIfInactive && !source.active)
@ -343,7 +349,7 @@ OSErr SndNewChannel(SndChannelPtr* macChanPtr, short synth, long init, SndCallBa
(**macChanPtr).callBack = userRoutine;
auto channelImpl = new ChannelImpl(*macChanPtr, transferMacChannelOwnership);
channelImpl->interpolate = !(init & initNoInterp);
channelImpl->SetInitializationParameters(init);
//---------------------------
// Done
@ -579,6 +585,10 @@ OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand* cmd)
impl.ApplyParametersToSource(kApplyParameters_Pitch);
break;
case reInitCmd:
impl.SetInitializationParameters(cmd->param2);
break;
case pommeSetLoopCmd:
impl.loop = cmd->param1;
impl.ApplyParametersToSource(kApplyParameters_Loop);