comparison src/gb/gbSound.cpp @ 524:7ef5c73ea8fa

working on recording sound. almost have it, but there is still unexplained popping sounds.
author Robert McIntyre <rlm@mit.edu>
date Sat, 23 Jun 2012 23:10:31 -0500
parents f9f4f1b99eed
children fa7676dbf6f2
comparison
equal deleted inserted replaced
523:d00096b6bf17 524:7ef5c73ea8fa
3 # include "../win32/VBA.h" 3 # include "../win32/VBA.h"
4 #endif 4 #endif
5 5
6 #include <cstring> 6 #include <cstring>
7 #include <cassert> 7 #include <cassert>
8 #include <stdio.h>
8 9
9 #include "../common/System.h" 10 #include "../common/System.h"
10 #include "../common/Util.h" 11 #include "../common/Util.h"
11 //#include "../Blip_Buffer.h" 12 //#include "../Blip_Buffer.h"
12 #include "gbGlobals.h" 13 #include "gbGlobals.h"
727 728
728 if (soundReverse && !noSpecialEffects) 729 if (soundReverse && !noSpecialEffects)
729 { 730 {
730 soundFinalWave[++soundBufferIndex] = res; 731 soundFinalWave[++soundBufferIndex] = res;
731 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound)) 732 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound))
732 /*assert(false)*/; 733 printf("oh noes!\n");
733 else 734 else
734 soundFrameSound[++soundFrameSoundWritten] = res; 735 soundFrameSound[++soundFrameSoundWritten] = res;
735 } 736 }
736 else 737 else
737 { 738 {
738 soundFinalWave[soundBufferIndex++] = res; 739 soundFinalWave[soundBufferIndex++] = res;
739 if (soundFrameSoundWritten >= countof(soundFrameSound)) 740 if (soundFrameSoundWritten >= countof(soundFrameSound))
740 /*assert(false)*/; 741 printf("oh noes!\n");
741 else 742 else
742 soundFrameSound[soundFrameSoundWritten++] = res; 743 soundFrameSound[soundFrameSoundWritten++] = res;
743 } 744 }
744 745
745 res = 0; 746 res = 0;
814 815
815 if (soundReverse && !noSpecialEffects) 816 if (soundReverse && !noSpecialEffects)
816 { 817 {
817 soundFinalWave[-1 + soundBufferIndex++] = res; 818 soundFinalWave[-1 + soundBufferIndex++] = res;
818 if ((soundFrameSoundWritten) >= countof(soundFrameSound)) 819 if ((soundFrameSoundWritten) >= countof(soundFrameSound))
819 /*assert(false)*/; 820 printf("oh noes!\n");
820 else 821 else
821 soundFrameSound[-1 + soundFrameSoundWritten++] = res; 822 soundFrameSound[-1 + soundFrameSoundWritten++] = res;
822 } 823 }
823 else 824 else
824 { 825 {
825 soundFinalWave[soundBufferIndex++] = res; 826 soundFinalWave[soundBufferIndex++] = res;
826 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound)) 827 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound))
827 /*assert(false)*/; 828 printf("oh noes!\n");
828 else 829 else
829 soundFrameSound[soundFrameSoundWritten++] = res; 830 soundFrameSound[soundFrameSoundWritten++] = res;
830 } 831 }
831 } 832 }
832 833
846 else 847 else
847 { 848 {
848 soundFinalWave[soundBufferIndex++] = 0; 849 soundFinalWave[soundBufferIndex++] = 0;
849 soundFinalWave[soundBufferIndex++] = 0; 850 soundFinalWave[soundBufferIndex++] = 0;
850 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound)) 851 if ((soundFrameSoundWritten + 1) >= countof(soundFrameSound))
851 /*assert(false)*/; 852
853 printf("oh noes!\n");
852 else 854 else
853 { 855 {
854 soundFrameSound[soundFrameSoundWritten++] = 0; 856 soundFrameSound[soundFrameSoundWritten++] = 0;
855 soundFrameSound[soundFrameSoundWritten++] = 0; 857 soundFrameSound[soundFrameSoundWritten++] = 0;
856 } 858 }