some warnings fixed, nsf fixed, palettes, more code backported
[fceu.git] / sound.c
diff --git a/sound.c b/sound.c
index 9fb3216..7d56a2d 100644 (file)
--- a/sound.c
+++ b/sound.c
@@ -845,6 +845,7 @@ static void RDoNoise(void)
 
 DECLFW(Write_IRQFM)
 {
+ PSG[0x17]=V;
  V=(V&0xC0)>>6;
  fcnt=0;
  if(V&0x2)
@@ -853,7 +854,7 @@ DECLFW(Write_IRQFM)
  fhcnt=fhinc;
  X6502_IRQEnd(FCEU_IQFCOUNT);
  SIRQStat&=~0x40;
-// IRQFrameMode=V;
+ //IRQFrameMode=V; // IRQFrameMode is PSG[0x17] upper bits
 }
 
 void SetNESSoundMap(void)
@@ -865,7 +866,7 @@ void SetNESSoundMap(void)
   SetReadHandler(0x4015,0x4015,Read_PSG);
 }
 
-static int32 WaveNSF[256];
+static int32 WaveNSF[2048];
 
 int32 highp;                   // 0 through 65536, 0 = no high pass, 65536 = max high pass
 
@@ -951,12 +952,12 @@ int FlushEmulateSound(void)
 //  printf("count %d, num ints %d\n", end, (end >> 4));
   if(FCEUGameInfo.type==GIT_NSF)
   {
-   printf("IS NSF");
-   int x,s=0,si=end/1024;       // Only want 1/4 of the output buffer to be displayed
-   for(x=0;x<256;x++)
+   int x;//,s=0,si=end/1024;
+   for(x=0;x<1024;x++)
    {
-    WaveNSF[x]=WaveFinal[s>>4];
-    s+=si;
+    //WaveNSF[x]=WaveFinal[s>>4];
+    WaveNSF[x]=WaveFinalMono[x];
+    //s+=si;
    }
   }
 
@@ -1072,5 +1073,5 @@ void FCEUI_Sound(int Rate)
 
 void FCEUI_SetSoundVolume(uint32 volume)
 {
- FSettings.SoundVolume=(volume<<16)/100;
+ FSettings.SoundVolume=volume;
 }