mirror of
https://github.com/jorio/Pomme.git
synced 2024-11-27 05:49:18 +00:00
Implement volumeCmd
This commit is contained in:
parent
8fdc27efb0
commit
ca161f6e31
@ -493,10 +493,22 @@ OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand* cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ampCmd:
|
case ampCmd:
|
||||||
impl.source.SetGain(cmd->param1 / 255.0);
|
impl.source.SetGain(cmd->param1 / 256.0);
|
||||||
LOG << "ampCmd " << impl.source.gain << "\n";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case volumeCmd:
|
||||||
|
{
|
||||||
|
uint16_t lvol = (cmd->param2 ) & 0xFFFF;
|
||||||
|
uint16_t rvol = (cmd->param2 >> 16) & 0xFFFF;
|
||||||
|
|
||||||
|
double pan = (double)rvol / (rvol + lvol);
|
||||||
|
pan = (pan - 0.5) * 2.0; // Transpose pan from [0...1] to [-1...+1]
|
||||||
|
|
||||||
|
impl.source.SetPan(pan);
|
||||||
|
impl.source.SetGain(std::max(lvol, rvol) / 256.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case freqCmd:
|
case freqCmd:
|
||||||
LOG << "freqCmd " << cmd->param2 << " " << GetMidiNoteName(cmd->param2) << " " << midiNoteFrequencies[cmd->param2] << "\n";
|
LOG << "freqCmd " << cmd->param2 << " " << GetMidiNoteName(cmd->param2) << " " << midiNoteFrequencies[cmd->param2] << "\n";
|
||||||
impl.playbackNote = Byte(cmd->param2);
|
impl.playbackNote = Byte(cmd->param2);
|
||||||
|
Loading…
Reference in New Issue
Block a user