@@ -351,7 +351,7 @@ static void recalulate_scalers ( void )
351351 scalers_right [8 ] = scalers_right [9 ] = GETMIXFL (0x3C ) * master_right ;
352352 if (XEMU_UNLIKELY (mono_downmix ))
353353 for (int c = 0 ; c < MIXED_CHANNELS ; c ++ )
354- scalers_left [c ] = scalers_right [c ] = (scalers_left [c ] + scalers_right [c ]) / 2 ;
354+ scalers_left [c ] = scalers_right [c ] = (scalers_left [c ] + scalers_right [c ]) / 2.0 ;
355355}
356356
357357
@@ -423,9 +423,10 @@ static void default_mixer_helper ( const int basereg, const Uint16 value_l, cons
423423}
424424
425425
426- static void print_audio_info ( void )
426+ static void print_audio_info ( const char * msg )
427427{
428- DEBUGPRINT ("AUDIO: emu-volume = %d%%, mono-downmix = %s, output-reg-shift = $%02X" NL ,
428+ DEBUGPRINT ("AUDIO: emu-setup [%s] event; emu-volume = %d%%, mono-downmix = %s, output-reg-shift = $%02X" NL ,
429+ msg ? msg : "-" ,
429430 xemu_volume_int ,
430431 mono_downmix ? "ON" : "off" ,
431432 output_selection
@@ -445,6 +446,7 @@ void audio65_reset_mixer ( void )
445446 default_mixer_helper (0x1C , 0xBEBE , 0xBEBE ); // OPL FM! On MEGA65 OPL channel is maybe muted by default, btw ...
446447 default_mixer_helper (0x1E , 0xFFFF , 0xFFFF ); // master volume
447448 recalulate_scalers ();
449+ print_audio_info ("reset-mixer" );
448450}
449451
450452
@@ -461,7 +463,7 @@ void audio65_set_volume ( int vol )
461463{
462464 set_volume (vol );
463465 recalulate_scalers ();
464- print_audio_info ();
466+ print_audio_info ("set-volume" );
465467}
466468
467469
@@ -475,7 +477,7 @@ void audio65_set_mono_downmix ( const bool status )
475477{
476478 mono_downmix = status ;
477479 recalulate_scalers ();
478- print_audio_info ();
480+ print_audio_info ("mono-downmix" );
479481}
480482
481483
@@ -489,7 +491,7 @@ void audio65_set_output ( const int val )
489491{
490492 output_selection = val ;
491493 recalulate_scalers ();
492- print_audio_info ();
494+ print_audio_info ("set-output" );
493495}
494496
495497
@@ -499,6 +501,38 @@ int audio65_get_output ( void )
499501}
500502
501503
504+ #define GETMIXPCNT (n ) (int)(mixer_floats[((n) + output_selection) >> 1] * 100.0)
505+
506+
507+ size_t audio65_get_description ( char * buffer , const size_t buffer_size )
508+ {
509+ const char * output_name ;
510+ switch (output_selection ) {
511+ case AUDIO_OUTPUT_SPEAKERS :
512+ output_name = "HDMI/speakers" ;
513+ break ;
514+ case AUDIO_OUTPUT_HEADPHONES :
515+ output_name = "heaphones" ;
516+ break ;
517+ default :
518+ output_name = "UNKNOWN" ;
519+ break ;
520+ }
521+ return snprintf (
522+ buffer , buffer_size ,
523+ "Sampling: %dHz, emulation volume: %d%%, emulated output: %s\n"
524+ "SIDL L=%03d%% R=%03d%% SIDR L=%03d%% R=%03d%%\n"
525+ "DIGL L=%03d%% R=%03d%% DIGR L=%03d%% R=%03d%%\n"
526+ "OPLFM L=%03d%% R=%03d%% MASTER L=%03d%% R=%03d%%"
527+ ,
528+ system_sound_mix_freq , xemu_volume_int , output_name ,
529+ GETMIXPCNT (0x00 ), GETMIXPCNT (0x20 ), GETMIXPCNT (0x02 ), GETMIXPCNT (0x22 ),
530+ GETMIXPCNT (0x10 ), GETMIXPCNT (0x30 ), GETMIXPCNT (0x12 ), GETMIXPCNT (0x32 ),
531+ GETMIXPCNT (0x1C ), GETMIXPCNT (0x3C ), GETMIXPCNT (0x1E ), GETMIXPCNT (0x3E )
532+ );
533+ }
534+
535+
502536void audio65_init ( int sid_cycles_per_sec , int sound_mix_freq , int volume , unsigned int buffer_size )
503537{
504538 static volatile int initialized = 0 ;
@@ -512,7 +546,6 @@ void audio65_init ( int sid_cycles_per_sec, int sound_mix_freq, int volume, unsi
512546 mono_downmix = false;
513547 set_volume (volume );
514548 audio65_reset_mixer ();
515- print_audio_info ();
516549 for (int i = 0 ; i < NUMBER_OF_SIDS ; i ++ )
517550 UNLOCK_SID ("INIT" , i );
518551 UNLOCK_OPL ("INIT" );
0 commit comments