@@ -421,39 +421,16 @@ void SetCart(unsigned char cart)
421421
422422unsigned int GetDACSample (void )
423423{
424- static unsigned int RetVal = 0 ;
425- static unsigned short SampleLeft = 0 ,SampleRight = 0 ,PakSample = 0 ;
426- static unsigned short OutLeft = 0 ,OutRight = 0 ;
427- static unsigned short LastLeft = 0 ,LastRight = 0 ;
428- PakSample = PackAudioSample ();
429- SampleLeft = (PakSample >>8 )+ Asample + Ssample ;
430- SampleRight = (PakSample & 0xFF )+ Asample + Ssample ; //9 Bits each
431- SampleLeft = SampleLeft <<6 ; //Conver to 16 bit values
432- SampleRight = SampleRight <<6 ; //For Max volume
433- if (SampleLeft == LastLeft ) //Simulate a slow high pass filter
434- {
435- if (OutLeft )
436- OutLeft -- ;
437- }
438- else
439- {
440- OutLeft = SampleLeft ;
441- LastLeft = SampleLeft ;
442- }
443-
444- if (SampleRight == LastRight )
445- {
446- if (OutRight )
447- OutRight -- ;
448- }
449- else
450- {
451- OutRight = SampleRight ;
452- LastRight = SampleRight ;
453- }
454-
455- RetVal = (OutLeft <<16 )+ (OutRight );
456- return (RetVal );
424+ auto pakSample = PackAudioSample ();
425+ auto pakLeft = pakSample >> 8 ;
426+ auto pakRight = pakSample & 0xFF ;
427+ auto dacSample = Asample ;
428+ auto bitSample = Ssample ;
429+ auto left = (pakLeft + dacSample + bitSample ) << 7 ;
430+ auto right = (pakRight + dacSample + bitSample ) << 7 ;
431+ // removed previous "slow high pass filter" that
432+ // destroys daggorath's proper heartbeat sound -ca 2025-06-02
433+ return (left << 16 ) | (right & 0xFFFF );
457434}
458435
459436unsigned char SetCartAutoStart (unsigned char Tmp )
0 commit comments