@@ -79,13 +79,13 @@ pub struct SoundCnt {
7979 not_used : u1 ,
8080 pub volume_div : u2 ,
8181 not_used1 : u5 ,
82- pub hold : u1 ,
82+ pub hold : bool ,
8383 pub panning : u7 ,
8484 not_used2 : u1 ,
8585 pub wave_duty : u3 ,
8686 pub repeat_mode : u2 ,
8787 pub format : u2 ,
88- pub start_status : u1 ,
88+ pub start_status : bool ,
8989}
9090
9191impl SoundCnt {
@@ -123,10 +123,10 @@ pub struct MainSoundCnt {
123123 not_used : u1 ,
124124 pub left_output_from : u2 ,
125125 pub right_output_from : u2 ,
126- pub output_ch1_to_mixer : u1 ,
127- pub output_ch3_to_mixer : u1 ,
126+ pub output_ch1_to_mixer : bool ,
127+ pub output_ch3_to_mixer : bool ,
128128 not_used2 : u1 ,
129- pub master_enable : u1 ,
129+ pub master_enable : bool ,
130130}
131131
132132#[ derive( Copy , Clone , Default ) ]
@@ -159,12 +159,12 @@ struct AdpcmHeader {
159159#[ bitsize( 8 ) ]
160160#[ derive( FromBits ) ]
161161pub struct SoundCapCnt {
162- pub cnt_associated_channels : u1 ,
163- pub cap_src_select : u1 ,
164- pub cap_repeat : u1 ,
165- pub cap_format : u1 ,
162+ pub cnt_associated_channels : bool ,
163+ pub cap_src_select : bool ,
164+ pub cap_repeat : bool ,
165+ pub cap_format : bool ,
166166 not_used : u3 ,
167- pub cap_start_status : u1 ,
167+ pub cap_start_status : bool ,
168168}
169169
170170pub struct Spu {
@@ -211,7 +211,7 @@ impl Spu {
211211 }
212212
213213 pub fn set_cnt ( & mut self , channel : usize , mut mask : u32 , value : u32 , emu : & mut Emu ) {
214- let was_disabled = !bool :: from ( self . channels [ channel] . cnt . start_status ( ) ) ;
214+ let was_disabled = !self . channels [ channel] . cnt . start_status ( ) ;
215215
216216 mask &= 0xFF7F837F ;
217217 self . channels [ channel] . cnt = ( ( u32:: from ( self . channels [ channel] . cnt ) & !mask) | ( value & mask) ) . into ( ) ;
@@ -222,12 +222,12 @@ impl Spu {
222222 self . channels [ channel] . volume = volume;
223223
224224 if was_disabled
225- && bool :: from ( self . channels [ channel] . cnt . start_status ( ) )
226- && bool :: from ( self . main_sound_cnt . master_enable ( ) )
225+ && self . channels [ channel] . cnt . start_status ( )
226+ && self . main_sound_cnt . master_enable ( )
227227 && ( self . channels [ channel] . sad != 0 || self . channels [ channel] . cnt . get_format ( ) == SoundChannelFormat :: PsgNoise )
228228 {
229229 self . start_channel ( channel, emu) ;
230- } else if !bool :: from ( self . channels [ channel] . cnt . start_status ( ) ) {
230+ } else if !self . channels [ channel] . cnt . start_status ( ) {
231231 self . channels [ channel] . active = false ;
232232 }
233233 }
@@ -237,7 +237,7 @@ impl Spu {
237237 self . channels [ channel] . sad = ( self . channels [ channel] . sad & !mask) | ( value & mask) ;
238238
239239 if self . channels [ channel] . cnt . get_format ( ) != SoundChannelFormat :: PsgNoise {
240- if self . channels [ channel] . sad != 0 && ( bool :: from ( self . main_sound_cnt . master_enable ( ) ) && bool :: from ( self . channels [ channel] . cnt . start_status ( ) ) ) {
240+ if self . channels [ channel] . sad != 0 && ( self . main_sound_cnt . master_enable ( ) && self . channels [ channel] . cnt . start_status ( ) ) {
241241 self . start_channel ( channel, emu) ;
242242 } else {
243243 self . channels [ channel] . active = false ;
@@ -259,7 +259,7 @@ impl Spu {
259259 }
260260
261261 pub fn set_main_sound_cnt ( & mut self , mut mask : u16 , value : u16 , emu : & mut Emu ) {
262- let was_disabled = !bool :: from ( self . main_sound_cnt . master_enable ( ) ) ;
262+ let was_disabled = !self . main_sound_cnt . master_enable ( ) ;
263263
264264 mask &= 0xBF7F ;
265265 self . main_sound_cnt = ( ( u16:: from ( self . main_sound_cnt ) & !mask) | ( value & mask) ) . into ( ) ;
@@ -269,13 +269,13 @@ impl Spu {
269269 }
270270 self . master_volume = volume;
271271
272- if was_disabled && bool :: from ( self . main_sound_cnt . master_enable ( ) ) {
272+ if was_disabled && self . main_sound_cnt . master_enable ( ) {
273273 for i in 0 ..CHANNEL_COUNT {
274- if bool :: from ( self . channels [ i] . cnt . start_status ( ) ) && ( self . channels [ i] . sad != 0 || self . channels [ i] . cnt . get_format ( ) == SoundChannelFormat :: PsgNoise ) {
274+ if self . channels [ i] . cnt . start_status ( ) && ( self . channels [ i] . sad != 0 || self . channels [ i] . cnt . get_format ( ) == SoundChannelFormat :: PsgNoise ) {
275275 self . start_channel ( i, emu) ;
276276 }
277277 }
278- } else if !bool :: from ( self . main_sound_cnt . master_enable ( ) ) {
278+ } else if !self . main_sound_cnt . master_enable ( ) {
279279 for channel in & mut self . channels {
280280 channel. active = false ;
281281 }
@@ -401,7 +401,7 @@ impl Spu {
401401
402402 if unlikely ( !get_spu ! ( emu) . audio_enabled ) {
403403 for i in 0 ..CHANNEL_COUNT {
404- get_channel_mut ! ( emu, i) . cnt . set_start_status ( u1 :: new ( 0 ) ) ;
404+ get_channel_mut ! ( emu, i) . cnt . set_start_status ( false ) ;
405405 }
406406 let spu = get_spu_mut ! ( emu) ;
407407 spu. samples_buffer . push ( 0 ) ;
@@ -466,7 +466,7 @@ impl Spu {
466466 channel. adpcm_toggle = false ;
467467 }
468468 } else {
469- channel. cnt . set_start_status ( u1 :: new ( 0 ) ) ;
469+ channel. cnt . set_start_status ( false ) ;
470470 channel. active = false ;
471471 break ;
472472 }
@@ -492,13 +492,13 @@ impl Spu {
492492 if i == 1 {
493493 channels_left[ 0 ] = data_left;
494494 channels_right[ 0 ] = data_right;
495- if bool :: from ( get_spu ! ( emu) . main_sound_cnt . output_ch1_to_mixer ( ) ) {
495+ if get_spu ! ( emu) . main_sound_cnt . output_ch1_to_mixer ( ) {
496496 continue ;
497497 }
498498 } else if i == 3 {
499499 channels_left[ 1 ] = data_left;
500500 channels_right[ 1 ] = data_right;
501- if bool :: from ( get_spu ! ( emu) . main_sound_cnt . output_ch3_to_mixer ( ) ) {
501+ if get_spu ! ( emu) . main_sound_cnt . output_ch3_to_mixer ( ) {
502502 continue ;
503503 }
504504 }
0 commit comments