]> Shamusworld >> Repos - thunder/blobdiff - src/psg.cpp
Code cleanup, final fix for sprite lag problem.
[thunder] / src / psg.cpp
index 5d6e6693101fabae7981911dd16dd0826e39600a..ec849c5d8d1cbed2c1f40587e71c0edcef333817 100644 (file)
 //
 // Notes:
 // ------
-// The emulator creates signed 16-bit samples. Make sure there's enough room in
-// your buffer for them!
+// The emulator creates signed 16-bit samples.  Make sure there's enough room
+// in your buffer for them!
 //
 
 #include "psg.h"
 #include <stdio.h>
 #include <string.h>
 
-
 struct Voice
 {
        uint8_t leftVolume;
@@ -37,11 +36,9 @@ struct Voice
 
 static Voice voice[8];
 static uint8_t memory[0x200];
-//static 
 static uint32_t sampleRate = 44100;
 static uint32_t divisor;
 
-
 void InitPSG(uint32_t s/*=44100*/)
 {
        sampleRate = s;
@@ -52,10 +49,9 @@ void InitPSG(uint32_t s/*=44100*/)
                voice[i].noiseSeed = 1;
 }
 
-
 //
-// Note that it doesn't wipe out the buffer passed in, if you want it wiped,
-// you have to wipe it yourself. :-)
+// Note that it doesn't wipe out the buffer passed in; if you want it wiped,
+// you have to wipe it yourself.  :-)
 //
 void UpdatePSG(uint8_t * buffer, int count)
 {
@@ -137,7 +133,6 @@ if F == 22050, then counter += 0.5 for each sample.
        }
 }
 
-
 void WritePSG(uint16_t address, uint8_t data)
 {
        if ((address >= 0x100) && (address <= 0x13F))
@@ -154,7 +149,7 @@ void WritePSG(uint16_t address, uint8_t data)
                                break;
                        case 1:
                                voice[channel].waveform = data >> 4;
-                               voice[channel].frequency = ((data & 0x0F) << 16) 
+                               voice[channel].frequency = ((data & 0x0F) << 16)
                                        | (voice[channel].frequency & 0x0FFFF);
 #if 0
 printf("PSG: Setting waveform on channel %i to %i...\n", channel, voice[channel].waveform);
@@ -202,9 +197,7 @@ if (data & 0x0F)
        memory[address & 0x01FF] = data;
 }
 
-
 uint8_t ReadPSG(uint16_t address)
 {
        return memory[address & 0x01FF];
 }
-