From: <st...@us...> - 2003-06-11 16:54:54
|
Update of /cvsroot/iaxclient/iaxclient/simpleclient/wx In directory sc8-pr-cvs1:/tmp/cvs-serv29319 Modified Files: wx.cc Log Message: Add separate "silence suppression" menu check-item. Make silence suppression and PTT work together. Get actual check state from event, instead of just toggling. Index: wx.cc =================================================================== RCS file: /cvsroot/iaxclient/iaxclient/simpleclient/wx/wx.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- wx.cc 11 Jun 2003 16:39:03 -0000 1.23 +++ wx.cc 11 Jun 2003 16:54:49 -0000 1.24 @@ -48,7 +48,7 @@ ID_PTT = 300, ID_MUTE, - ID_SUPPRESS, + ID_SILENCE, CALLBACK_STATUS = 1000, CALLBACK_LEVELS, @@ -80,7 +80,8 @@ void IAXFrame::OnDial(wxEvent &evt); void IAXFrame::OnHangup(wxEvent &evt); void IAXFrame::OnQuit(wxEvent &evt); - void IAXFrame::OnPTTChange(wxEvent &evt); + void IAXFrame::OnPTTChange(wxCommandEvent &evt); + void IAXFrame::OnSilenceChange(wxCommandEvent &evt); void IAXFrame::OnNotify(void); bool IAXFrame::GetPTTState(); @@ -95,6 +96,7 @@ bool pttMode; // are we in PTT mode? bool pttState; // is the PTT button pressed? + bool silenceMode; // are we in silence suppression mode? // values set by callbacks int inputLevel; @@ -174,6 +176,7 @@ wxMenu *optionsMenu = new wxMenu(); optionsMenu->AppendCheckItem(ID_PTT, _T("Enable &Push to Talk\tCtrl-P")); + optionsMenu->AppendCheckItem(ID_SILENCE, _T("Enable &Silence Suppression\tCtrl-S")); wxMenuBar *menuBar = new wxMenuBar(); @@ -317,21 +320,37 @@ exit(0); } -void IAXFrame::OnPTTChange(wxEvent &evt) +void IAXFrame::OnPTTChange(wxCommandEvent &evt) { - // XXX get the actual state! - pttMode = !pttMode; + pttMode = evt.IsChecked(); if(pttMode) { SetPTT(GetPTTState()); } else { SetPTT(true); - iaxc_set_silence_threshold(DEFAULT_SILENCE_THRESHOLD); + if(silenceMode) { + iaxc_set_silence_threshold(DEFAULT_SILENCE_THRESHOLD); + } else { + iaxc_set_silence_threshold(-99); + } iaxc_set_audio_output(0); // unmute output muteState->SetLabel("PTT Disabled"); } } +void IAXFrame::OnSilenceChange(wxCommandEvent &evt) +{ + // XXX get the actual state! + silenceMode = evt.IsChecked(); + + if(pttMode) return; + + if(silenceMode) { + iaxc_set_silence_threshold(DEFAULT_SILENCE_THRESHOLD); + } else { + iaxc_set_silence_threshold(-99); + } +} BEGIN_EVENT_TABLE(IAXFrame, wxFrame) EVT_BUTTON(0,IAXFrame::OnDTMF) @@ -351,8 +370,7 @@ EVT_MENU(ID_QUIT,IAXFrame::OnQuit) EVT_MENU(ID_PTT,IAXFrame::OnPTTChange) - - EVT_MENU(ID_PTT,IAXFrame::OnPTTChange) + EVT_MENU(ID_SILENCE,IAXFrame::OnSilenceChange) END_EVENT_TABLE() |