[hatari-devel] change in crossbar.c

npomarede at corp.free.fr npomarede at corp.free.fr
Thu Feb 18 23:35:26 CET 2010


Hello eero, I see you modified crossbar.c :

  		switch (crossbar.codecInputSource) {
-			case 0:
-				/* No sound */
-				dac_LeftData  = 0;
-				dac_RightData = 0;
-				break;
  			case 1:
  				/* direct ADC->DAC sound only */
  				dac_LeftData = adc_leftData;
@@ -1715,6 +1710,11 @@
  					dac_RightData = adc_rightData;
  				}
  				break;
+			default:
+				/* No sound */
+				dac_LeftData  = 0;
+				dac_RightData = 0;
+				break;


But in order to explicitly keep the original values 0,1,2 and 3 of 
laurent's code, I think it might be better to keep "case 0" and add for 
example ;

         Sint16 adc_leftData, adc_rightData, dac_LeftData=0, dac_RightData=0;


Because if the compiler doesn't know valid values are only 0-3, if someone 
looks at the code, it's not clear what the default case is doing now 
(without looking at other parts of the code to see what values could be 
take by codecInputSource and that default now means "0")

More generally, I'm not sure it's a good idea to correct someone else's 
code while he's working on it ; there're might be some compilers warning 
during that time, but we can discuss them later on the list and see how to 
remove them before we do an official release.

Regards

Nicolas



More information about the hatari-devel mailing list