[hatari-devel] change in crossbar.c

Laurent Sallafranque laurent.sallafranque at free.fr
Fri Feb 19 00:10:18 CET 2010


Hello,

I'm sorry, I have very few time these days.
so, I prefer uploading small portions of code as soon as I've done 
something instead of uploading a big change at once.

Else, I may beak something and it would be harder to refind the correct 
code.

I'm actually adding the volume control, and I'm removing all the double 
variables (I remplace them by Uint32 *65536 for the decimal part.

I'm also trying to improve the sound rendering by keeping the decimal 
part of the read pointer between each call to the function.

I'm in hollydays next week. I'll have more time to improve the code.

I'll keep the case 0:  default:  code (I like it better than the default 
lonely).

Best regards

Laurent




Eero Tamminen a écrit :
> Hi,
>
> On Friday 19 February 2010, npomarede at corp.free.fr wrote:
>   
>> 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"
>>     
>
> "case 0:" could also be added before "default:".  That keeps
> the old intention and fixes the warning.
>
>
>   
>> and add for example ;
>>
>>          Sint16 adc_leftData, adc_rightData, dac_LeftData=0,
>> dac_RightData=0;
>>     
>
> I think this is less clear and my guess would be that compiler can
> optimize:
> 	case 0:
> 	default:
> better?
>
> Even clearer would be to use a bitfield, but at least with my gcc
> version that didn't get rid of the warning.
>
>
>   
>> 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.
>>     
>
> Usually I mail Laurent patches, but the warning had been there for quite
> a while and the fix "seemed" obvious...
>
>
> 	- Eero
> _______________________________________________
> hatari-devel mailing list
> hatari-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/hatari-devel
>
>
>   




More information about the hatari-devel mailing list