From 43e60632b668d08e71f784eb17fda018198f4751 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 11:31:47 +0000 Subject: [PATCH 01/15] improvement: changed to popup rather than lists --- pam2/pnlAoipManual.cpp | 43 ++++++++++------ pam2/pnlAoipManual.h | 6 +-- pam2/pnlSettingsOutput.cpp | 79 ++++++++++++++++++++---------- pam2/pnlSettingsOutput.h | 5 +- pam2/wxsmith/pnlAoipManual.wxs | 24 ++++----- pam2/wxsmith/pnlSettingsOutput.wxs | 69 +++++++++++++------------- 6 files changed, 132 insertions(+), 94 deletions(-) diff --git a/pam2/pnlAoipManual.cpp b/pam2/pnlAoipManual.cpp index 6025e178..4d5ac547 100644 --- a/pam2/pnlAoipManual.cpp +++ b/pam2/pnlAoipManual.cpp @@ -18,7 +18,7 @@ const long pnlAoipManual::ID_M_PLBL2 = wxNewId(); const long pnlAoipManual::ID_M_PBTN6 = wxNewId(); const long pnlAoipManual::ID_M_PBTN1 = wxNewId(); const long pnlAoipManual::ID_M_PLBL4 = wxNewId(); -const long pnlAoipManual::ID_M_PLST5 = wxNewId(); +const long pnlAoipManual::ID_M_PBTN2 = wxNewId(); const long pnlAoipManual::ID_M_PKBD2 = wxNewId(); const long pnlAoipManual::ID_M_PBTN3 = wxNewId(); const long pnlAoipManual::ID_M_PLBL11 = wxNewId(); @@ -66,10 +66,9 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pLbl4->GetUiRect().SetGradient(0); m_pLbl4->SetForegroundColour(wxColour(255,255,255)); m_pLbl4->SetBackgroundColour(wxColour(64,0,128)); - m_plstChannels = new wmList(this, ID_M_PLST5, wxPoint(110,105), wxSize(480,40), wmList::STYLE_SELECT, 0, wxSize(-1,-1), 8, wxSize(5,0)); - m_plstChannels->SetBackgroundColour(wxColour(0,0,0)); - m_plstChannels->SetButtonColour(wxColour(wxT("#004040"))); - m_plstChannels->SetSelectedButtonColour(wxColour(wxT("#FF8000"))); + m_pbtnChannels = new wmButton(this, ID_M_PBTN2, _("2"), wxPoint(110,105), wxSize(92,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN2")); + m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); + m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); m_pkbd = new wmKeyboard(this, ID_M_PKBD2, wxPoint(10,160), wxSize(240,200), 5, 0); m_pkbd->SetForegroundColour(wxColour(255,255,255)); wxFont m_pkbdFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); @@ -77,34 +76,31 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pbtnStream = new wmButton(this, ID_M_PBTN3, _("Receive"), wxPoint(300,320), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("Stop"), wxT("Start"), 40); - m_pLbl8 = new wmLabel(this, ID_M_PLBL11, _("RTPMap"), wxPoint(300,210), wxSize(70,40), 0, _T("ID_M_PLBL11")); + m_pLbl8 = new wmLabel(this, ID_M_PLBL11, _("RTPMap"), wxPoint(260,105), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); m_pLbl8->SetForegroundColour(wxColour(255,255,255)); m_pLbl8->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnRtpMap = new wmButton(this, ID_M_PBTN4, _("96"), wxPoint(370,210), wxSize(80,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); + m_pbtnRtpMap = new wmButton(this, ID_M_PBTN4, _("96"), wxPoint(330,105), wxSize(80,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); Connect(ID_M_PBTN6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnSampleRateClick); + Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnChannelsClick); Connect(ID_M_PBTN3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnStreamClick); Connect(ID_M_PBTN4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnRtpMapClick); //*) SetSize(size); SetPosition(pos); - for(int i = 1; i < 9; i++) - { - m_plstChannels->AddButton(wxString::Format("%d", i)); - } m_pipServer->SetValue(Settings::Get().Read("ManualAoip", "Source", "")); m_pedtPort->SetValue(Settings::Get().Read("ManualAoip", "Port", "5004")); m_pbtnSampleRate->SetLabel(Settings::Get().Read("ManualAoip", "SampleRate", "48000")); m_pbtnBits->ToggleSelection(Settings::Get().Read("ManualAoip", "Bits", 24) == 24); - m_plstChannels->SelectButton(Settings::Get().Read("ManualAoip", "Channels", "2")); - Connect(m_plstChannels->GetId(), wxEVT_LIST_SELECTED, (wxObjectEventFunction)&pnlAoipManual::OnlstChannelSelected); + m_pbtnChannels->SetLabel(Settings::Get().Read("ManualAoip", "Channels", "2")); + } pnlAoipManual::~pnlAoipManual() @@ -131,13 +127,13 @@ void pnlAoipManual::OnbtnSampleRateClick(wxCommandEvent& event) void pnlAoipManual::OnlstChannelSelected(wxCommandEvent& event) { - m_sChannels = event.GetString(); } void pnlAoipManual::OnbtnStreamClick(wxCommandEvent& event) { m_pbtnBits->Enable(event.IsChecked() == false); - m_plstChannels->Enable(event.IsChecked() == false); + m_pbtnChannels->Enable(event.IsChecked() == false); + m_pbtnRtpMap->Enable(event.IsChecked() == false); m_pipServer->Enable(event.IsChecked() == false); m_pkbd->Enable(event.IsChecked() == false); m_pedtPort->Enable(event.IsChecked() == false); @@ -152,7 +148,7 @@ void pnlAoipManual::OnbtnStreamClick(wxCommandEvent& event) << "a=recvonly\r\n" << "m=audio " << m_pedtPort->GetValue() << " RTP/AVP " << m_pbtnRtpMap->GetLabel() << "\r\n" << "c=IN IP4 " << m_pipServer->GetValue() << "/255\r\n" - << "a=rtpmap:" << m_pbtnRtpMap->GetLabel() <<" L" << (m_pbtnBits->IsChecked() ? "24" : "16") << "/" << m_pbtnSampleRate->GetLabel() << "/" << m_sChannels << "\r\n" + << "a=rtpmap:" << m_pbtnRtpMap->GetLabel() <<" L" << (m_pbtnBits->IsChecked() ? "24" : "16") << "/" << m_pbtnSampleRate->GetLabel() << "/" << m_pbtnChannels->GetLabel() << "\r\n" << "a=mediaclk:direct=0\r\n"; //@todo grandmaster if we have one @@ -184,3 +180,18 @@ void pnlAoipManual::OnbtnRtpMapClick(wxCommandEvent& event) m_pbtnRtpMap->SetLabel(aDlg.m_sSelected); } } + +void pnlAoipManual::OnbtnChannelsClick(wxCommandEvent& event) +{ + wxArrayString asButtons; + for(int i = 1; i < 9; i++) + { + asButtons.Add(wxString::Format("%d", i)); + } + + dlgMask aDlg(this, asButtons, m_pbtnChannels->GetLabel(), wxNewId(), ClientToScreen(m_pbtnChannels->GetPosition()), m_pbtnChannels->GetSize()); + if(aDlg.ShowModal()== wxID_OK) + { + m_pbtnChannels->SetLabel(aDlg.m_sSelected); + } +} diff --git a/pam2/pnlAoipManual.h b/pam2/pnlAoipManual.h index 3f7ed723..6bb3122c 100644 --- a/pam2/pnlAoipManual.h +++ b/pam2/pnlAoipManual.h @@ -7,7 +7,6 @@ #include "wmipeditpnl.h" #include "wmkeyboard.h" #include "wmlabel.h" -#include "wmlist.h" #include //*) @@ -20,6 +19,7 @@ class pnlAoipManual: public wxPanel //(*Declarations(pnlAoipManual) wmButton* m_pbtnBits; + wmButton* m_pbtnChannels; wmButton* m_pbtnRtpMap; wmButton* m_pbtnSampleRate; wmButton* m_pbtnStream; @@ -31,7 +31,6 @@ class pnlAoipManual: public wxPanel wmLabel* m_pLbl4; wmLabel* m_pLbl8; wmLabel* m_pLbl9; - wmList* m_plstChannels; //*) protected: @@ -45,7 +44,7 @@ class pnlAoipManual: public wxPanel static const long ID_M_PBTN6; static const long ID_M_PBTN1; static const long ID_M_PLBL4; - static const long ID_M_PLST5; + static const long ID_M_PBTN2; static const long ID_M_PKBD2; static const long ID_M_PBTN3; static const long ID_M_PLBL11; @@ -58,6 +57,7 @@ class pnlAoipManual: public wxPanel void OnbtnSampleRateClick(wxCommandEvent& event); void OnbtnStreamClick(wxCommandEvent& event); void OnbtnRtpMapClick(wxCommandEvent& event); + void OnbtnChannelsClick(wxCommandEvent& event); //*) void OnlstChannelSelected(wxCommandEvent& event); diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 4816314d..1f896d22 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -33,7 +33,7 @@ const long pnlSettingsOutput::ID_M_PBTN6 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL6 = wxNewId(); const long pnlSettingsOutput::ID_M_PEDT3 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL7 = wxNewId(); -const long pnlSettingsOutput::ID_M_PLST5 = wxNewId(); +const long pnlSettingsOutput::ID_M_PBTN7 = wxNewId(); const long pnlSettingsOutput::ID_M_PEDT2 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN1 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN2 = wxNewId(); @@ -125,7 +125,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pLbl9->GetUiRect().SetGradient(0); m_pLbl9->SetForegroundColour(wxColour(255,255,255)); m_pLbl9->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnRTSP = new wmButton(pnlAoip, ID_M_PBTN6, _("Stream"), wxPoint(100,10), wxSize(200,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN6")); + m_pbtnRTSP = new wmButton(pnlAoip, ID_M_PBTN6, _("eth0"), wxPoint(100,10), wxSize(200,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN6")); m_pbtnRTSP->SetForegroundColour(wxColour(0,0,0)); m_pbtnRTSP->SetBackgroundColour(wxColour(255,255,255)); m_pLbl6 = new wmLabel(pnlAoip, ID_M_PLBL6, _("Port"), wxPoint(300,10), wxSize(50,40), 0, _T("ID_M_PLBL6")); @@ -141,55 +141,54 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pLbl7->GetUiRect().SetGradient(0); m_pLbl7->SetForegroundColour(wxColour(255,255,255)); m_pLbl7->SetBackgroundColour(wxColour(64,0,128)); - m_plstPacket = new wmList(pnlAoip, ID_M_PLST5, wxPoint(105,99), wxSize(490,44), wmList::STYLE_SELECT, 0, wxSize(-1,-1), 5, wxSize(5,-1)); - m_plstPacket->SetBackgroundColour(wxColour(0,0,0)); - m_plstPacket->SetButtonColour(wxColour(wxT("#004040"))); - m_plstPacket->SetSelectedButtonColour(wxColour(wxT("#FF8000"))); + m_pbtnPacketTime = new wmButton(pnlAoip, ID_M_PBTN7, _("1 ms"), wxPoint(100,100), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN7")); + m_pbtnPacketTime->SetForegroundColour(wxColour(0,0,0)); + m_pbtnPacketTime->SetBackgroundColour(wxColour(255,255,255)); m_pedtRTPPort = new wmEdit(pnlAoip, ID_M_PEDT2, wxEmptyString, wxPoint(350,55), wxSize(100,40), 0, wxDefaultValidator, _T("ID_M_PEDT2")); m_pedtRTPPort->SetValidation(4); m_pedtRTPPort->SetBorderStyle(1,1); - m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Restart Stream"), wxPoint(470,10), wxSize(120,40), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); + m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(460,10), wxSize(135,40), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnRestartStream->SetBackgroundColour(wxColour(255,0,0)); wxFont m_pbtnRestartStreamFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnRestartStream->SetFont(m_pbtnRestartStreamFont); - m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(470,55), wxSize(120,40), 0, wxDefaultValidator, _T("ID_M_PBTN2")); + m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(460,55), wxSize(135,40), 0, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnStats->SetBackgroundColour(wxColour(64,128,128)); wxFont m_pbtnStatsFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnStats->SetFont(m_pbtnStatsFont); - m_pkbd = new wmKeyboard(pnlAoip, ID_M_PKBD2, wxPoint(10,160), wxSize(240,200), 5, 0); + m_pkbd = new wmKeyboard(pnlAoip, ID_M_PKBD2, wxPoint(10,174), wxSize(240,200), 5, 0); m_pkbd->SetForegroundColour(wxColour(255,255,255)); wxFont m_pkbdFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); m_pkbd->SetFont(m_pkbdFont); - m_pLbl10 = new wmLabel(pnlAoip, ID_M_PLBL9, _("Advertise"), wxPoint(260,250), wxSize(330,30), 0, _T("ID_M_PLBL9")); + m_pLbl10 = new wmLabel(pnlAoip, ID_M_PLBL9, _("Advertise"), wxPoint(260,295), wxSize(330,30), 0, _T("ID_M_PLBL9")); m_pLbl10->SetBorderState(uiRect::BORDER_NONE); m_pLbl10->GetUiRect().SetGradient(0); m_pLbl10->SetForegroundColour(wxColour(255,255,255)); m_pLbl10->SetBackgroundColour(wxColour(61,120,218)); wxFont m_pLbl10Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT); m_pLbl10->SetFont(m_pLbl10Font); - m_pbtnDNS = new wmButton(pnlAoip, ID_M_PBTN8, _("mDNS-SD"), wxPoint(300,285), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN8")); + m_pbtnDNS = new wmButton(pnlAoip, ID_M_PBTN8, _("mDNS-SD"), wxPoint(260,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN8")); m_pbtnDNS->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnDNS->SetToggle(true, wxT("Off"), wxT("On"), 40); - m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(300,330), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); + m_pbtnDNS->SetToggle(true, wxT("Off"), wxT("On"), 60); + m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(430,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); m_pbtnSAP->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 40); - m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(300,200), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); + m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 60); + m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(300,250), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("Unicast"), wxT("Multicast"), 40); - m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(300,145), wxSize(70,40), 0, _T("ID_M_PLBL12")); + m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,100), wxSize(60,40), 0, _T("ID_M_PLBL12")); m_pLbl11->SetBorderState(uiRect::BORDER_NONE); m_pLbl11->GetUiRect().SetGradient(0); m_pLbl11->SetForegroundColour(wxColour(255,255,255)); m_pLbl11->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(370,145), wxSize(60,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); + m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(232,100), wxSize(50,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); - m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTPMap"), wxPoint(438,145), wxSize(70,40), 0, _T("ID_M_PLBL11")); + m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("rtpmap"), wxPoint(460,100), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); m_pLbl8->SetForegroundColour(wxColour(255,255,255)); m_pLbl8->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(508,145), wxSize(60,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); + m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(530,100), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); m_pswpDestination->AddPage(pnlDisabled, _("Disabled"), false); @@ -202,7 +201,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Connect(ID_M_PSLIDER1,wxEVT_SLIDER_MOVE,(wxObjectEventFunction)&pnlSettingsOutput::OnlsliderOutputGainMove); Connect(ID_M_PBTN6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRTSPClick); Connect(ID_M_PEDT3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlSettingsOutput::OnedtRTSPPortText); - Connect(ID_M_PLST5,wxEVT_LIST_SELECTED,(wxObjectEventFunction)&pnlSettingsOutput::OnlstPacketSelected); + Connect(ID_M_PBTN7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnPacketTimeClick); Connect(ID_M_PEDT2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlSettingsOutput::OnedtRTPPortText); Connect(ID_M_PBTN1,wxEVT_BUTTON_HELD,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRestartStreamHeld); Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnStatsClick); @@ -219,11 +218,6 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_plstDestination->AddButton(wxT("Disabled")); m_plstDestination->AddButton(wxT("Soundcard")); m_plstDestination->AddButton(wxT("AoIP")); - m_plstPacket->AddButton(wxT("125us"), wxNullBitmap, (void*)125); - m_plstPacket->AddButton(wxT("250us"), wxNullBitmap, (void*)250); - m_plstPacket->AddButton(wxT("333us"), wxNullBitmap, (void*)333); - m_plstPacket->AddButton(wxT("1ms"), wxNullBitmap, (void*)1000); - m_plstPacket->AddButton(wxT("4ms"), wxNullBitmap, (void*)4000); for(unsigned int i = 0; i < 10; i++) { @@ -263,7 +257,16 @@ pnlSettingsOutput::~pnlSettingsOutput() void pnlSettingsOutput::UpdateDisplayedSettings() { m_plstDestination->SelectButton(Settings::Get().Read(wxT("Output"), wxT("Destination"), wxT("Disabled")), false); - m_plstPacket->SelectButton(m_plstPacket->FindButton(reinterpret_cast(Settings::Get().Read(wxT("Server"), wxT("PacketTime"), 4000)))); + + unsigned long nTime = Settings::Get().Read("Server", "PacketTime", 1000); + if(nTime > 999) + { + m_pbtnPacketTime->SetLabel(wxString::Format("%lu ms", nTime/1000)); + } + else + { + m_pbtnPacketTime->SetLabel(wxString::Format("%lu \u00B5s", nTime)); + } m_pswpDestination->ChangeSelection(Settings::Get().Read(wxT("Output"), wxT("Destination"), wxT("Disabled"))); @@ -527,3 +530,27 @@ void pnlSettingsOutput::OnbtnChannelsClick(wxCommandEvent& event) Settings::Get().Write("Server", "Channels", aDlg.m_sSelected); } } + +void pnlSettingsOutput::OnbtnPacketTimeClick(wxCommandEvent& event) +{ + wxArrayString asButtons; + asButtons.Add("125 \u00B5s"); + asButtons.Add("250 \u00B5s"); + asButtons.Add("333 \u00B5s"); + asButtons.Add("1 ms"); + asButtons.Add("4 ms"); + + + dlgMask aDlg(this, asButtons, m_pbtnPacketTime->GetLabel(), wxNewId(), ClientToScreen(m_pbtnPacketTime->GetPosition()), m_pbtnPacketTime->GetSize()); + if(aDlg.ShowModal()== wxID_OK) + { + m_pbtnPacketTime->SetLabel(aDlg.m_sSelected); + unsigned long nTime; + aDlg.m_sSelected.Before(' ').ToULong(&nTime); + if(nTime == 1 || nTime == 4) + { + nTime*=1000; + } + Settings::Get().Write("Server", "PacketTime", nTime); + } +} diff --git a/pam2/pnlSettingsOutput.h b/pam2/pnlSettingsOutput.h index 26f41c68..84416c8f 100644 --- a/pam2/pnlSettingsOutput.h +++ b/pam2/pnlSettingsOutput.h @@ -29,6 +29,7 @@ class pnlSettingsOutput: public wxPanel //(*Declarations(pnlSettingsOutput) wmButton* m_pbtnChannels; wmButton* m_pbtnDNS; + wmButton* m_pbtnPacketTime; wmButton* m_pbtnRTSP; wmButton* m_pbtnRestartStream; wmButton* m_pbtnRtpMap; @@ -52,7 +53,6 @@ class pnlSettingsOutput: public wxPanel wmLabel* m_plblOutputGain; wmList* m_plstDestination; wmList* m_plstLatency; - wmList* m_plstPacket; wmList* m_plstPlayback; wmSlider* m_plsliderOutputGain; wmSwitcherPanel* m_pswpDestination; @@ -83,7 +83,7 @@ class pnlSettingsOutput: public wxPanel static const long ID_M_PLBL6; static const long ID_M_PEDT3; static const long ID_M_PLBL7; - static const long ID_M_PLST5; + static const long ID_M_PBTN7; static const long ID_M_PEDT2; static const long ID_M_PBTN1; static const long ID_M_PBTN2; @@ -118,6 +118,7 @@ class pnlSettingsOutput: public wxPanel void OnbtnStatsClick(wxCommandEvent& event); void OnbtnRtpMapClick(wxCommandEvent& event); void OnbtnChannelsClick(wxCommandEvent& event); + void OnbtnPacketTimeClick(wxCommandEvent& event); //*) void OnSettingChanged(SettingEvent& event); diff --git a/pam2/wxsmith/pnlAoipManual.wxs b/pam2/wxsmith/pnlAoipManual.wxs index 8a7b1a52..f041f7a2 100644 --- a/pam2/wxsmith/pnlAoipManual.wxs +++ b/pam2/wxsmith/pnlAoipManual.wxs @@ -64,17 +64,17 @@ #FFFFFF #400080 - - None - 5,0 - 8 - - #FF8000 - + + + Stop + Start + 50 110,105 - 480,40 - #000000 - + 92,40 + #000000 + #FFFFFF + + Calc @@ -104,7 +104,7 @@ - 300,210 + 260,105 70,40 #FFFFFF #400080 @@ -114,7 +114,7 @@ Stop Start 50 - 370,210 + 330,105 80,40 #000000 #FFFFFF diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 31cde277..62b39889 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -150,7 +150,7 @@ #400080 - + Stop Start 50 @@ -183,18 +183,17 @@ #FFFFFF #400080 - - None - 5,-1 - 5 - - #FF8000 - - 105,99 - 490,44 - #000000 - - + + + Stop + Start + 50 + 100,100 + 70,40 + #000000 + #FFFFFF + + Integer @@ -205,9 +204,9 @@ - - 470,10 - 120,40 + + 460,10 + 135,40 #FF0000 12 @@ -222,8 +221,8 @@ - 470,55 - 120,40 + 460,55 + 135,40 #408080 12 @@ -237,7 +236,7 @@ Calc - 10,160 + 10,174 240,200 #FFFFFF @@ -251,7 +250,7 @@ - 260,250 + 260,295 330,30 #FFFFFF #3D78DA @@ -268,9 +267,9 @@ 1 Off On - 40 - 300,285 - 268,40 + 60 + 260,330 + 160,40 #3D78DA @@ -280,9 +279,9 @@ 1 Off On - 40 - 300,330 - 268,40 + 60 + 430,330 + 160,40 #3D78DA @@ -293,7 +292,7 @@ Unicast Multicast 40 - 300,200 + 300,250 268,40 #008000 @@ -301,8 +300,8 @@ - 300,145 - 70,40 + 172,100 + 60,40 #FFFFFF #400080 @@ -311,16 +310,16 @@ Stop Start 50 - 370,145 - 60,40 + 232,100 + 50,40 #000000 #FFFFFF - - 438,145 + + 460,100 70,40 #FFFFFF #400080 @@ -330,8 +329,8 @@ Stop Start 50 - 508,145 - 60,40 + 530,100 + 65,40 #000000 #FFFFFF From 3c0a5447e2e38d61894cc5c44e68b17b87c7b0a7 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 11:57:31 +0000 Subject: [PATCH 02/15] chore: removed some debugging --- pam2/dlgmask.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/pam2/dlgmask.cpp b/pam2/dlgmask.cpp index 912b3176..b3da45f8 100644 --- a/pam2/dlgmask.cpp +++ b/pam2/dlgmask.cpp @@ -66,7 +66,6 @@ void dlgMask::OnActivate(wxActivateEvent& event) void dlgMask::OnlstSubnetSelected(wxCommandEvent& event) { m_sSelected = event.GetString(); - pmlLog(pml::LOG_INFO) << "Selected a value " << m_sSelected; if(HasCapture()) { ReleaseMouse(); @@ -82,7 +81,6 @@ void dlgMask::OnLeftDown(wxMouseEvent& event) { ReleaseMouse(); } - pmlLog(pml::LOG_INFO) << "Clicked outside"; EndModal(wxID_CANCEL); } else @@ -95,7 +93,6 @@ void dlgMask::OnLeftDown(wxMouseEvent& event) void dlgMask::OnCaptureLost(wxMouseCaptureLostEvent& event) { - pmlLog(pml::LOG_INFO) << "Capture lost"; wxPostEvent(m_plstSubnet, event); // EndModal(wxID_CANCEL); // CaptureMouse(); From 4877d141e9435d290ec1661ec4c766015d96129c Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 11:58:10 +0000 Subject: [PATCH 03/15] improvement: use unicode to show mu --- pam2/pnlSettingsOutput.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 1f896d22..5e2598d5 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -258,16 +258,17 @@ void pnlSettingsOutput::UpdateDisplayedSettings() { m_plstDestination->SelectButton(Settings::Get().Read(wxT("Output"), wxT("Destination"), wxT("Disabled")), false); - unsigned long nTime = Settings::Get().Read("Server", "PacketTime", 1000); + int nTime = Settings::Get().Read("Server", "PacketTime", 1000); if(nTime > 999) { - m_pbtnPacketTime->SetLabel(wxString::Format("%lu ms", nTime/1000)); + m_pbtnPacketTime->SetLabel(wxString::Format("%d ms", nTime/1000)); } else { - m_pbtnPacketTime->SetLabel(wxString::Format("%lu \u00B5s", nTime)); + m_pbtnPacketTime->SetLabel(wxString::Format(L"%d \u00B5s", nTime)); } + m_pswpDestination->ChangeSelection(Settings::Get().Read(wxT("Output"), wxT("Destination"), wxT("Disabled"))); m_pedtRTPPort->SetValue(Settings::Get().Read(wxT("Server"), wxT("RTP_Port"), wxT("5004"))); @@ -294,6 +295,7 @@ void pnlSettingsOutput::UpdateDisplayedSettings() double dGain = ConvertRatioToGain(Settings::Get().Read("Output", "Ratio_00", 1.0)); m_plblOutputGain->SetLabel(wxString::Format("%.2f dB", dGain)); m_plsliderOutputGain->SetSliderPosition(dGain*500+5000, false); + } @@ -534,9 +536,9 @@ void pnlSettingsOutput::OnbtnChannelsClick(wxCommandEvent& event) void pnlSettingsOutput::OnbtnPacketTimeClick(wxCommandEvent& event) { wxArrayString asButtons; - asButtons.Add("125 \u00B5s"); - asButtons.Add("250 \u00B5s"); - asButtons.Add("333 \u00B5s"); + asButtons.Add(L"125 \u00B5s"); + asButtons.Add(L"250 \u00B5s"); + asButtons.Add(L"333 \u00B5s"); asButtons.Add("1 ms"); asButtons.Add("4 ms"); @@ -551,6 +553,6 @@ void pnlSettingsOutput::OnbtnPacketTimeClick(wxCommandEvent& event) { nTime*=1000; } - Settings::Get().Write("Server", "PacketTime", nTime); + Settings::Get().Write("Server", "PacketTime", (int)nTime); } } From a75a12086f246bc3dd483760b508fe51c96a4169 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 14:28:10 +0000 Subject: [PATCH 04/15] improvement: more moving of buttons and adding samplerate/bits --- pam2/pnlAoipManual.cpp | 2 +- pam2/pnlSettingsOutput.cpp | 56 ++++++++++++++++++++++++++---- pam2/pnlSettingsOutput.h | 8 +++++ pam2/wxsmith/pnlAoipManual.wxs | 2 +- pam2/wxsmith/pnlSettingsOutput.wxs | 53 ++++++++++++++++++++++------ 5 files changed, 102 insertions(+), 19 deletions(-) diff --git a/pam2/pnlAoipManual.cpp b/pam2/pnlAoipManual.cpp index 4d5ac547..cd4b384e 100644 --- a/pam2/pnlAoipManual.cpp +++ b/pam2/pnlAoipManual.cpp @@ -76,7 +76,7 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pbtnStream = new wmButton(this, ID_M_PBTN3, _("Receive"), wxPoint(300,320), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("Stop"), wxT("Start"), 40); - m_pLbl8 = new wmLabel(this, ID_M_PLBL11, _("RTPMap"), wxPoint(260,105), wxSize(70,40), 0, _T("ID_M_PLBL11")); + m_pLbl8 = new wmLabel(this, ID_M_PLBL11, _("RTP Payload"), wxPoint(260,105), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); m_pLbl8->SetForegroundColour(wxColour(255,255,255)); diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 5e2598d5..e58abbd7 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -44,6 +44,9 @@ const long pnlSettingsOutput::ID_M_PBTN9 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN3 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL12 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN5 = wxNewId(); +const long pnlSettingsOutput::ID_M_PLBL13 = wxNewId(); +const long pnlSettingsOutput::ID_M_PBTN10 = wxNewId(); +const long pnlSettingsOutput::ID_M_PBTN11 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL11 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN4 = wxNewId(); const long pnlSettingsOutput::ID_PANEL11 = wxNewId(); @@ -107,7 +110,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_plblOutputGain->SetFont(m_plblOutputGainFont); pnlAoip = new wxPanel(m_pswpDestination, ID_PANEL11, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL11")); pnlAoip->SetBackgroundColour(wxColour(0,0,0)); - m_pLbl1 = new wmLabel(pnlAoip, ID_M_PLBL1, _("Multicast"), wxPoint(0,55), wxSize(100,40), 0, _T("ID_M_PLBL1")); + m_pLbl1 = new wmLabel(pnlAoip, ID_M_PLBL1, _("Destination"), wxPoint(0,55), wxSize(100,40), 0, _T("ID_M_PLBL1")); m_pLbl1->SetBorderState(uiRect::BORDER_NONE); m_pLbl1->GetUiRect().SetGradient(0); m_pLbl1->SetForegroundColour(wxColour(255,255,255)); @@ -147,11 +150,11 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pedtRTPPort = new wmEdit(pnlAoip, ID_M_PEDT2, wxEmptyString, wxPoint(350,55), wxSize(100,40), 0, wxDefaultValidator, _T("ID_M_PEDT2")); m_pedtRTPPort->SetValidation(4); m_pedtRTPPort->SetBorderStyle(1,1); - m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(460,10), wxSize(135,40), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); + m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(260,220), wxSize(135,40), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnRestartStream->SetBackgroundColour(wxColour(255,0,0)); wxFont m_pbtnRestartStreamFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnRestartStream->SetFont(m_pbtnRestartStreamFont); - m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(460,55), wxSize(135,40), 0, wxDefaultValidator, _T("ID_M_PBTN2")); + m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(455,220), wxSize(135,40), 0, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnStats->SetBackgroundColour(wxColour(64,128,128)); wxFont m_pbtnStatsFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnStats->SetFont(m_pbtnStatsFont); @@ -172,9 +175,9 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(430,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); m_pbtnSAP->SetBackgroundColour(wxColour(61,120,218)); m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 60); - m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(300,250), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); + m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(260,175), wxSize(330,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnStream->SetToggle(true, wxT("Unicast"), wxT("Multicast"), 40); + m_pbtnStream->SetToggle(true, wxT("On Demand"), wxT("Always On"), 40); m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,100), wxSize(60,40), 0, _T("ID_M_PLBL12")); m_pLbl11->SetBorderState(uiRect::BORDER_NONE); m_pLbl11->GetUiRect().SetGradient(0); @@ -183,12 +186,25 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(232,100), wxSize(50,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); - m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("rtpmap"), wxPoint(460,100), wxSize(70,40), 0, _T("ID_M_PLBL11")); + m_pLbl12 = new wmLabel(pnlAoip, ID_M_PLBL13, _("Sample Rate"), wxPoint(284,100), wxSize(60,40), 0, _T("ID_M_PLBL13")); + m_pLbl12->SetBorderState(uiRect::BORDER_NONE); + m_pLbl12->GetUiRect().SetGradient(0); + m_pLbl12->SetForegroundColour(wxColour(255,255,255)); + m_pLbl12->SetBackgroundColour(wxColour(64,0,128)); + m_pbtnSampleRate = new wmButton(pnlAoip, ID_M_PBTN10, _("48000"), wxPoint(344,100), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN10")); + m_pbtnSampleRate->Disable(); + m_pbtnSampleRate->SetForegroundColour(wxColour(0,0,0)); + m_pbtnSampleRate->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnBits = new wmButton(pnlAoip, ID_M_PBTN11, _("Bits"), wxPoint(416,100), wxSize(174,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN11")); + m_pbtnBits->Disable(); + m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); + m_pbtnBits->SetToggle(true, wxT("16"), wxT("24"), 50); + m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTP Payload"), wxPoint(455,55), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); m_pLbl8->SetForegroundColour(wxColour(255,255,255)); m_pLbl8->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(530,100), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); + m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(525,55), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); m_pswpDestination->AddPage(pnlDisabled, _("Disabled"), false); @@ -209,6 +225,8 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Connect(ID_M_PBTN9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnSAPClick); Connect(ID_M_PBTN3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnStreamClick); Connect(ID_M_PBTN5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnChannelsClick); + Connect(ID_M_PBTN10,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnSampleRateClick); + Connect(ID_M_PBTN11,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnBitsClick); Connect(ID_M_PBTN4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRtpMapClick); //*) @@ -296,6 +314,8 @@ void pnlSettingsOutput::UpdateDisplayedSettings() m_plblOutputGain->SetLabel(wxString::Format("%.2f dB", dGain)); m_plsliderOutputGain->SetSliderPosition(dGain*500+5000, false); + m_pbtnBits->ToggleSelection(Settings::Get().Read("Server", "Bits", 24) == 24); + m_pbtnSampleRate->SetLabel(Settings::Get().Read("Server", "SampleRate", "48000")); } @@ -556,3 +576,25 @@ void pnlSettingsOutput::OnbtnPacketTimeClick(wxCommandEvent& event) Settings::Get().Write("Server", "PacketTime", (int)nTime); } } + +void pnlSettingsOutput::OnbtnSampleRateClick(wxCommandEvent& event) +{ + wxArrayString asButtons; + asButtons.Add("44100"); + asButtons.Add("48000"); + asButtons.Add("96000"); + + dlgMask aDlg(this, asButtons, m_pbtnSampleRate->GetLabel(), wxNewId(), ClientToScreen(m_pbtnSampleRate->GetPosition()), m_pbtnSampleRate->GetSize()); + if(aDlg.ShowModal()== wxID_OK) + { + m_pbtnSampleRate->SetLabel(aDlg.m_sSelected); + unsigned long nSampleRate; + aDlg.m_sSelected.ToULong(&nSampleRate); + Settings::Get().Write("Server", "SampleRate", (int)nSampleRate); + } +} + +void pnlSettingsOutput::OnbtnBitsClick(wxCommandEvent& event) +{ + Settings::Get().Write("Server", "Bits", event.IsChecked() ? 24 : 16); +} diff --git a/pam2/pnlSettingsOutput.h b/pam2/pnlSettingsOutput.h index 84416c8f..0c9a0712 100644 --- a/pam2/pnlSettingsOutput.h +++ b/pam2/pnlSettingsOutput.h @@ -27,6 +27,7 @@ class pnlSettingsOutput: public wxPanel void ShowSoundcardOutputs(); //(*Declarations(pnlSettingsOutput) + wmButton* m_pbtnBits; wmButton* m_pbtnChannels; wmButton* m_pbtnDNS; wmButton* m_pbtnPacketTime; @@ -34,6 +35,7 @@ class pnlSettingsOutput: public wxPanel wmButton* m_pbtnRestartStream; wmButton* m_pbtnRtpMap; wmButton* m_pbtnSAP; + wmButton* m_pbtnSampleRate; wmButton* m_pbtnStats; wmButton* m_pbtnStream; wmEdit* m_pedtRTPPort; @@ -41,6 +43,7 @@ class pnlSettingsOutput: public wxPanel wmKeyboard* m_pkbd; wmLabel* m_pLbl10; wmLabel* m_pLbl11; + wmLabel* m_pLbl12; wmLabel* m_pLbl1; wmLabel* m_pLbl2; wmLabel* m_pLbl3; @@ -94,6 +97,9 @@ class pnlSettingsOutput: public wxPanel static const long ID_M_PBTN3; static const long ID_M_PLBL12; static const long ID_M_PBTN5; + static const long ID_M_PLBL13; + static const long ID_M_PBTN10; + static const long ID_M_PBTN11; static const long ID_M_PLBL11; static const long ID_M_PBTN4; static const long ID_PANEL11; @@ -119,6 +125,8 @@ class pnlSettingsOutput: public wxPanel void OnbtnRtpMapClick(wxCommandEvent& event); void OnbtnChannelsClick(wxCommandEvent& event); void OnbtnPacketTimeClick(wxCommandEvent& event); + void OnbtnSampleRateClick(wxCommandEvent& event); + void OnbtnBitsClick(wxCommandEvent& event); //*) void OnSettingChanged(SettingEvent& event); diff --git a/pam2/wxsmith/pnlAoipManual.wxs b/pam2/wxsmith/pnlAoipManual.wxs index f041f7a2..aa6b9c37 100644 --- a/pam2/wxsmith/pnlAoipManual.wxs +++ b/pam2/wxsmith/pnlAoipManual.wxs @@ -103,7 +103,7 @@ - + 260,105 70,40 #FFFFFF diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 62b39889..3e77ce2b 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -123,7 +123,7 @@ #000000 - + 0,55 100,40 #FFFFFF @@ -205,7 +205,7 @@ - 460,10 + 260,220 135,40 #FF0000 @@ -221,7 +221,7 @@ - 460,55 + 455,220 135,40 #408080 @@ -289,11 +289,11 @@ 1 - Unicast - Multicast + On Demand + Always On 40 - 300,250 - 268,40 + 260,175 + 330,40 #008000 @@ -317,9 +317,42 @@ + + + 284,100 + 60,40 + #FFFFFF + #400080 + + + + Stop + Start + 50 + 344,100 + 70,40 + 0 + #000000 + #FFFFFF + + + + + + 1 + 16 + 24 + 50 + 416,100 + 174,40 + 0 + #008000 + + + - - 460,100 + + 455,55 70,40 #FFFFFF #400080 @@ -329,7 +362,7 @@ Stop Start 50 - 530,100 + 525,55 65,40 #000000 #FFFFFF From 1a953e4af63d424802fa115b4bfdbe7aaea77e30 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 15:50:11 +0000 Subject: [PATCH 05/15] config:made more sensible --- documents/pam2.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/pam2.ini b/documents/pam2.ini index d47f8be6..1c0b039e 100644 --- a/documents/pam2.ini +++ b/documents/pam2.ini @@ -116,11 +116,11 @@ _Options=0 [Server] DestinationIp=239.34.13.86 Multicast=239.56.138.33 -PacketTime=333 +PacketTime=1000 RTP_Port=5004 RTSP_Address=192.168.1.123 RTSP_Interface=eth0 -Stream=Multicast +Stream=AlwaysOn [Session Info] Graph=kBit/s _Options=0 From 96eca634ddead5f82a4040a9c9950db3006d1bee Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 20 Jan 2022 15:51:02 +0000 Subject: [PATCH 06/15] refac: changed Multicast/Unicast to AlwaysOn/OnDemand --- pam2/nmos.cpp | 2 +- pam2/pnlAoipManual.cpp | 30 +++++++++-- pam2/pnlAoipManual.h | 6 ++- pam2/pnlSettings.cpp | 14 +++++ pam2/pnlSettingsOutput.cpp | 11 ++-- pambase/iomanager.cpp | 106 ++++++++++++++++++------------------- pambase/iomanager.h | 10 ++-- pambase/wmbutton.cpp | 2 +- pambase/wmipeditpnl.cpp | 7 +++ pambase/wmipeditpnl.h | 2 +- 10 files changed, 118 insertions(+), 72 deletions(-) diff --git a/pam2/nmos.cpp b/pam2/nmos.cpp index 42b178e8..178350d5 100644 --- a/pam2/nmos.cpp +++ b/pam2/nmos.cpp @@ -417,7 +417,7 @@ void NmosManager::ActivateSender(const std::string& sId) { Settings::Get().Write("Output", "Destination", "AoIP"); } - Settings::Get().Write("Server", "Stream", "Multicast"); + Settings::Get().Write("Server", "Stream", "AlwaysOn"); IOManager::Get().RestartStream(); } diff --git a/pam2/pnlAoipManual.cpp b/pam2/pnlAoipManual.cpp index cd4b384e..ac681eca 100644 --- a/pam2/pnlAoipManual.cpp +++ b/pam2/pnlAoipManual.cpp @@ -89,18 +89,23 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnChannelsClick); Connect(ID_M_PBTN3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnStreamClick); Connect(ID_M_PBTN4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnRtpMapClick); + //*) SetSize(size); SetPosition(pos); + Connect(m_pbtnBits->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnBitsClick); + Connect(m_pipServer->GetId(), wxEVT_IPEDIT_CHANGE, (wxObjectEventFunction)&pnlAoipManual::OnIpChanged); + Connect(m_pedtPort->GetId(),wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlAoipManual::OnedtRTPPort); - m_pipServer->SetValue(Settings::Get().Read("ManualAoip", "Source", "")); + m_pipServer->SetValue(Settings::Get().Read("ManualAoip", "Source", "0.0.0.0")); m_pedtPort->SetValue(Settings::Get().Read("ManualAoip", "Port", "5004")); m_pbtnSampleRate->SetLabel(Settings::Get().Read("ManualAoip", "SampleRate", "48000")); m_pbtnBits->ToggleSelection(Settings::Get().Read("ManualAoip", "Bits", 24) == 24); - + m_pbtnRtpMap->SetLabel(Settings::Get().Read("ManualAoip", "RtpMap", "96")); m_pbtnChannels->SetLabel(Settings::Get().Read("ManualAoip", "Channels", "2")); + } pnlAoipManual::~pnlAoipManual() @@ -122,12 +127,10 @@ void pnlAoipManual::OnbtnSampleRateClick(wxCommandEvent& event) { m_pbtnSampleRate->SetLabel(aDlg.m_sSelected); m_pipServer->SetFocus(); + Settings::Get().Write("ManualAoip", "SampleRate", aDlg.m_sSelected); } } -void pnlAoipManual::OnlstChannelSelected(wxCommandEvent& event) -{ -} void pnlAoipManual::OnbtnStreamClick(wxCommandEvent& event) { @@ -166,6 +169,11 @@ void pnlAoipManual::OnbtnStreamClick(wxCommandEvent& event) } } +void pnlAoipManual::OnbtnBitsClick(wxCommandEvent& event) +{ + Settings::Get().Write("ManualAoip", "Bits", event.IsChecked() ? "24" : "16"); +} + void pnlAoipManual::OnbtnRtpMapClick(wxCommandEvent& event) { wxArrayString asButtons; @@ -178,6 +186,7 @@ void pnlAoipManual::OnbtnRtpMapClick(wxCommandEvent& event) if(aDlg.ShowModal()== wxID_OK) { m_pbtnRtpMap->SetLabel(aDlg.m_sSelected); + Settings::Get().Write("ManualAoip", "RtpMap", aDlg.m_sSelected); } } @@ -193,5 +202,16 @@ void pnlAoipManual::OnbtnChannelsClick(wxCommandEvent& event) if(aDlg.ShowModal()== wxID_OK) { m_pbtnChannels->SetLabel(aDlg.m_sSelected); + Settings::Get().Write("ManualAoip", "Channels", aDlg.m_sSelected); } } + +void pnlAoipManual::OnIpChanged(wxCommandEvent& event) +{ + Settings::Get().Write("ManualAoip", "Source", event.GetString()); +} + +void pnlAoipManual::OnedtRTPPort(wxCommandEvent& event) +{ + Settings::Get().Write("ManualAoip", "Port", m_pedtPort->GetValue()); +} diff --git a/pam2/pnlAoipManual.h b/pam2/pnlAoipManual.h index 6bb3122c..bb74f112 100644 --- a/pam2/pnlAoipManual.h +++ b/pam2/pnlAoipManual.h @@ -59,9 +59,11 @@ class pnlAoipManual: public wxPanel void OnbtnRtpMapClick(wxCommandEvent& event); void OnbtnChannelsClick(wxCommandEvent& event); //*) - void OnlstChannelSelected(wxCommandEvent& event); + void OnbtnBitsClick(wxCommandEvent& event); + void OnIpChanged(wxCommandEvent& event); + void OnedtRTPPort(wxCommandEvent& event); - wxString m_sChannels; + DECLARE_EVENT_TABLE() }; diff --git a/pam2/pnlSettings.cpp b/pam2/pnlSettings.cpp index 33fa39fd..5f32883e 100644 --- a/pam2/pnlSettings.cpp +++ b/pam2/pnlSettings.cpp @@ -268,6 +268,7 @@ pnlSettings::pnlSettings(wxWindow* parent,wxWindowID id,const wxPoint& pos,const Settings::Get().AddHandler("NMOS", "Node", this); + Settings::Get().AddHandler("Input", "AoIP", this); Connect(wxID_ANY, wxEVT_SETTING_CHANGED, (wxObjectEventFunction)&pnlSettings::OnSettingChanged); @@ -296,12 +297,25 @@ void pnlSettings::UpdateDisplayedSettings() void pnlSettings::OnSettingChanged(SettingEvent& event) { + int nAoIP = Settings::Get().Read("Input", "AoIP", 0); + bool bNmos = false; #ifdef __NMOS__ if(event.GetSection().CmpNoCase("NMOS") == 0 && event.GetKey() == "Node") { + bNmos = (event.GetValue(0L) != 0); EnableInputButtons(event.GetValue(0L)); } #endif + if(event.GetSection().CmpNoCase("Input") == 0 && event.GetKey() == "AoIP") + { + if(!bNmos) + { + for(size_t i = 0; i < m_plstInput->GetItemCount(); i++) + { + m_plstInput->EnableButton(i, (nAoIP != AoipSourceManager::SOURCE_MANUAL_A && nAoIP != AoipSourceManager::SOURCE_MANUAL_B)); + } + } + } } void pnlSettings::EnableInputButtons(int nMode) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index e58abbd7..202c6164 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -233,6 +233,9 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin SetSize(size); SetPosition(pos); + m_pbtnBits->SetColourDisabled(wxColour(180,180,180)); + m_pbtnSampleRate->SetColourDisabled(wxColour(180,180,180)); + m_plstDestination->AddButton(wxT("Disabled")); m_plstDestination->AddButton(wxT("Soundcard")); m_plstDestination->AddButton(wxT("AoIP")); @@ -297,7 +300,7 @@ void pnlSettingsOutput::UpdateDisplayedSettings() m_plstLatency->SelectButton(Settings::Get().Read(wxT("Output"), wxT("Latency"), 0)/40, false); m_pbtnRTSP->SetLabel(Settings::Get().Read(wxT("Server"), wxT("RTSP_Interface"), wxEmptyString)); - bool bMulticast(Settings::Get().Read(wxT("Server"), wxT("Stream"), "Unicast") == "Multicast"); + bool bMulticast(Settings::Get().Read(wxT("Server"), wxT("Stream"), "OnDemand") == "AlwaysOn"); m_pbtnStream->ToggleSelection(bMulticast); m_pbtnRtpMap->SetLabel(Settings::Get().Read("Server", "RTPMap", "96")); @@ -345,7 +348,7 @@ void pnlSettingsOutput::OnSettingChanged(SettingEvent& event) } else if(event.GetKey() == wxT("Stream")) { - bool bMulticast(Settings::Get().Read(wxT("Server"), wxT("Stream"), "Unicast") == "Multicast"); + bool bMulticast(Settings::Get().Read(wxT("Server"), wxT("Stream"), "OnDemand") == "AlwaysOn"); m_pbtnStream->ToggleSelection(bMulticast); m_pbtnSAP->Show(bMulticast); m_pLbl1->Show(bMulticast); @@ -389,13 +392,13 @@ void pnlSettingsOutput::OnbtnStreamClick(wxCommandEvent& event) if(event.IsChecked() == false) { - Settings::Get().Write(wxT("Server"), wxT("Stream"), "Unicast"); + Settings::Get().Write(wxT("Server"), wxT("Stream"), "OnDemand"); } else { //@todo create the new session Settings::Get().Write(wxT("Server"), wxT("DestinationIp"), m_ppnlAddress->GetValue()); - Settings::Get().Write(wxT("Server"), wxT("Stream"), "Multicast"); + Settings::Get().Write(wxT("Server"), wxT("Stream"), "AlwaysOn"); } /*m_ppnlAddress->Enable((event.IsChecked() == false)); m_pedtRTSPPort->Enable((event.IsChecked() == false)); diff --git a/pambase/iomanager.cpp b/pambase/iomanager.cpp index e6b2dbca..5df2bd27 100644 --- a/pambase/iomanager.cpp +++ b/pambase/iomanager.cpp @@ -77,9 +77,9 @@ IOManager::IOManager() : m_bPlaybackInput(false), m_bMonitorOutput(false), m_pGenerator(nullptr), - m_bStreamMulticast(false), - m_pMulticastServer(nullptr), - m_pUnicastServer(nullptr), + m_bStreamAlwaysOn(false), + m_pAlwaysOnServer(nullptr), + m_pOnDemandServer(nullptr), m_pOnDemandSubsession(nullptr), m_pSapServer(nullptr), m_pPublisher(nullptr), @@ -183,20 +183,20 @@ void IOManager::Stop() void IOManager::StopStream() { - if(m_pMulticastServer) + if(m_pAlwaysOnServer) { - m_pMulticastServer->StopStream(); - m_pMulticastServer->Wait(); - delete m_pMulticastServer; - m_pMulticastServer = nullptr; + m_pAlwaysOnServer->StopStream(); + m_pAlwaysOnServer->Wait(); + delete m_pAlwaysOnServer; + m_pAlwaysOnServer = nullptr; RTPServerFinished(); } - else if(m_pUnicastServer) + else if(m_pOnDemandServer) { - m_pUnicastServer->Stop(); - m_pUnicastServer->Wait(); - delete m_pUnicastServer; - m_pUnicastServer = nullptr; + m_pOnDemandServer->Stop(); + m_pOnDemandServer->Wait(); + delete m_pOnDemandServer; + m_pOnDemandServer = nullptr; m_pOnDemandSubsession = nullptr; RTPServerFinished(); } @@ -264,26 +264,26 @@ void IOManager::OnSettingEvent(SettingEvent& event) { if(event.GetKey() == wxT("Stream")) { - m_bStreamMulticast = (event.GetValue() == "Multicast"); - if(!m_bStreamMulticast) + m_bStreamAlwaysOn = (event.GetValue() == "AlwaysOn"); + if(!m_bStreamAlwaysOn) { - if(m_pMulticastServer) + if(m_pAlwaysOnServer) { - m_pMulticastServer->StopStream(); - m_pMulticastServer->Wait(); - delete m_pMulticastServer; - m_pMulticastServer = nullptr; + m_pAlwaysOnServer->StopStream(); + m_pAlwaysOnServer->Wait(); + delete m_pAlwaysOnServer; + m_pAlwaysOnServer = nullptr; RTPServerFinished(); } } else { - if(m_pUnicastServer) + if(m_pOnDemandServer) { - m_pUnicastServer->Stop(); - m_pUnicastServer->Wait(); - delete m_pUnicastServer; - m_pUnicastServer = nullptr; + m_pOnDemandServer->Stop(); + m_pOnDemandServer->Wait(); + delete m_pOnDemandServer; + m_pOnDemandServer = nullptr; m_pOnDemandSubsession = nullptr; RTPServerFinished(); } @@ -312,9 +312,9 @@ void IOManager::OnAudioEvent(AudioEvent& event) SoundcardManager::Get().AddOutputSamples(event.GetBuffer()); break; case AudioEvent::RTP: - if(m_pMulticastServer) + if(m_pAlwaysOnServer) { - m_pMulticastServer->AddSamples(event.GetBuffer()); + m_pAlwaysOnServer->AddSamples(event.GetBuffer()); } else if(m_pOnDemandSubsession) { @@ -365,9 +365,9 @@ void IOManager::AddOutputSamples(size_t nSize) SoundcardManager::Get().AddOutputSamples(pBuffer); break; case AudioEvent::RTP: - if(m_pMulticastServer) + if(m_pAlwaysOnServer) { - m_pMulticastServer->AddSamples(pBuffer); + m_pAlwaysOnServer->AddSamples(pBuffer); } else if(m_pOnDemandSubsession) { @@ -513,9 +513,9 @@ void IOManager::OutputChanged(const wxString& sKey) SoundcardManager::Get().FlushOutputQueue(); break; case AudioEvent::RTP: - if(m_pMulticastServer) + if(m_pAlwaysOnServer) { - m_pMulticastServer->FlushQueue(); + m_pAlwaysOnServer->FlushQueue(); } else if(m_pOnDemandSubsession) { @@ -1073,7 +1073,7 @@ void IOManager::OnPtpEvent(wxCommandEvent& event) void IOManager::DoSAP(bool bRun) { - if(bRun == false || m_pMulticastServer == nullptr) + if(bRun == false || m_pAlwaysOnServer == nullptr) { if(m_pSapServer) { @@ -1094,15 +1094,15 @@ void IOManager::DoSAP(bool bRun) } - m_pSapServer->AddSender(IpAddress(std::string(Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), wxEmptyString).c_str())), std::chrono::milliseconds(30000), m_pMulticastServer->GetSDP()); + m_pSapServer->AddSender(IpAddress(std::string(Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), wxEmptyString).c_str())), std::chrono::milliseconds(30000), m_pAlwaysOnServer->GetSDP()); - pmlLog(pml::LOG_INFO) << "IOManager\tStart SAP advertising: " << m_pMulticastServer->GetSDP(); + pmlLog(pml::LOG_INFO) << "IOManager\tStart SAP advertising: " << m_pAlwaysOnServer->GetSDP(); } } void IOManager::DoDNSSD(bool bRun) { - if(bRun == false || (m_pUnicastServer == nullptr && m_pMulticastServer == nullptr)) + if(bRun == false || (m_pOnDemandServer == nullptr && m_pAlwaysOnServer == nullptr)) { if(m_pPublisher) { @@ -1140,64 +1140,64 @@ void IOManager::RTPServerFinished() void IOManager::Stream() { - if(m_bStreamMulticast || (Settings::Get().Read("NMOS", "Node", 0) == 2 || Settings::Get().Read("NMOS", "Node", 0) == 3)) //@todo bodge for NMOS + if(m_bStreamAlwaysOn || (Settings::Get().Read("NMOS", "Node", 0) == 2 || Settings::Get().Read("NMOS", "Node", 0) == 3)) //@todo bodge for NMOS { - StreamMulticast(); + StreamAlwaysOn(); DoSAP(Settings::Get().Read("Server", "SAP",0)); } else { - StreamUnicast(); + StreamOnDemand(); DoSAP(false); } DoDNSSD(Settings::Get().Read("Server", "DNS-SD", 0)); } -void IOManager::StreamMulticast() +void IOManager::StreamAlwaysOn() { - pmlLog(pml::LOG_INFO) << "IOManager\tCreate Multicast AES67 Server"; - if(m_pMulticastServer == nullptr && m_pUnicastServer == nullptr) + pmlLog(pml::LOG_INFO) << "IOManager\tCreate AlwaysOn AES67 Server"; + if(m_pAlwaysOnServer == nullptr && m_pOnDemandServer == nullptr) { wxString sDestinationIp = Settings::Get().Read(wxT("Server"), wxT("DestinationIp"), wxEmptyString); unsigned long nByte; bool bSSM(sDestinationIp.BeforeFirst(wxT('.')).ToULong(&nByte) && nByte >= 224 && nByte <= 239); - m_pMulticastServer = new RtpServerThread(this, m_setRTCPHandlers, Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), wxEmptyString), + m_pAlwaysOnServer = new RtpServerThread(this, m_setRTCPHandlers, Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), wxEmptyString), Settings::Get().Read(wxT("Server"), wxT("RTSP_Port"), 5555), sDestinationIp, Settings::Get().Read(wxT("Server"), wxT("RTP_Port"), 5004), bSSM, (LiveAudioSource::enumPacketTime)Settings::Get().Read(wxT("Server"), wxT("PacketTime"), 1000)); - m_pMulticastServer->Run(); + m_pAlwaysOnServer->Run(); m_bStreamActive = true; } else { - pmlLog(pml::LOG_ERROR) << "Attempting to stream multicast but already streaming"; + pmlLog(pml::LOG_ERROR) << "Attempting to stream AlwaysOn but already streaming"; } } -void IOManager::StreamUnicast() +void IOManager::StreamOnDemand() { - pmlLog(pml::LOG_INFO) << "IOManager\tCreate Unicast AES67 Server"; - if(m_pMulticastServer == nullptr && m_pUnicastServer == nullptr) + pmlLog(pml::LOG_INFO) << "IOManager\tCreate OnDemand AES67 Server"; + if(m_pAlwaysOnServer == nullptr && m_pOnDemandServer == nullptr) { - m_pUnicastServer = new OnDemandStreamer(m_setRTSPHandlers, m_setRTCPHandlers, Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), "0.0.0.0"), + m_pOnDemandServer = new OnDemandStreamer(m_setRTSPHandlers, m_setRTCPHandlers, Settings::Get().Read(wxT("Server"), wxT("RTSP_Address"), "0.0.0.0"), Settings::Get().Read(wxT("Server"), wxT("RTSP_Port"), 5555)); - m_pOnDemandSubsession = OnDemandAES67MediaSubsession::createNew(this, *m_pUnicastServer->envir(), 2, (LiveAudioSource::enumPacketTime)Settings::Get().Read(wxT("Server"), wxT("PacketTime"), 1000), Settings::Get().Read(wxT("Server"), wxT("RTP_Port"), 5004)); + m_pOnDemandSubsession = OnDemandAES67MediaSubsession::createNew(this, *m_pOnDemandServer->envir(), 2, (LiveAudioSource::enumPacketTime)Settings::Get().Read(wxT("Server"), wxT("PacketTime"), 1000), Settings::Get().Read(wxT("Server"), wxT("RTP_Port"), 5004)); - m_pUnicastServer->Create(); - m_pUnicastServer->SetSubsession(m_pOnDemandSubsession); + m_pOnDemandServer->Create(); + m_pOnDemandServer->SetSubsession(m_pOnDemandSubsession); - m_pUnicastServer->Run(); + m_pOnDemandServer->Run(); m_bStreamActive = true; } else { - pmlLog(pml::LOG_ERROR) << "Attempting to stream unicast but already streaming"; + pmlLog(pml::LOG_ERROR) << "Attempting to stream OnDemand but already streaming"; } } diff --git a/pambase/iomanager.h b/pambase/iomanager.h index 5be844c4..266a9a9b 100644 --- a/pambase/iomanager.h +++ b/pambase/iomanager.h @@ -102,8 +102,8 @@ class PAMBASE_IMPEXPORT IOManager : public wxEvtHandler void RTPServerFinished(); void Stream(); - void StreamMulticast(); - void StreamUnicast(); + void StreamAlwaysOn(); + void StreamOnDemand(); void StopStream(); void DoGain(AudioEvent& event); @@ -122,15 +122,15 @@ class PAMBASE_IMPEXPORT IOManager : public wxEvtHandler int m_nPlaybackSource; bool m_bPlaybackInput; bool m_bMonitorOutput; - bool m_bStreamMulticast; + bool m_bStreamAlwaysOn; Generator* m_pGenerator; std::map m_mRtp; std::set m_setRtpOrphan; int m_nCurrentRtp; - RtpServerThread* m_pMulticastServer; - OnDemandStreamer* m_pUnicastServer; + RtpServerThread* m_pAlwaysOnServer; + OnDemandStreamer* m_pOnDemandServer; OnDemandAES67MediaSubsession* m_pOnDemandSubsession; wxTimer m_timerSilence; wxTimer m_timerResetStream; diff --git a/pambase/wmbutton.cpp b/pambase/wmbutton.cpp index e777e4d5..af5e5531 100644 --- a/pambase/wmbutton.cpp +++ b/pambase/wmbutton.cpp @@ -490,7 +490,7 @@ void wmButton::DrawToggle(wxDC& dc) m_uiRect.SetBackgroundColour(m_clrBackground[STATE_NORMAL]); m_uiRect.SetForegroundColour(m_clrForeground[STATE_NORMAL]); - + m_uiRect.SetTop(m_uiGroove.GetTop()+2); m_uiRect.SetBottom(m_uiGroove.GetBottom()-2); diff --git a/pambase/wmipeditpnl.cpp b/pambase/wmipeditpnl.cpp index 1994a4f9..1d0c68f2 100644 --- a/pambase/wmipeditpnl.cpp +++ b/pambase/wmipeditpnl.cpp @@ -18,10 +18,13 @@ BEGIN_EVENT_TABLE(wmipeditpnl,pmPanel) //*) END_EVENT_TABLE() +wxDEFINE_EVENT(wxEVT_IPEDIT_CHANGE, wxCommandEvent); + #ifdef WXSPAM IMPLEMENT_DYNAMIC_CLASS(wmipeditpnl, pmControl) #else wxIMPLEMENT_DYNAMIC_CLASS(wmipeditpnl, pmPanel); + #endif // WXSPAM wmipeditpnl::wmipeditpnl() : pmPanel(), @@ -150,6 +153,10 @@ void wmipeditpnl::CheckEdit(wmEdit* pCurrent, wmEdit* pNext) pNext->SetInsertPos(0); } } + + wxCommandEvent event(wxEVT_IPEDIT_CHANGE, GetId()); + event.SetString(GetValue()); + wxPostEvent(GetParent(), event); } void wmipeditpnl::OnSetFocus(wxFocusEvent& event) diff --git a/pambase/wmipeditpnl.h b/pambase/wmipeditpnl.h index 0103a92e..136a7cd5 100644 --- a/pambase/wmipeditpnl.h +++ b/pambase/wmipeditpnl.h @@ -71,5 +71,5 @@ class PAMBASE_IMPEXPORT wmipeditpnl: public pmPanel DECLARE_EVENT_TABLE() }; - +wxDECLARE_EXPORTED_EVENT(WXEXPORT, wxEVT_IPEDIT_CHANGE, wxCommandEvent); #endif From f40a21dfdf55949ccdaea255e31486f6bd0a021e Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 10:54:15 +0000 Subject: [PATCH 07/15] improvement: disable input select when AoIP stream active --- pam2/pnlSettings.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pam2/pnlSettings.cpp b/pam2/pnlSettings.cpp index 5f32883e..edbe4e31 100644 --- a/pam2/pnlSettings.cpp +++ b/pam2/pnlSettings.cpp @@ -33,7 +33,7 @@ #include "dlgAoIP.h" #include "settingevent.h" #include "aoipsourcemanager.h" - +#include "log.h" #ifdef __NMOS__ #include "nmos.h" #endif // __NMOS__ @@ -297,12 +297,11 @@ void pnlSettings::UpdateDisplayedSettings() void pnlSettings::OnSettingChanged(SettingEvent& event) { - int nAoIP = Settings::Get().Read("Input", "AoIP", 0); bool bNmos = false; #ifdef __NMOS__ if(event.GetSection().CmpNoCase("NMOS") == 0 && event.GetKey() == "Node") { - bNmos = (event.GetValue(0L) != 0); + bNmos = (event.GetValue(0L) != NmosManager::NODE_OFF) && (event.GetValue(0L) != NmosManager::NODE_SENDER); EnableInputButtons(event.GetValue(0L)); } #endif @@ -312,7 +311,7 @@ void pnlSettings::OnSettingChanged(SettingEvent& event) { for(size_t i = 0; i < m_plstInput->GetItemCount(); i++) { - m_plstInput->EnableButton(i, (nAoIP != AoipSourceManager::SOURCE_MANUAL_A && nAoIP != AoipSourceManager::SOURCE_MANUAL_B)); + m_plstInput->EnableButton(i, (event.GetValue(0L) == 0 && i!=m_nNmosButton)); } } } @@ -414,6 +413,7 @@ void pnlSettings::ShowRTPDefined() m_plstDevices->Freeze(); m_plstDevices->Clear(); + m_plstDevices->AddButton("OFF", wxNullBitmap, (void*)0); for(auto pairSource : AoipSourceManager::Get().GetSources()) { if(pairSource.first > 0) @@ -486,6 +486,7 @@ void pnlSettings::RefreshInputs() } else if(sType == "AoIP Manual") { + Settings::Get().Write("Input", "AoIP", 0); //just gone on to this screen so disable the incoming stream m_pswpInput->ChangeSelection(1); ShowGain(false); From 1b26bfb4abf1bb28e7eada5ffb5706ce2d4af5bc Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 10:55:01 +0000 Subject: [PATCH 08/15] refac: move starting aoip input stream to separate function --- pambase/iomanager.cpp | 48 +++++++++++++++++++++++-------------------- pambase/iomanager.h | 1 + 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/pambase/iomanager.cpp b/pambase/iomanager.cpp index 5df2bd27..6bd93c6c 100644 --- a/pambase/iomanager.cpp +++ b/pambase/iomanager.cpp @@ -770,29 +770,9 @@ void IOManager::InitAudioInputDevice(bool bStart) CheckPlayback(SoundcardManager::Get().GetInputSampleRate(), SoundcardManager::Get().GetInputNumberOfChannels()); } - else if(sType == "AoIP" || sType == "AoIP Manual" || (sType == "NMOS" && !bStart)) + else if(sType == "AoIP" || (sType == "AoIP Manual") || (sType == "NMOS" && !bStart)) { - m_nInputSource = AudioEvent::RTP; - pmlLog(pml::LOG_INFO) << "IOManager\tCreate Audio Input Device: AoIP"; - - AoIPSource source(0); - source = AoipSourceManager::Get().FindSource(Settings::Get().Read(wxT("Input"), wxT("AoIP"), 0)); - - if(source.nIndex != 0 && m_mRtp.find(source.nIndex) == m_mRtp.end()) - { - m_nCurrentRtp = source.nIndex; - RtpThread* pThread = new RtpThread(this, Settings::Get().Read(wxT("AoIP_Settings"), wxT("Interface"), "eth0"), wxT("pam"), source, 2048); - pThread->Create(); - pThread->Run(); - - pThread->SetQosMeasurementIntervalMS(Settings::Get().Read(wxT("QoS"), wxT("Interval"), 1000)); - - m_mRtp.insert(make_pair(m_nCurrentRtp, pThread)); - } - else - { - pmlLog(pml::LOG_WARN) << "IOManager\tRTP Thread already running for source " << source.nIndex; - } + InitAoIPInput(); } else if(sType == wxT("Output")) { @@ -808,6 +788,30 @@ void IOManager::InitAudioInputDevice(bool bStart) } } +void IOManager::InitAoIPInput() +{ + m_nInputSource = AudioEvent::RTP; + pmlLog(pml::LOG_INFO) << "IOManager\tCreate Audio Input Device: AoIP"; + + AoIPSource source(0); + source = AoipSourceManager::Get().FindSource(Settings::Get().Read(wxT("Input"), wxT("AoIP"), 0)); + + if(source.nIndex != 0 && m_mRtp.find(source.nIndex) == m_mRtp.end()) + { + m_nCurrentRtp = source.nIndex; + RtpThread* pThread = new RtpThread(this, Settings::Get().Read(wxT("AoIP_Settings"), wxT("Interface"), "eth0"), wxT("pam"), source, 2048); + pThread->Create(); + pThread->Run(); + + pThread->SetQosMeasurementIntervalMS(Settings::Get().Read(wxT("QoS"), wxT("Interval"), 1000)); + + m_mRtp.insert(make_pair(m_nCurrentRtp, pThread)); + } + else + { + pmlLog(pml::LOG_WARN) << "IOManager\tRTP Thread already running for source " << source.nIndex; + } +} void IOManager::InitAudioOutputDevice() diff --git a/pambase/iomanager.h b/pambase/iomanager.h index 266a9a9b..d85d0d17 100644 --- a/pambase/iomanager.h +++ b/pambase/iomanager.h @@ -108,6 +108,7 @@ class PAMBASE_IMPEXPORT IOManager : public wxEvtHandler void DoGain(AudioEvent& event); void CheckIfGain(); + void InitAoIPInput(); std::set m_setHandlers; std::set m_setRTCPHandlers; From a7afa41b0612666c94bd9b62514691931949f8ed Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 11:27:54 +0000 Subject: [PATCH 09/15] feat: added optional RTCP --- pam2/pnlSettingsOutput.cpp | 55 ++++++++++++++++++++------ pam2/pnlSettingsOutput.h | 7 ++++ pam2/wxsmith/pnlSettingsOutput.wxs | 49 +++++++++++++++++------ pambase/AES67ServerMediaSubsession.cpp | 13 +++--- pambase/rtpserverthread.cpp | 46 ++++++++++++++------- pambase/rtpserverthread.h | 1 + 6 files changed, 129 insertions(+), 42 deletions(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 202c6164..1128d06b 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -35,8 +35,11 @@ const long pnlSettingsOutput::ID_M_PEDT3 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL7 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN7 = wxNewId(); const long pnlSettingsOutput::ID_M_PEDT2 = wxNewId(); +const long pnlSettingsOutput::ID_M_PBTN12 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN1 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN2 = wxNewId(); +const long pnlSettingsOutput::ID_M_PLBL14 = wxNewId(); +const long pnlSettingsOutput::ID_M_PLBL15 = wxNewId(); const long pnlSettingsOutput::ID_M_PKBD2 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL9 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN8 = wxNewId(); @@ -139,25 +142,38 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pedtRTSPPort = new wmEdit(pnlAoip, ID_M_PEDT3, wxEmptyString, wxPoint(350,10), wxSize(100,40), 0, wxDefaultValidator, _T("ID_M_PEDT3")); m_pedtRTSPPort->SetValidation(4); m_pedtRTSPPort->SetBorderStyle(1,1); - m_pLbl7 = new wmLabel(pnlAoip, ID_M_PLBL7, _("Packet Time"), wxPoint(0,100), wxSize(100,40), 0, _T("ID_M_PLBL7")); + m_pLbl7 = new wmLabel(pnlAoip, ID_M_PLBL7, _("Packet Time"), wxPoint(0,110), wxSize(100,40), 0, _T("ID_M_PLBL7")); m_pLbl7->SetBorderState(uiRect::BORDER_NONE); m_pLbl7->GetUiRect().SetGradient(0); m_pLbl7->SetForegroundColour(wxColour(255,255,255)); m_pLbl7->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnPacketTime = new wmButton(pnlAoip, ID_M_PBTN7, _("1 ms"), wxPoint(100,100), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN7")); + m_pbtnPacketTime = new wmButton(pnlAoip, ID_M_PBTN7, _("1 ms"), wxPoint(100,110), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN7")); m_pbtnPacketTime->SetForegroundColour(wxColour(0,0,0)); m_pbtnPacketTime->SetBackgroundColour(wxColour(255,255,255)); m_pedtRTPPort = new wmEdit(pnlAoip, ID_M_PEDT2, wxEmptyString, wxPoint(350,55), wxSize(100,40), 0, wxDefaultValidator, _T("ID_M_PEDT2")); m_pedtRTPPort->SetValidation(4); m_pedtRTPPort->SetBorderStyle(1,1); - m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(260,220), wxSize(135,40), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); + m_pbtnRTCP = new wmButton(pnlAoip, ID_M_PBTN12, _("RTCP"), wxPoint(455,55), wxSize(135,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN12")); + m_pbtnRTCP->SetBackgroundColour(wxColour(0,128,0)); + m_pbtnRTCP->SetToggle(true, wxT("Off"), wxT("On"), 50); + m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(260,220), wxSize(135,35), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnRestartStream->SetBackgroundColour(wxColour(255,0,0)); wxFont m_pbtnRestartStreamFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnRestartStream->SetFont(m_pbtnRestartStreamFont); - m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(455,220), wxSize(135,40), 0, wxDefaultValidator, _T("ID_M_PBTN2")); + m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(455,220), wxSize(135,35), 0, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnStats->SetBackgroundColour(wxColour(64,128,128)); wxFont m_pbtnStatsFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnStats->SetFont(m_pbtnStatsFont); + m_pLbl13 = new wmLabel(pnlAoip, ID_M_PLBL14, _("Stream Time"), wxPoint(260,265), wxSize(100,25), 0, _T("ID_M_PLBL14")); + m_pLbl13->SetBorderState(uiRect::BORDER_NONE); + m_pLbl13->GetUiRect().SetGradient(0); + m_pLbl13->SetForegroundColour(wxColour(255,255,255)); + m_pLbl13->SetBackgroundColour(wxColour(64,0,128)); + m_plblStreamTime = new wmLabel(pnlAoip, ID_M_PLBL15, wxEmptyString, wxPoint(360,265), wxSize(230,25), 0, _T("ID_M_PLBL15")); + m_plblStreamTime->SetBorderState(uiRect::BORDER_NONE); + m_plblStreamTime->GetUiRect().SetGradient(0); + m_plblStreamTime->SetForegroundColour(wxColour(0,0,0)); + m_plblStreamTime->SetBackgroundColour(wxColour(255,255,255)); m_pkbd = new wmKeyboard(pnlAoip, ID_M_PKBD2, wxPoint(10,174), wxSize(240,200), 5, 0); m_pkbd->SetForegroundColour(wxColour(255,255,255)); wxFont m_pkbdFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); @@ -178,33 +194,34 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(260,175), wxSize(330,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("On Demand"), wxT("Always On"), 40); - m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,100), wxSize(60,40), 0, _T("ID_M_PLBL12")); + m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,110), wxSize(60,40), 0, _T("ID_M_PLBL12")); m_pLbl11->SetBorderState(uiRect::BORDER_NONE); m_pLbl11->GetUiRect().SetGradient(0); m_pLbl11->SetForegroundColour(wxColour(255,255,255)); m_pLbl11->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(232,100), wxSize(50,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); + m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(232,110), wxSize(50,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); - m_pLbl12 = new wmLabel(pnlAoip, ID_M_PLBL13, _("Sample Rate"), wxPoint(284,100), wxSize(60,40), 0, _T("ID_M_PLBL13")); + m_pLbl12 = new wmLabel(pnlAoip, ID_M_PLBL13, _("Sample Rate"), wxPoint(284,110), wxSize(60,40), 0, _T("ID_M_PLBL13")); m_pLbl12->SetBorderState(uiRect::BORDER_NONE); m_pLbl12->GetUiRect().SetGradient(0); m_pLbl12->SetForegroundColour(wxColour(255,255,255)); m_pLbl12->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnSampleRate = new wmButton(pnlAoip, ID_M_PBTN10, _("48000"), wxPoint(344,100), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN10")); + m_pbtnSampleRate = new wmButton(pnlAoip, ID_M_PBTN10, _("48 kHz"), wxPoint(344,110), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN10")); m_pbtnSampleRate->Disable(); m_pbtnSampleRate->SetForegroundColour(wxColour(0,0,0)); m_pbtnSampleRate->SetBackgroundColour(wxColour(255,255,255)); - m_pbtnBits = new wmButton(pnlAoip, ID_M_PBTN11, _("Bits"), wxPoint(416,100), wxSize(174,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN11")); + m_pbtnBits = new wmButton(pnlAoip, ID_M_PBTN11, _("Bits"), wxPoint(416,110), wxSize(174,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN11")); m_pbtnBits->Disable(); m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); + m_pbtnBits->SetColourDisabled(wxColour(wxT("#606060"))); m_pbtnBits->SetToggle(true, wxT("16"), wxT("24"), 50); - m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTP Payload"), wxPoint(455,55), wxSize(70,40), 0, _T("ID_M_PLBL11")); + m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTP Payload"), wxPoint(455,10), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); m_pLbl8->SetForegroundColour(wxColour(255,255,255)); m_pLbl8->SetBackgroundColour(wxColour(64,0,128)); - m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(525,55), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); + m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(525,10), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); m_pswpDestination->AddPage(pnlDisabled, _("Disabled"), false); @@ -219,6 +236,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Connect(ID_M_PEDT3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlSettingsOutput::OnedtRTSPPortText); Connect(ID_M_PBTN7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnPacketTimeClick); Connect(ID_M_PEDT2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlSettingsOutput::OnedtRTPPortText); + Connect(ID_M_PBTN12,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRTCPClick); Connect(ID_M_PBTN1,wxEVT_BUTTON_HELD,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRestartStreamHeld); Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnStatsClick); Connect(ID_M_PBTN8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnDNSClick); @@ -264,6 +282,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Settings::Get().AddHandler(wxT("Server"), wxT("DNS-SD"), this); Settings::Get().AddHandler(wxT("Server"), wxT("RTPMap"), this); Settings::Get().AddHandler(wxT("Server"), wxT("Channels"), this); + Settings::Get().AddHandler(wxT("Server"), wxT("RTCP"), this); Connect(wxID_ANY, wxEVT_SETTING_CHANGED, (wxObjectEventFunction)&pnlSettingsOutput::OnSettingChanged); } @@ -312,6 +331,9 @@ void pnlSettingsOutput::UpdateDisplayedSettings() m_pbtnDNS->ToggleSelection(Settings::Get().Read("Server", "DNS-SD", 0), true); m_pbtnSAP->ToggleSelection(Settings::Get().Read("Server", "SAP", 0), true); + m_pbtnRTCP->ToggleSelection(Settings::Get().Read("Server", "RTCP", 0), true); + + m_pbtnStats->Show(m_pbtnRTCP->IsChecked()); double dGain = ConvertRatioToGain(Settings::Get().Read("Output", "Ratio_00", 1.0)); m_plblOutputGain->SetLabel(wxString::Format("%.2f dB", dGain)); @@ -319,6 +341,8 @@ void pnlSettingsOutput::UpdateDisplayedSettings() m_pbtnBits->ToggleSelection(Settings::Get().Read("Server", "Bits", 24) == 24); m_pbtnSampleRate->SetLabel(Settings::Get().Read("Server", "SampleRate", "48000")); + + } @@ -370,6 +394,10 @@ void pnlSettingsOutput::OnSettingChanged(SettingEvent& event) { m_pbtnChannels->SetLabel(event.GetValue()); } + else if(event.GetKey() == "RTCP") + { + m_pbtnStats->Show(event.GetValue(false)); + } } } @@ -601,3 +629,8 @@ void pnlSettingsOutput::OnbtnBitsClick(wxCommandEvent& event) { Settings::Get().Write("Server", "Bits", event.IsChecked() ? 24 : 16); } + +void pnlSettingsOutput::OnbtnRTCPClick(wxCommandEvent& event) +{ + Settings::Get().Write("Server", "RTCP", event.IsChecked() ? 1 : 0); +} diff --git a/pam2/pnlSettingsOutput.h b/pam2/pnlSettingsOutput.h index 0c9a0712..0d3aa0b9 100644 --- a/pam2/pnlSettingsOutput.h +++ b/pam2/pnlSettingsOutput.h @@ -31,6 +31,7 @@ class pnlSettingsOutput: public wxPanel wmButton* m_pbtnChannels; wmButton* m_pbtnDNS; wmButton* m_pbtnPacketTime; + wmButton* m_pbtnRTCP; wmButton* m_pbtnRTSP; wmButton* m_pbtnRestartStream; wmButton* m_pbtnRtpMap; @@ -44,6 +45,7 @@ class pnlSettingsOutput: public wxPanel wmLabel* m_pLbl10; wmLabel* m_pLbl11; wmLabel* m_pLbl12; + wmLabel* m_pLbl13; wmLabel* m_pLbl1; wmLabel* m_pLbl2; wmLabel* m_pLbl3; @@ -54,6 +56,7 @@ class pnlSettingsOutput: public wxPanel wmLabel* m_pLbl8; wmLabel* m_pLbl9; wmLabel* m_plblOutputGain; + wmLabel* m_plblStreamTime; wmList* m_plstDestination; wmList* m_plstLatency; wmList* m_plstPlayback; @@ -88,8 +91,11 @@ class pnlSettingsOutput: public wxPanel static const long ID_M_PLBL7; static const long ID_M_PBTN7; static const long ID_M_PEDT2; + static const long ID_M_PBTN12; static const long ID_M_PBTN1; static const long ID_M_PBTN2; + static const long ID_M_PLBL14; + static const long ID_M_PLBL15; static const long ID_M_PKBD2; static const long ID_M_PLBL9; static const long ID_M_PBTN8; @@ -127,6 +133,7 @@ class pnlSettingsOutput: public wxPanel void OnbtnPacketTimeClick(wxCommandEvent& event); void OnbtnSampleRateClick(wxCommandEvent& event); void OnbtnBitsClick(wxCommandEvent& event); + void OnbtnRTCPClick(wxCommandEvent& event); //*) void OnSettingChanged(SettingEvent& event); diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 3e77ce2b..0cd223cc 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -178,7 +178,7 @@ - 0,100 + 0,110 100,40 #FFFFFF #400080 @@ -188,7 +188,7 @@ Stop Start 50 - 100,100 + 100,110 70,40 #000000 #FFFFFF @@ -203,10 +203,22 @@ 100,40 + + + 1 + Off + On + 50 + 455,55 + 135,40 + #008000 + + + 260,220 - 135,40 + 135,35 #FF0000 12 @@ -222,7 +234,7 @@ 455,220 - 135,40 + 135,35 #408080 12 @@ -234,6 +246,20 @@ + + + 260,265 + 100,25 + #FFFFFF + #400080 + + + + 360,265 + 230,25 + #000000 + #FFFFFF + Calc 10,174 @@ -300,7 +326,7 @@ - 172,100 + 172,110 60,40 #FFFFFF #400080 @@ -310,7 +336,7 @@ Stop Start 50 - 232,100 + 232,110 50,40 #000000 #FFFFFF @@ -319,7 +345,7 @@ - 284,100 + 284,110 60,40 #FFFFFF #400080 @@ -329,7 +355,7 @@ Stop Start 50 - 344,100 + 344,110 70,40 0 #000000 @@ -339,11 +365,12 @@ + #606060 1 16 24 50 - 416,100 + 416,110 174,40 0 #008000 @@ -352,7 +379,7 @@ - 455,55 + 455,10 70,40 #FFFFFF #400080 @@ -362,7 +389,7 @@ Stop Start 50 - 525,55 + 525,10 65,40 #000000 #FFFFFF diff --git a/pambase/AES67ServerMediaSubsession.cpp b/pambase/AES67ServerMediaSubsession.cpp index 0167a61e..87ea26c2 100644 --- a/pambase/AES67ServerMediaSubsession.cpp +++ b/pambase/AES67ServerMediaSubsession.cpp @@ -23,7 +23,7 @@ AES67ServerMediaSubsession::AES67ServerMediaSubsession(const std::setsetRRHandler((TaskFunc*)MultiQOSMeasurement, reinterpret_cast(this)); - fRTCPInstance->setByeHandler((TaskFunc*)MultiByeHandler, reinterpret_cast(this)); - + if(fRTCPInstance) + { + g_multiSession = this; + fRTCPInstance->setRRHandler((TaskFunc*)MultiQOSMeasurement, reinterpret_cast(this)); + fRTCPInstance->setByeHandler((TaskFunc*)MultiByeHandler, reinterpret_cast(this)); + } } diff --git a/pambase/rtpserverthread.cpp b/pambase/rtpserverthread.cpp index 71b8cf72..6e0f76da 100644 --- a/pambase/rtpserverthread.cpp +++ b/pambase/rtpserverthread.cpp @@ -27,7 +27,7 @@ RtpServerThread::RtpServerThread(wxEvtHandler* pHandler, const std::setmulticastSendOnly(); // we're a SSM source - m_pRtcpGroupsock->multicastSendOnly(); // we're a SSM source + if(m_bRTCP) + { + m_pRtcpGroupsock->multicastSendOnly(); // we're a SSM source + } } @@ -113,15 +120,18 @@ bool RtpServerThread::CreateStream() // Create and start a RTSP server to serve this stream: pmlLog() << "RTP Server: Create RTSP Server on port " << m_nRTSPPort; m_pRtspServer = PamRTSPServer::createNew(*m_penv, m_nRTSPPort); - // Create (and start) a 'RTCP instance' for this RTP sink: - const unsigned int nEstimatedSessionBandwidth =( (m_pSource->samplingFrequency()*m_pSource->numChannels() * 3) + 500)/1000; // in kbps; for RTCP b/w share - const unsigned int nMaxCNAMElen = 100; - unsigned char CNAME[nMaxCNAMElen+1]; - gethostname((char*)CNAME, nMaxCNAMElen); - CNAME[nMaxCNAMElen] = '\0'; // just in case - m_pRtcpInstance = RTCPInstance::createNew(*m_penv, m_pRtcpGroupsock, nEstimatedSessionBandwidth, CNAME, m_pSink, NULL, True); + // Create (and start) a 'RTCP instance' for this RTP sink: + if(m_bRTCP) + { + const unsigned int nEstimatedSessionBandwidth =( (m_pSource->samplingFrequency()*m_pSource->numChannels() * 3) + 500)/1000; // in kbps; for RTCP b/w share + const unsigned int nMaxCNAMElen = 100; + unsigned char CNAME[nMaxCNAMElen+1]; + gethostname((char*)CNAME, nMaxCNAMElen); + CNAME[nMaxCNAMElen] = '\0'; // just in case + m_pRtcpInstance = RTCPInstance::createNew(*m_penv, m_pRtcpGroupsock, nEstimatedSessionBandwidth, CNAME, m_pSink, NULL, True); + } bool bOk(true); @@ -130,7 +140,7 @@ bool RtpServerThread::CreateStream() pmlLog(pml::LOG_ERROR) << "RTP Server\tFailed to create RTSP server: " << m_penv->getResultMsg(); bOk = false; } - if(m_pRtcpInstance == nullptr) + if(m_pRtcpInstance == nullptr && m_bRTCP) { pmlLog(pml::LOG_ERROR) << "RTP Server\tFailed to create RTCP Instance: " << m_penv->getResultMsg(); bOk = false; @@ -145,13 +155,18 @@ bool RtpServerThread::CreateStream() m_bStreaming = false; delete m_pRtpGroupsock; m_pRtpGroupsock = nullptr; + if(m_pRtcpGroupsock) + { + delete m_pRtcpGroupsock; + } + m_pRtcpGroupsock = nullptr; return false; } wxString sStream = "by-name/"+ IOManager::Get().GetDnsSdService(); - ServerMediaSession* sms = ServerMediaSession::createNew(*m_penv, sStream, nullptr, "PAM_AES67", True/*SSM*/); + ServerMediaSession* sms = ServerMediaSession::createNew(*m_penv, sStream, nullptr, "PAM AES67", m_bSSM); AES67ServerMediaSubsession* pSmss = AES67ServerMediaSubsession::createNew(m_setRTCPHandlers, *m_pSink, m_pRtcpInstance, m_ePacketTime); sms->addSubsession(pSmss); m_pRtspServer->addServerMediaSession(sms); @@ -190,8 +205,11 @@ void RtpServerThread::CloseStream() Medium::close(m_pSink); delete m_pRtpGroupsock; Medium::close(m_pSource); - Medium::close(m_pRtcpInstance); - delete m_pRtcpGroupsock; + if(m_pRtcpInstance) + { + Medium::close(m_pRtcpInstance); + delete m_pRtcpGroupsock; + } m_pSource = nullptr; m_pSink = nullptr; m_pRtpGroupsock = nullptr; diff --git a/pambase/rtpserverthread.h b/pambase/rtpserverthread.h index c3ddf8f7..9dc7f690 100644 --- a/pambase/rtpserverthread.h +++ b/pambase/rtpserverthread.h @@ -58,5 +58,6 @@ class PAMBASE_IMPEXPORT RtpServerThread : public wxThread PamRTSPServer* m_pRtspServer; std::string m_sSDP; bool m_bStreaming; + bool m_bRTCP; }; From d337e2c71195e6251e67436a3161bd2f0fbe3a68 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:05:03 +0000 Subject: [PATCH 10/15] improvement: added a button to activate the streaming server --- pam2/pnlSettingsOutput.cpp | 78 +++++++++++++++++------------- pam2/pnlSettingsOutput.h | 10 ++-- pam2/wxsmith/pnlSettingsOutput.wxs | 48 ++++++------------ pambase/iomanager.cpp | 42 +++++++++++----- 4 files changed, 92 insertions(+), 86 deletions(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 1128d06b..7e770f65 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -36,15 +36,13 @@ const long pnlSettingsOutput::ID_M_PLBL7 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN7 = wxNewId(); const long pnlSettingsOutput::ID_M_PEDT2 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN12 = wxNewId(); -const long pnlSettingsOutput::ID_M_PBTN1 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN2 = wxNewId(); -const long pnlSettingsOutput::ID_M_PLBL14 = wxNewId(); -const long pnlSettingsOutput::ID_M_PLBL15 = wxNewId(); const long pnlSettingsOutput::ID_M_PKBD2 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL9 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN8 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN9 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN3 = wxNewId(); +const long pnlSettingsOutput::ID_M_PBTN1 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL12 = wxNewId(); const long pnlSettingsOutput::ID_M_PBTN5 = wxNewId(); const long pnlSettingsOutput::ID_M_PLBL13 = wxNewId(); @@ -155,25 +153,11 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pedtRTPPort->SetBorderStyle(1,1); m_pbtnRTCP = new wmButton(pnlAoip, ID_M_PBTN12, _("RTCP"), wxPoint(455,55), wxSize(135,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN12")); m_pbtnRTCP->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnRTCP->SetToggle(true, wxT("Off"), wxT("On"), 50); - m_pbtnRestartStream = new wmButton(pnlAoip, ID_M_PBTN1, _("Hold To Restart"), wxPoint(260,220), wxSize(135,35), wmButton::STYLE_HOLD, wxDefaultValidator, _T("ID_M_PBTN1")); - m_pbtnRestartStream->SetBackgroundColour(wxColour(255,0,0)); - wxFont m_pbtnRestartStreamFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); - m_pbtnRestartStream->SetFont(m_pbtnRestartStreamFont); - m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(455,220), wxSize(135,35), 0, wxDefaultValidator, _T("ID_M_PBTN2")); + m_pbtnRTCP->SetToggleLook(true, wxT("Off"), wxT("On"), 50); + m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(358,255), wxSize(135,35), 0, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnStats->SetBackgroundColour(wxColour(64,128,128)); wxFont m_pbtnStatsFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); m_pbtnStats->SetFont(m_pbtnStatsFont); - m_pLbl13 = new wmLabel(pnlAoip, ID_M_PLBL14, _("Stream Time"), wxPoint(260,265), wxSize(100,25), 0, _T("ID_M_PLBL14")); - m_pLbl13->SetBorderState(uiRect::BORDER_NONE); - m_pLbl13->GetUiRect().SetGradient(0); - m_pLbl13->SetForegroundColour(wxColour(255,255,255)); - m_pLbl13->SetBackgroundColour(wxColour(64,0,128)); - m_plblStreamTime = new wmLabel(pnlAoip, ID_M_PLBL15, wxEmptyString, wxPoint(360,265), wxSize(230,25), 0, _T("ID_M_PLBL15")); - m_plblStreamTime->SetBorderState(uiRect::BORDER_NONE); - m_plblStreamTime->GetUiRect().SetGradient(0); - m_plblStreamTime->SetForegroundColour(wxColour(0,0,0)); - m_plblStreamTime->SetBackgroundColour(wxColour(255,255,255)); m_pkbd = new wmKeyboard(pnlAoip, ID_M_PKBD2, wxPoint(10,174), wxSize(240,200), 5, 0); m_pkbd->SetForegroundColour(wxColour(255,255,255)); wxFont m_pkbdFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); @@ -187,13 +171,16 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pLbl10->SetFont(m_pLbl10Font); m_pbtnDNS = new wmButton(pnlAoip, ID_M_PBTN8, _("mDNS-SD"), wxPoint(260,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN8")); m_pbtnDNS->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnDNS->SetToggle(true, wxT("Off"), wxT("On"), 60); + m_pbtnDNS->SetToggleLook(true, wxT("Off"), wxT("On"), 60); m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(430,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); m_pbtnSAP->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 60); - m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(260,175), wxSize(330,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); + m_pbtnSAP->SetToggleLook(true, wxT("Off"), wxT("On"), 60); + m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Server"), wxPoint(260,175), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnStream->SetToggle(true, wxT("On Demand"), wxT("Always On"), 40); + m_pbtnStream->SetToggleLook(true, wxT("On Demand"), wxT("Always On"), 40); + m_pbtnActive = new wmButton(pnlAoip, ID_M_PBTN1, _("Stream"), wxPoint(260,215), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN1")); + m_pbtnActive->SetBackgroundColour(wxColour(0,128,0)); + m_pbtnActive->SetToggleLook(true, wxT("Inactive"), wxT("Active"), 40); m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,110), wxSize(60,40), 0, _T("ID_M_PLBL12")); m_pLbl11->SetBorderState(uiRect::BORDER_NONE); m_pLbl11->GetUiRect().SetGradient(0); @@ -215,7 +202,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnBits->Disable(); m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); m_pbtnBits->SetColourDisabled(wxColour(wxT("#606060"))); - m_pbtnBits->SetToggle(true, wxT("16"), wxT("24"), 50); + m_pbtnBits->SetToggleLook(true, wxT("16"), wxT("24"), 50); m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTP Payload"), wxPoint(455,10), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); @@ -237,11 +224,11 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Connect(ID_M_PBTN7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnPacketTimeClick); Connect(ID_M_PEDT2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&pnlSettingsOutput::OnedtRTPPortText); Connect(ID_M_PBTN12,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRTCPClick); - Connect(ID_M_PBTN1,wxEVT_BUTTON_HELD,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnRestartStreamHeld); Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnStatsClick); Connect(ID_M_PBTN8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnDNSClick); Connect(ID_M_PBTN9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnSAPClick); Connect(ID_M_PBTN3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnStreamClick); + Connect(ID_M_PBTN1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnActiveClick); Connect(ID_M_PBTN5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnChannelsClick); Connect(ID_M_PBTN10,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnSampleRateClick); Connect(ID_M_PBTN11,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlSettingsOutput::OnbtnBitsClick); @@ -283,6 +270,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin Settings::Get().AddHandler(wxT("Server"), wxT("RTPMap"), this); Settings::Get().AddHandler(wxT("Server"), wxT("Channels"), this); Settings::Get().AddHandler(wxT("Server"), wxT("RTCP"), this); + Settings::Get().AddHandler(wxT("Server"), wxT("State"), this); Connect(wxID_ANY, wxEVT_SETTING_CHANGED, (wxObjectEventFunction)&pnlSettingsOutput::OnSettingChanged); } @@ -342,7 +330,8 @@ void pnlSettingsOutput::UpdateDisplayedSettings() m_pbtnBits->ToggleSelection(Settings::Get().Read("Server", "Bits", 24) == 24); m_pbtnSampleRate->SetLabel(Settings::Get().Read("Server", "SampleRate", "48000")); - + m_pbtnActive->ToggleSelection(Settings::Get().Read("Server", "State", 0) == 1); + EnableStreamSettings(); } @@ -398,12 +387,17 @@ void pnlSettingsOutput::OnSettingChanged(SettingEvent& event) { m_pbtnStats->Show(event.GetValue(false)); } + else if(event.GetKey() == "State") + { + m_pbtnActive->ToggleSelection(event.GetValue(false), false); + EnableStreamSettings(); + } } } void pnlSettingsOutput::OnlstDestinationSelected(wxCommandEvent& event) { - Settings::Get().Write(wxT("Output"), wxT("Destination"), event.GetString()); + Settings::Get().Write(wxT("Output"), wxT("Destination"), event.GetString()); m_plstPlayback->Enable(event.GetString()!=wxT("Disabled")); m_pswpDestination->ChangeSelection(event.GetString()); } @@ -428,12 +422,6 @@ void pnlSettingsOutput::OnbtnStreamClick(wxCommandEvent& event) Settings::Get().Write(wxT("Server"), wxT("DestinationIp"), m_ppnlAddress->GetValue()); Settings::Get().Write(wxT("Server"), wxT("Stream"), "AlwaysOn"); } - /*m_ppnlAddress->Enable((event.IsChecked() == false)); - m_pedtRTSPPort->Enable((event.IsChecked() == false)); - m_pedtRTPPort->Enable((event.IsChecked() == false)); - m_plstPacket->Enable((event.IsChecked() == false)); - m_pkbd->Enable((event.IsChecked() == false));*/ - } void pnlSettingsOutput::OnlstPacketSelected(wxCommandEvent& event) @@ -543,7 +531,6 @@ double pnlSettingsOutput::ConvertRatioToGain(double dRatio) void pnlSettingsOutput::OnbtnRestartStreamHeld(wxCommandEvent& event) { - IOManager::Get().RestartStream(); } void pnlSettingsOutput::OnbtnStatsClick(wxCommandEvent& event) @@ -634,3 +621,26 @@ void pnlSettingsOutput::OnbtnRTCPClick(wxCommandEvent& event) { Settings::Get().Write("Server", "RTCP", event.IsChecked() ? 1 : 0); } + +void pnlSettingsOutput::OnbtnActiveClick(wxCommandEvent& event) +{ + Settings::Get().Write("Server", "State", event.IsChecked() ? "1" : "0"); + EnableStreamSettings(); +} + +void pnlSettingsOutput::EnableStreamSettings() +{ + m_ppnlAddress->Enable(!m_pbtnActive->IsChecked()); + m_pbtnRTSP->Enable(!m_pbtnActive->IsChecked()); + m_pedtRTSPPort->Enable(!m_pbtnActive->IsChecked()); + m_pbtnPacketTime->Enable(!m_pbtnActive->IsChecked()); + m_pedtRTPPort->Enable(!m_pbtnActive->IsChecked()); + m_pbtnRTCP->Enable(!m_pbtnActive->IsChecked()); + m_pbtnStats->Enable(m_pbtnActive->IsChecked()); + m_pbtnDNS->Enable(!m_pbtnActive->IsChecked()); + m_pbtnSAP->Enable(!m_pbtnActive->IsChecked()); + m_pbtnChannels->Enable(!m_pbtnActive->IsChecked()); + m_pbtnRtpMap->Enable(!m_pbtnActive->IsChecked()); + //m_pbtnSampleRate->Enable(!m_pbtnActive->IsChecked()); + //m_pbtnBits->Enable(!m_pbtnActive->IsChecked()); +} diff --git a/pam2/pnlSettingsOutput.h b/pam2/pnlSettingsOutput.h index 0d3aa0b9..be6b1ee0 100644 --- a/pam2/pnlSettingsOutput.h +++ b/pam2/pnlSettingsOutput.h @@ -27,13 +27,13 @@ class pnlSettingsOutput: public wxPanel void ShowSoundcardOutputs(); //(*Declarations(pnlSettingsOutput) + wmButton* m_pbtnActive; wmButton* m_pbtnBits; wmButton* m_pbtnChannels; wmButton* m_pbtnDNS; wmButton* m_pbtnPacketTime; wmButton* m_pbtnRTCP; wmButton* m_pbtnRTSP; - wmButton* m_pbtnRestartStream; wmButton* m_pbtnRtpMap; wmButton* m_pbtnSAP; wmButton* m_pbtnSampleRate; @@ -45,7 +45,6 @@ class pnlSettingsOutput: public wxPanel wmLabel* m_pLbl10; wmLabel* m_pLbl11; wmLabel* m_pLbl12; - wmLabel* m_pLbl13; wmLabel* m_pLbl1; wmLabel* m_pLbl2; wmLabel* m_pLbl3; @@ -56,7 +55,6 @@ class pnlSettingsOutput: public wxPanel wmLabel* m_pLbl8; wmLabel* m_pLbl9; wmLabel* m_plblOutputGain; - wmLabel* m_plblStreamTime; wmList* m_plstDestination; wmList* m_plstLatency; wmList* m_plstPlayback; @@ -92,15 +90,13 @@ class pnlSettingsOutput: public wxPanel static const long ID_M_PBTN7; static const long ID_M_PEDT2; static const long ID_M_PBTN12; - static const long ID_M_PBTN1; static const long ID_M_PBTN2; - static const long ID_M_PLBL14; - static const long ID_M_PLBL15; static const long ID_M_PKBD2; static const long ID_M_PLBL9; static const long ID_M_PBTN8; static const long ID_M_PBTN9; static const long ID_M_PBTN3; + static const long ID_M_PBTN1; static const long ID_M_PLBL12; static const long ID_M_PBTN5; static const long ID_M_PLBL13; @@ -134,6 +130,7 @@ class pnlSettingsOutput: public wxPanel void OnbtnSampleRateClick(wxCommandEvent& event); void OnbtnBitsClick(wxCommandEvent& event); void OnbtnRTCPClick(wxCommandEvent& event); + void OnbtnActiveClick(wxCommandEvent& event); //*) void OnSettingChanged(SettingEvent& event); @@ -143,6 +140,7 @@ class pnlSettingsOutput: public wxPanel DECLARE_EVENT_TABLE() void UpdateDisplayedSettings(); + void EnableStreamSettings(); }; #endif diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 0cd223cc..2b3a5c6a 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -215,25 +215,9 @@ - - - 260,220 - 135,35 - #FF0000 - - 12 - - normal - 0 - swiss - Tahoma - - - - - 455,220 + 358,255 135,35 #408080 @@ -246,20 +230,6 @@ - - - 260,265 - 100,25 - #FFFFFF - #400080 - - - - 360,265 - 230,25 - #000000 - #FFFFFF - Calc 10,174 @@ -313,17 +283,29 @@ - + 1 On Demand Always On 40 260,175 - 330,40 + 330,35 #008000 + + + 1 + Inactive + Active + 40 + 260,215 + 330,35 + #008000 + + + 172,110 diff --git a/pambase/iomanager.cpp b/pambase/iomanager.cpp index 6bd93c6c..82834456 100644 --- a/pambase/iomanager.cpp +++ b/pambase/iomanager.cpp @@ -127,6 +127,7 @@ IOManager::IOManager() : Settings::Get().AddHandler(wxT("Server"), wxT("Stream"), this); Settings::Get().AddHandler(wxT("Server"), wxT("SAP"), this); Settings::Get().AddHandler(wxT("Server"), wxT("DNS-SD"), this); + Settings::Get().AddHandler(wxT("Server"), wxT("State"), this); Connect(wxID_ANY,wxEVT_DATA,(wxObjectEventFunction)&IOManager::OnAudioEvent); Connect(wxID_ANY,wxEVT_RTP_SESSION,(wxObjectEventFunction)&IOManager::OnRTPSession); @@ -290,6 +291,17 @@ void IOManager::OnSettingEvent(SettingEvent& event) } InitAudioOutputDevice(); } + else if(event.GetKey() == "State") + { + if(event.GetValue(false)) + { + InitAudioOutputDevice(); + } + else + { + StopStream(); + } + } else if(event.GetKey() == wxT("SAP")) { DoSAP(event.GetValue(false)); @@ -824,7 +836,7 @@ void IOManager::InitAudioOutputDevice() OpenSoundcardDevice(SoundcardManager::Get().GetOutputSampleRate()); m_nOutputDestination = AudioEvent::SOUNDCARD; - + //turn off any advertising of stream DoSAP(false); @@ -903,7 +915,7 @@ void IOManager::UpdateOutputSession() if(m_SessionOut.lstSubsession.back().nSampleRate != nSampleRate || m_SessionOut.lstSubsession.back().nChannels != nChannels) { m_SessionOut.lstSubsession.back().nSampleRate = nSampleRate; - m_SessionOut.lstSubsession.back().nChannels = nChannels; + m_SessionOut.lstSubsession.back().nChannels = nChannels; SessionChanged(); } } @@ -1144,18 +1156,22 @@ void IOManager::RTPServerFinished() void IOManager::Stream() { - if(m_bStreamAlwaysOn || (Settings::Get().Read("NMOS", "Node", 0) == 2 || Settings::Get().Read("NMOS", "Node", 0) == 3)) //@todo bodge for NMOS - { - StreamAlwaysOn(); - DoSAP(Settings::Get().Read("Server", "SAP",0)); - } - else + bool bNmos = (Settings::Get().Read("NMOS", "Node", 0) == 2 || Settings::Get().Read("NMOS", "Node", 0) == 3); + + if(Settings::Get().Read("Server", "State", 0) == 1 || bNmos) //set to stream { - StreamOnDemand(); - DoSAP(false); + if(m_bStreamAlwaysOn || bNmos) //@todo bodge for NMOS + { + StreamAlwaysOn(); + DoSAP(Settings::Get().Read("Server", "SAP",0)); + } + else + { + StreamOnDemand(); + DoSAP(false); + } + DoDNSSD(Settings::Get().Read("Server", "DNS-SD", 0)); } - - DoDNSSD(Settings::Get().Read("Server", "DNS-SD", 0)); } void IOManager::StreamAlwaysOn() @@ -1233,6 +1249,6 @@ void IOManager::OnTimerReset(wxTimerEvent& event) wxString IOManager::GetDnsSdService() const { - return "AES67@"+wxGetHostName(); + return "AES67@"+wxGetHostName(); } From 4b0d964357583a5fc26b528a878795b628b0ae31 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:05:51 +0000 Subject: [PATCH 11/15] fix: settoggle --- pam2/pnlSettingsOutput.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 7e770f65..df5a676a 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -153,7 +153,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pedtRTPPort->SetBorderStyle(1,1); m_pbtnRTCP = new wmButton(pnlAoip, ID_M_PBTN12, _("RTCP"), wxPoint(455,55), wxSize(135,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN12")); m_pbtnRTCP->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnRTCP->SetToggleLook(true, wxT("Off"), wxT("On"), 50); + m_pbtnRTCP->SetToggle(true, wxT("Off"), wxT("On"), 50); m_pbtnStats = new wmButton(pnlAoip, ID_M_PBTN2, _("RTCP Stats"), wxPoint(358,255), wxSize(135,35), 0, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnStats->SetBackgroundColour(wxColour(64,128,128)); wxFont m_pbtnStatsFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Tahoma"),wxFONTENCODING_DEFAULT); @@ -171,16 +171,16 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pLbl10->SetFont(m_pLbl10Font); m_pbtnDNS = new wmButton(pnlAoip, ID_M_PBTN8, _("mDNS-SD"), wxPoint(260,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN8")); m_pbtnDNS->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnDNS->SetToggleLook(true, wxT("Off"), wxT("On"), 60); + m_pbtnDNS->SetToggle(true, wxT("Off"), wxT("On"), 60); m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(430,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); m_pbtnSAP->SetBackgroundColour(wxColour(61,120,218)); - m_pbtnSAP->SetToggleLook(true, wxT("Off"), wxT("On"), 60); + m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 60); m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Server"), wxPoint(260,175), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnStream->SetToggleLook(true, wxT("On Demand"), wxT("Always On"), 40); + m_pbtnStream->SetToggle(true, wxT("On Demand"), wxT("Always On"), 40); m_pbtnActive = new wmButton(pnlAoip, ID_M_PBTN1, _("Stream"), wxPoint(260,215), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnActive->SetBackgroundColour(wxColour(0,128,0)); - m_pbtnActive->SetToggleLook(true, wxT("Inactive"), wxT("Active"), 40); + m_pbtnActive->SetToggle(true, wxT("Inactive"), wxT("Active"), 40); m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,110), wxSize(60,40), 0, _T("ID_M_PLBL12")); m_pLbl11->SetBorderState(uiRect::BORDER_NONE); m_pLbl11->GetUiRect().SetGradient(0); @@ -202,7 +202,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnBits->Disable(); m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); m_pbtnBits->SetColourDisabled(wxColour(wxT("#606060"))); - m_pbtnBits->SetToggleLook(true, wxT("16"), wxT("24"), 50); + m_pbtnBits->SetToggle(true, wxT("16"), wxT("24"), 50); m_pLbl8 = new wmLabel(pnlAoip, ID_M_PLBL11, _("RTP Payload"), wxPoint(455,10), wxSize(70,40), 0, _T("ID_M_PLBL11")); m_pLbl8->SetBorderState(uiRect::BORDER_NONE); m_pLbl8->GetUiRect().SetGradient(0); From 0cf4d6f02af20eb7f338c92d43082a3700072f53 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:16:30 +0000 Subject: [PATCH 12/15] improvement: disable server button when streaming --- pam2/pnlSettingsOutput.cpp | 7 +++++++ pam2/wxsmith/pnlSettingsOutput.wxs | 5 +++++ pambase/iomanager.cpp | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index df5a676a..59d6b4b0 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -132,6 +132,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnRTSP = new wmButton(pnlAoip, ID_M_PBTN6, _("eth0"), wxPoint(100,10), wxSize(200,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN6")); m_pbtnRTSP->SetForegroundColour(wxColour(0,0,0)); m_pbtnRTSP->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnRTSP->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pLbl6 = new wmLabel(pnlAoip, ID_M_PLBL6, _("Port"), wxPoint(300,10), wxSize(50,40), 0, _T("ID_M_PLBL6")); m_pLbl6->SetBorderState(uiRect::BORDER_NONE); m_pLbl6->GetUiRect().SetGradient(0); @@ -148,6 +149,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnPacketTime = new wmButton(pnlAoip, ID_M_PBTN7, _("1 ms"), wxPoint(100,110), wxSize(70,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN7")); m_pbtnPacketTime->SetForegroundColour(wxColour(0,0,0)); m_pbtnPacketTime->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnPacketTime->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pedtRTPPort = new wmEdit(pnlAoip, ID_M_PEDT2, wxEmptyString, wxPoint(350,55), wxSize(100,40), 0, wxDefaultValidator, _T("ID_M_PEDT2")); m_pedtRTPPort->SetValidation(4); m_pedtRTPPort->SetBorderStyle(1,1); @@ -189,6 +191,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnChannels = new wmButton(pnlAoip, ID_M_PBTN5, _("2"), wxPoint(232,110), wxSize(50,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN5")); m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnChannels->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pLbl12 = new wmLabel(pnlAoip, ID_M_PLBL13, _("Sample Rate"), wxPoint(284,110), wxSize(60,40), 0, _T("ID_M_PLBL13")); m_pLbl12->SetBorderState(uiRect::BORDER_NONE); m_pLbl12->GetUiRect().SetGradient(0); @@ -198,6 +201,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnSampleRate->Disable(); m_pbtnSampleRate->SetForegroundColour(wxColour(0,0,0)); m_pbtnSampleRate->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnSampleRate->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pbtnBits = new wmButton(pnlAoip, ID_M_PBTN11, _("Bits"), wxPoint(416,110), wxSize(174,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN11")); m_pbtnBits->Disable(); m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); @@ -211,6 +215,7 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnRtpMap = new wmButton(pnlAoip, ID_M_PBTN4, _("96"), wxPoint(525,10), wxSize(65,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnRtpMap->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pswpDestination->AddPage(pnlDisabled, _("Disabled"), false); m_pswpDestination->AddPage(pnlSoundcard, _("Soundcard"), false); m_pswpDestination->AddPage(pnlAoip, _("AoIP"), false); @@ -641,6 +646,8 @@ void pnlSettingsOutput::EnableStreamSettings() m_pbtnSAP->Enable(!m_pbtnActive->IsChecked()); m_pbtnChannels->Enable(!m_pbtnActive->IsChecked()); m_pbtnRtpMap->Enable(!m_pbtnActive->IsChecked()); + m_pbtnStream->Enable(!m_pbtnActive->IsChecked()); + //m_pbtnSampleRate->Enable(!m_pbtnActive->IsChecked()); //m_pbtnBits->Enable(!m_pbtnActive->IsChecked()); } diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 2b3a5c6a..28662cc8 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -151,6 +151,7 @@ + #B0B0B0 Stop Start 50 @@ -185,6 +186,7 @@ + #B0B0B0 Stop Start 50 @@ -315,6 +317,7 @@ + #B0B0B0 Stop Start 50 @@ -334,6 +337,7 @@ + #B0B0B0 Stop Start 50 @@ -368,6 +372,7 @@ + #B0B0B0 Stop Start 50 diff --git a/pambase/iomanager.cpp b/pambase/iomanager.cpp index 82834456..2fdc2a8f 100644 --- a/pambase/iomanager.cpp +++ b/pambase/iomanager.cpp @@ -509,7 +509,6 @@ void IOManager::OutputDestinationChanged() void IOManager::OutputChanged(const wxString& sKey) { - if(sKey == wxT("Destination")) { OutputDestinationChanged(); From 6788510e7632680a43813769ff7eff136a4f67e2 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:29:33 +0000 Subject: [PATCH 13/15] improvement: disable sample rate button when stream active --- pam2/pnlAoipManual.cpp | 7 +++++-- pam2/pnlAoipManual.h | 2 +- pam2/wxsmith/pnlAoipManual.wxs | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pam2/pnlAoipManual.cpp b/pam2/pnlAoipManual.cpp index ac681eca..63ca68c8 100644 --- a/pam2/pnlAoipManual.cpp +++ b/pam2/pnlAoipManual.cpp @@ -58,6 +58,7 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pbtnSampleRate = new wmButton(this, ID_M_PBTN6, _("48000"), wxPoint(110,60), wxSize(92,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN6")); m_pbtnSampleRate->SetForegroundColour(wxColour(0,0,0)); m_pbtnSampleRate->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnSampleRate->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pbtnBits = new wmButton(this, ID_M_PBTN1, _("Bits"), wxPoint(260,60), wxSize(200,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnBits->SetBackgroundColour(wxColour(0,128,0)); m_pbtnBits->SetToggle(true, wxT("16"), wxT("24"), 40); @@ -69,11 +70,12 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pbtnChannels = new wmButton(this, ID_M_PBTN2, _("2"), wxPoint(110,105), wxSize(92,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN2")); m_pbtnChannels->SetForegroundColour(wxColour(0,0,0)); m_pbtnChannels->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnChannels->SetColourDisabled(wxColour(wxT("#B0B0B0"))); m_pkbd = new wmKeyboard(this, ID_M_PKBD2, wxPoint(10,160), wxSize(240,200), 5, 0); m_pkbd->SetForegroundColour(wxColour(255,255,255)); wxFont m_pkbdFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); m_pkbd->SetFont(m_pkbdFont); - m_pbtnStream = new wmButton(this, ID_M_PBTN3, _("Receive"), wxPoint(300,320), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); + m_pbtnStream = new wmButton(this, ID_M_PBTN3, _("Receive"), wxPoint(260,161), wxSize(268,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("Stop"), wxT("Start"), 40); m_pLbl8 = new wmLabel(this, ID_M_PLBL11, _("RTP Payload"), wxPoint(260,105), wxSize(70,40), 0, _T("ID_M_PLBL11")); @@ -84,12 +86,12 @@ pnlAoipManual::pnlAoipManual(wxWindow* parent,wxWindowID id,const wxPoint& pos,c m_pbtnRtpMap = new wmButton(this, ID_M_PBTN4, _("96"), wxPoint(330,105), wxSize(80,40), wmButton::STYLE_NORMAL, wxDefaultValidator, _T("ID_M_PBTN4")); m_pbtnRtpMap->SetForegroundColour(wxColour(0,0,0)); m_pbtnRtpMap->SetBackgroundColour(wxColour(255,255,255)); + m_pbtnRtpMap->SetColourDisabled(wxColour(wxT("#B0B0B0"))); Connect(ID_M_PBTN6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnSampleRateClick); Connect(ID_M_PBTN2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnChannelsClick); Connect(ID_M_PBTN3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnStreamClick); Connect(ID_M_PBTN4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&pnlAoipManual::OnbtnRtpMapClick); - //*) SetSize(size); SetPosition(pos); @@ -140,6 +142,7 @@ void pnlAoipManual::OnbtnStreamClick(wxCommandEvent& event) m_pipServer->Enable(event.IsChecked() == false); m_pkbd->Enable(event.IsChecked() == false); m_pedtPort->Enable(event.IsChecked() == false); + m_pbtnSampleRate->Enable(event.IsChecked() == false); if(event.IsChecked()) { diff --git a/pam2/pnlAoipManual.h b/pam2/pnlAoipManual.h index bb74f112..829d8629 100644 --- a/pam2/pnlAoipManual.h +++ b/pam2/pnlAoipManual.h @@ -63,7 +63,7 @@ class pnlAoipManual: public wxPanel void OnIpChanged(wxCommandEvent& event); void OnedtRTPPort(wxCommandEvent& event); - + DECLARE_EVENT_TABLE() }; diff --git a/pam2/wxsmith/pnlAoipManual.wxs b/pam2/wxsmith/pnlAoipManual.wxs index aa6b9c37..57eab816 100644 --- a/pam2/wxsmith/pnlAoipManual.wxs +++ b/pam2/wxsmith/pnlAoipManual.wxs @@ -36,6 +36,7 @@ + #B0B0B0 Stop Start 50 @@ -66,6 +67,7 @@ + #B0B0B0 Stop Start 50 @@ -96,7 +98,7 @@ Stop Start 40 - 300,320 + 260,161 268,40 #008000 @@ -111,6 +113,7 @@ + #B0B0B0 Stop Start 50 From 65d33834a5f1a0bdd56534a7fc9e98482b03cf5f Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:44:52 +0000 Subject: [PATCH 14/15] improvement: swapped stream/server labels over --- pam2/pnlSettingsOutput.cpp | 4 ++-- pam2/wxsmith/pnlSettingsOutput.wxs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pam2/pnlSettingsOutput.cpp b/pam2/pnlSettingsOutput.cpp index 59d6b4b0..d7c8afd4 100644 --- a/pam2/pnlSettingsOutput.cpp +++ b/pam2/pnlSettingsOutput.cpp @@ -177,10 +177,10 @@ pnlSettingsOutput::pnlSettingsOutput(wxWindow* parent,wxWindowID id,const wxPoin m_pbtnSAP = new wmButton(pnlAoip, ID_M_PBTN9, _("SAP"), wxPoint(430,330), wxSize(160,40), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN9")); m_pbtnSAP->SetBackgroundColour(wxColour(61,120,218)); m_pbtnSAP->SetToggle(true, wxT("Off"), wxT("On"), 60); - m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Server"), wxPoint(260,175), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); + m_pbtnStream = new wmButton(pnlAoip, ID_M_PBTN3, _("Stream"), wxPoint(260,175), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN3")); m_pbtnStream->SetBackgroundColour(wxColour(0,128,0)); m_pbtnStream->SetToggle(true, wxT("On Demand"), wxT("Always On"), 40); - m_pbtnActive = new wmButton(pnlAoip, ID_M_PBTN1, _("Stream"), wxPoint(260,215), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN1")); + m_pbtnActive = new wmButton(pnlAoip, ID_M_PBTN1, _("Server"), wxPoint(260,215), wxSize(330,35), wmButton::STYLE_SELECT, wxDefaultValidator, _T("ID_M_PBTN1")); m_pbtnActive->SetBackgroundColour(wxColour(0,128,0)); m_pbtnActive->SetToggle(true, wxT("Inactive"), wxT("Active"), 40); m_pLbl11 = new wmLabel(pnlAoip, ID_M_PLBL12, _("Channels"), wxPoint(172,110), wxSize(60,40), 0, _T("ID_M_PLBL12")); diff --git a/pam2/wxsmith/pnlSettingsOutput.wxs b/pam2/wxsmith/pnlSettingsOutput.wxs index 28662cc8..6e09b3c9 100644 --- a/pam2/wxsmith/pnlSettingsOutput.wxs +++ b/pam2/wxsmith/pnlSettingsOutput.wxs @@ -285,7 +285,7 @@ - + 1 On Demand Always On @@ -297,7 +297,7 @@ - + 1 Inactive Active From ef335b7826b82776e8ea410755be251245e4200a Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 21 Jan 2022 12:49:04 +0000 Subject: [PATCH 15/15] version: update version to 1.3.2 --- CMakeLists.txt | 2 +- pam2/CMakeLists.txt | 2 +- pambase/settings.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b14f1694..9944d758 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(pamworkspace VERSION 1.3.0.0) +project(pamworkspace VERSION 1.3.2) SET(CMAKE_CXX_STANDARD 14) diff --git a/pam2/CMakeLists.txt b/pam2/CMakeLists.txt index f573bf0a..2fd6ad11 100644 --- a/pam2/CMakeLists.txt +++ b/pam2/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(pam2 LANGUAGES CXX VERSION 1.3.1) +project(pam2 LANGUAGES CXX VERSION 1.3.2) execute_process(COMMAND ${CMAKE_COMMAND} -DNAMESPACE=${PROJECT_NAME} -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR} -DPATCH=${PROJECT_VERSION_PATCH} -P ${CMAKE_SOURCE_DIR}/version.cmake) diff --git a/pambase/settings.cpp b/pambase/settings.cpp index f508b785..8f2bee9c 100644 --- a/pambase/settings.cpp +++ b/pambase/settings.cpp @@ -7,6 +7,7 @@ #include "pmcontrol.h" #include "pmpanel.h" #include "pam2_paths.h" + #ifdef __WXMSW__ #include #include