FLTK logo

Re: [fltk/fltk] Let beep use system default settings (#243)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Let beep use system default settings (#243) Albrecht Schlosser Jun 25, 2021  
 

That all said, what can we do?

One possible solution would be to do as you (the OP, @lwi) suggested for FL_BEEP_ERROR which should obviously be the loudest beep generated by fl_beep() - as intended by the original author(s). Setting the value to 0 as proposed would honor the user setting which is IMHO good behavior.

But then we'd need to set all other values to a lower volume level which means we need to use a negative value in XBell(), for instance:

  • FL_BEEP_DEFAULT: either 0 (same as FL_BEEP_ERROR) or a slightly lower value like -10 or -20
  • all others: a value lower than FL_BEEP_DEFAULT, maybe FL_BEEP_DEFAULT - 10 or FL_BEEP_DEFAULT - 20

What do you think about such a modified solution?

Here's a possible implementation (file src/drivers/X11/Fl_X11_Screen_Driver.cxx, lines 412-428):

void Fl_X11_Screen_Driver::beep(int type)
{
  int vol = 0;
  switch (type) {
    case FL_BEEP_ERROR :
      vol = 0;
      break;
    case FL_BEEP_DEFAULT :
      vol = -10;
      break;
    default :
      vol = -20;
      break;
  }
  if (!fl_display) open_display();
  XBell(fl_display, vol);
}

As I wrote before I can't test this currently because I don't hear any sound when using fl_beep() on my system. Would you be willing to test this on your system? Note that you can copy and paste this code to try it on your system.

Thanks in advance.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.