Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions PSGlib/src/PSGAttenuation.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ void PSGSetMusicVolumeAttenuation (unsigned char attenuation) {
*/
PSGMusicVolumeAttenuation=attenuation;
if (PSGMusicStatus) {
if (!PSGChannel0SFX)
if (!(PSGChannelSFX & SFX_CHANNEL0))
PSGPort=PSGLatch|PSGChannel0|PSGVolumeData|(((PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation);
if (!PSGChannel1SFX)
if (!(PSGChannelSFX & SFX_CHANNEL1))
PSGPort=PSGLatch|PSGChannel1|PSGVolumeData|(((PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation);
if (!PSGChannel2SFX)
if (!(PSGChannelSFX & SFX_CHANNEL2))
PSGPort=PSGLatch|PSGChannel2|PSGVolumeData|(((PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation);
if (!PSGChannel3SFX)
if (!(PSGChannelSFX & SFX_CHANNEL3))
PSGPort=PSGLatch|PSGChannel3|PSGVolumeData|(((PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation);
}
}
Expand All @@ -30,13 +30,13 @@ void PSGSetSFXVolumeAttenuation (unsigned char attenuation) {
*/
PSGSFXVolumeAttenuation=attenuation;
if (PSGMusicStatus) {
if (PSGChannel0SFX)
if (PSGChannelSFX & SFX_CHANNEL0)
PSGPort=PSGLatch|PSGChannel0|PSGVolumeData|(((PSGSFXChan0Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan0Volume&0x0F)+PSGSFXVolumeAttenuation);
if (PSGChannel1SFX)
if (PSGChannelSFX & SFX_CHANNEL1)
PSGPort=PSGLatch|PSGChannel1|PSGVolumeData|(((PSGSFXChan1Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan1Volume&0x0F)+PSGSFXVolumeAttenuation);
if (PSGChannel2SFX)
if (PSGChannelSFX & SFX_CHANNEL2)
PSGPort=PSGLatch|PSGChannel2|PSGVolumeData|(((PSGSFXChan2Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan2Volume&0x0F)+PSGSFXVolumeAttenuation);
if (PSGChannel3SFX)
if (PSGChannelSFX & SFX_CHANNEL3)
PSGPort=PSGLatch|PSGChannel3|PSGVolumeData|(((PSGSFXChan3Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan3Volume&0x0F)+PSGSFXVolumeAttenuation);
}
}
Expand Down
8 changes: 4 additions & 4 deletions PSGlib/src/PSGRestoreVolumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ void PSGRestoreVolumes (void) {
/* *********************************************************************
restore the PSG channels volumes (if a tune or an SFX uses them!)
*/
if (PSGChannel0SFX)
if (PSGChannelSFX & SFX_CHANNEL0)
PSGPort=PSGLatch|PSGChannel0|PSGVolumeData|(((PSGSFXChan0Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan0Volume&0x0F)+PSGSFXVolumeAttenuation);
else if (PSGMusicStatus)
PSGPort=PSGLatch|PSGChannel0|PSGVolumeData|(((PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation);
if (PSGChannel1SFX)
if (PSGChannelSFX & SFX_CHANNEL1)
PSGPort=PSGLatch|PSGChannel1|PSGVolumeData|(((PSGSFXChan1Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan1Volume&0x0F)+PSGSFXVolumeAttenuation);
else if (PSGMusicStatus)
PSGPort=PSGLatch|PSGChannel1|PSGVolumeData|(((PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation);
if (PSGChannel2SFX)
if (PSGChannelSFX & SFX_CHANNEL2)
PSGPort=PSGLatch|PSGChannel2|PSGVolumeData|(((PSGSFXChan2Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan2Volume&0x0F)+PSGSFXVolumeAttenuation);
else if (PSGMusicStatus)
PSGPort=PSGLatch|PSGChannel2|PSGVolumeData|(((PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation);
if (PSGChannel3SFX)
if (PSGChannelSFX & SFX_CHANNEL3)
PSGPort=PSGLatch|PSGChannel3|PSGVolumeData|(((PSGSFXChan3Volume&0x0F)+PSGSFXVolumeAttenuation>15)?15:(PSGSFXChan3Volume&0x0F)+PSGSFXVolumeAttenuation);
else if (PSGMusicStatus)
PSGPort=PSGLatch|PSGChannel3|PSGVolumeData|(((PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation);
Expand Down
8 changes: 4 additions & 4 deletions PSGlib/src/PSGResume.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ void PSGResume (void) {
resume the previously playing music (also using current attenuation)
*/
if (!PSGMusicStatus) {
if (!PSGChannel0SFX) {
if (!(PSGChannelSFX & SFX_CHANNEL0)) {
PSGPort=PSGLatch|PSGChannel0|(PSGChan0LowTone&0x0F); // restore channel 0 frequency
PSGPort=PSGChan0HighTone&0x3F;
PSGPort=PSGLatch|PSGChannel0|PSGVolumeData|(((PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan0Volume&0x0F)+PSGMusicVolumeAttenuation); // restore channel 0 volume
}
if (!PSGChannel1SFX) {
if (!(PSGChannelSFX & SFX_CHANNEL1)) {
PSGPort=PSGLatch|PSGChannel1|(PSGChan1LowTone&0x0F); // restore channel 1 frequency
PSGPort=PSGChan1HighTone&0x3F;
PSGPort=PSGLatch|PSGChannel1|PSGVolumeData|(((PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan1Volume&0x0F)+PSGMusicVolumeAttenuation); // restore channel 1 volume
}
if (!PSGChannel2SFX) {
if (!(PSGChannelSFX & SFX_CHANNEL2)) {
PSGPort=PSGLatch|PSGChannel2|(PSGChan2LowTone&0x0F); // restore channel 2 frequency
PSGPort=PSGChan2HighTone&0x3F;
PSGPort=PSGLatch|PSGChannel2|PSGVolumeData|(((PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan2Volume&0x0F)+PSGMusicVolumeAttenuation); // restore channel 2 volume
}
if (!PSGChannel3SFX) {
if (!(PSGChannelSFX & SFX_CHANNEL3)) {
PSGPort=PSGLatch|PSGChannel3|(PSGChan3LowTone&0x0F); // restore channel 3 frequency
PSGPort=PSGLatch|PSGChannel3|PSGVolumeData|(((PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation>15)?15:(PSGChan3Volume&0x0F)+PSGMusicVolumeAttenuation); // restore channel 3 volume
}
Expand Down
Loading