Skip to content

Commit

Permalink
Merge pull request #81 from martim01/display
Browse files Browse the repository at this point in the history
Display
  • Loading branch information
martim01 authored Jan 21, 2022
2 parents 5563f73 + ef335b7 commit 9507f0b
Show file tree
Hide file tree
Showing 21 changed files with 547 additions and 264 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions documents/pam2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pam2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
3 changes: 0 additions & 3 deletions pam2/dlgmask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -82,7 +81,6 @@ void dlgMask::OnLeftDown(wxMouseEvent& event)
{
ReleaseMouse();
}
pmlLog(pml::LOG_INFO) << "Clicked outside";
EndModal(wxID_CANCEL);
}
else
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion pam2/nmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
76 changes: 55 additions & 21 deletions pam2/pnlAoipManual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -66,45 +67,47 @@ 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_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, _("RTPMap"), wxPoint(300,210), 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));
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));
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);

for(int i = 1; i < 9; i++)
{
m_plstChannels->AddButton(wxString::Format("%d", i));
}
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_plstChannels->SelectButton(Settings::Get().Read("ManualAoip", "Channels", "2"));
m_pbtnRtpMap->SetLabel(Settings::Get().Read("ManualAoip", "RtpMap", "96"));
m_pbtnChannels->SetLabel(Settings::Get().Read("ManualAoip", "Channels", "2"));


Connect(m_plstChannels->GetId(), wxEVT_LIST_SELECTED, (wxObjectEventFunction)&pnlAoipManual::OnlstChannelSelected);
}

pnlAoipManual::~pnlAoipManual()
Expand All @@ -126,21 +129,20 @@ 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)
{
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);
m_pbtnSampleRate->Enable(event.IsChecked() == false);

if(event.IsChecked())
{
Expand All @@ -152,7 +154,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

Expand All @@ -170,6 +172,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;
Expand All @@ -182,5 +189,32 @@ void pnlAoipManual::OnbtnRtpMapClick(wxCommandEvent& event)
if(aDlg.ShowModal()== wxID_OK)
{
m_pbtnRtpMap->SetLabel(aDlg.m_sSelected);
Settings::Get().Write("ManualAoip", "RtpMap", 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);
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());
}
12 changes: 7 additions & 5 deletions pam2/pnlAoipManual.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "wmipeditpnl.h"
#include "wmkeyboard.h"
#include "wmlabel.h"
#include "wmlist.h"
#include <wx/panel.h>
//*)

Expand All @@ -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;
Expand All @@ -31,7 +31,6 @@ class pnlAoipManual: public wxPanel
wmLabel* m_pLbl4;
wmLabel* m_pLbl8;
wmLabel* m_pLbl9;
wmList* m_plstChannels;
//*)

protected:
Expand All @@ -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;
Expand All @@ -58,10 +57,13 @@ class pnlAoipManual: public wxPanel
void OnbtnSampleRateClick(wxCommandEvent& event);
void OnbtnStreamClick(wxCommandEvent& event);
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()
};
Expand Down
17 changes: 16 additions & 1 deletion pam2/pnlSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "dlgAoIP.h"
#include "settingevent.h"
#include "aoipsourcemanager.h"

#include "log.h"
#ifdef __NMOS__
#include "nmos.h"
#endif // __NMOS__
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -296,12 +297,24 @@ void pnlSettings::UpdateDisplayedSettings()

void pnlSettings::OnSettingChanged(SettingEvent& event)
{
bool bNmos = false;
#ifdef __NMOS__
if(event.GetSection().CmpNoCase("NMOS") == 0 && event.GetKey() == "Node")
{
bNmos = (event.GetValue(0L) != NmosManager::NODE_OFF) && (event.GetValue(0L) != NmosManager::NODE_SENDER);
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, (event.GetValue(0L) == 0 && i!=m_nNmosButton));
}
}
}
}

void pnlSettings::EnableInputButtons(int nMode)
Expand Down Expand Up @@ -400,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)
Expand Down Expand Up @@ -472,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);

Expand Down
Loading

0 comments on commit 9507f0b

Please sign in to comment.