Skip to content

Commit

Permalink
Set default mic gain values to better (lower) values for most devices…
Browse files Browse the repository at this point in the history
… and make level meter more responsive during tx
  • Loading branch information
nostar committed Jan 15, 2022
1 parent 015b2a2 commit e357125
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 24 deletions.
5 changes: 4 additions & 1 deletion MainTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,13 @@ Item {
y: (parent.height / rows + 1) * 3;
width: parent.width / 4;
height: parent.height / rows;
text: qsTr("Mic gain")
text: qsTr("TX")
color: "white"
font.pixelSize: parent.height / 30;
verticalAlignment: Text.AlignVCenter
}
Slider {
property double v;
visible: true
id: _slidermicGain
x: (parent.width / 4) + 10
Expand All @@ -445,7 +446,9 @@ Item {
height: parent.height / rows;
value: 0.5
onValueChanged: {
v = value * 100;
droidstar.set_input_volume(value);
micgain_label.text = "TX " + v.toFixed(1);
}
}
Text {
Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="66" android:installLocation="auto">
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="67" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
1 change: 0 additions & 1 deletion codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class Codec : public QObject
bool get_hwtx() { return m_hwtx; }
void set_hostname(std::string);
void set_callsign(std::string);
void set_input_src(uint8_t s, QString t) { m_ttsid = s; m_ttstext = t; }
struct MODEINFO {
qint64 ts;
int status;
Expand Down
2 changes: 1 addition & 1 deletion dcscodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ void DCSCodec::send_frame(uint8_t *ambe)
}

m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 2);
update(m_modeinfo);

#ifdef DEBUG
Expand Down
2 changes: 1 addition & 1 deletion dmrcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void DMRCodec::send_frame()

m_modeinfo.stream_state = STREAM_IDLE;
}
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 8);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
Expand Down
14 changes: 9 additions & 5 deletions droidstar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ DroidStar::DroidStar(QObject *parent) :
m_dmrid(0),
m_essid(0),
m_dmr_destid(0),
m_outlevel(0)
m_outlevel(0),
m_tts(0)
{
qRegisterMetaType<M17Codec::MODEINFO>("Codec::MODEINFO");
m_settings_processed = false;
Expand Down Expand Up @@ -213,6 +214,9 @@ void DroidStar::tts_changed(QString tts)
else if(tts == "TTS3"){
m_tts = 3;
}
else{
m_tts = 0;
}
emit input_source_changed(m_tts, m_ttstxt);
}

Expand Down Expand Up @@ -1623,7 +1627,7 @@ void DroidStar::update_nxdn_data(Codec::MODEINFO info)
if( (connect_status == Codec::CONNECTING) && ( info.status == Codec::CONNECTED_RW)){
connect_status = Codec::CONNECTED_RW;
emit connect_status_changed(2);
emit in_audio_vol_changed(0.3);
emit in_audio_vol_changed(0.1);
emit swtx_state(!m_nxdn->get_hwtx());
emit swrx_state(!m_nxdn->get_hwrx());
emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port));
Expand Down Expand Up @@ -1704,7 +1708,7 @@ void DroidStar::update_dmr_data(Codec::MODEINFO info)
if( (connect_status == Codec::CONNECTING) && ( info.status == Codec::CONNECTED_RW)){
connect_status = Codec::CONNECTED_RW;
emit connect_status_changed(2);
emit in_audio_vol_changed(0.3);
emit in_audio_vol_changed(0.1);
emit swtx_state(!m_dmr->get_hwtx());
emit swrx_state(!m_dmr->get_hwrx());
emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port));
Expand Down Expand Up @@ -1789,7 +1793,7 @@ void DroidStar::update_ysf_data(Codec::MODEINFO info)
if( (connect_status == Codec::CONNECTING) && (info.status == Codec::CONNECTED_RW)){
connect_status = Codec::CONNECTED_RW;
emit connect_status_changed(2);
emit in_audio_vol_changed(0.2);
emit in_audio_vol_changed(0.1);
emit swtx_state(!m_ysf->get_hwtx());
emit swrx_state(!m_ysf->get_hwrx());
emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port));
Expand Down Expand Up @@ -1877,7 +1881,7 @@ void DroidStar::update_p25_data(Codec::MODEINFO info)
if( (connect_status == Codec::CONNECTING) && (info.status == Codec::CONNECTED_RW)){
connect_status = Codec::CONNECTED_RW;
emit connect_status_changed(2);
emit in_audio_vol_changed(0.3);
emit in_audio_vol_changed(0.2);
emit swtx_state(!m_p25->get_hwtx());
emit swrx_state(!m_p25->get_hwrx());
emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port));
Expand Down
4 changes: 2 additions & 2 deletions droidstar.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ public slots:
void url_downloaded(QString);
unsigned short get_output_level(){ return m_outlevel; }
void set_output_level(unsigned short l){ m_outlevel = l; }
void tts_changed(QString); // { m_tts = tts; };
void tts_text_changed(QString); // { m_ttstxt = ttstxt; };
void tts_changed(QString);
void tts_text_changed(QString);
private:
int connect_status;
bool m_update_host_files;
Expand Down
1 change: 0 additions & 1 deletion iaxcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class IAXCodec : public QObject
QString get_host() { return m_host; }
int get_port() { return m_port; }
int get_cnt() { return m_cnt; }
void set_input_src(uint8_t s, QString t) { m_ttsid = s; m_ttstext = t; }
signals:
void update();
void update_output_level(unsigned short);
Expand Down
2 changes: 1 addition & 1 deletion m17codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ void M17Codec::transmit()
}

txframe.clear();
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 2);
int r = get_mode() ? 0x05 : 0x07;

if(m_tx){
Expand Down
10 changes: 5 additions & 5 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ ApplicationWindow {
mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.2;
mainTab.sliderMicGain.value = 0.1;
}
if(droidstar.get_mode() === "FCS"){
//mainTab.comboMode.width = mainTab.width / 2;
Expand All @@ -264,7 +264,7 @@ ApplicationWindow {
mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.2;
mainTab.sliderMicGain.value = 0.1;
}
if(droidstar.get_mode() === "DMR"){
//mainTab.comboMode.width = (mainTab.width / 5) - 5;
Expand All @@ -280,7 +280,7 @@ ApplicationWindow {
mainTab.dmrtgidEdit.visible = true;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = true;
mainTab.sliderMicGain.value = 0.3;
mainTab.sliderMicGain.value = 0.1;
}
if(droidstar.get_mode() === "P25"){
//mainTab.comboMode.width = mainTab.width / 2;
Expand All @@ -296,7 +296,7 @@ ApplicationWindow {
mainTab.dmrtgidEdit.visible = true;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.3;
mainTab.sliderMicGain.value = 0.2;
}
if(droidstar.get_mode() === "NXDN"){
//mainTab.comboMode.width = mainTab.width / 2;
Expand All @@ -311,7 +311,7 @@ ApplicationWindow {
mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.3;
mainTab.sliderMicGain.value = 0.1;
}
if(droidstar.get_mode() === "M17"){
//mainTab.comboMode.width = mainTab.width / 2;
Expand Down
2 changes: 1 addition & 1 deletion nxdncodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void NXDNCodec::send_frame()
m_modeinfo.srcid = m_nxdnid;
m_modeinfo.frame_number = m_txcnt;
m_modeinfo.dstid = m_modeinfo.gwid;
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 8);
emit update(m_modeinfo);
}

Expand Down
2 changes: 1 addition & 1 deletion p25codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void P25Codec::transmit()
m_modeinfo.frame_number = 0;
m_txcodecq.clear();
}
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 6);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
Expand Down
2 changes: 1 addition & 1 deletion refcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void REFCodec::send_frame(uint8_t *ambe)
}

m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 2);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
Expand Down
2 changes: 1 addition & 1 deletion xrfcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ void XRFCodec::send_frame(uint8_t *ambe)
}

m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 2);
update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
Expand Down
2 changes: 1 addition & 1 deletion ysfcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void YSFCodec::send_frame()
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
m_modeinfo.stream_state = STREAM_IDLE;
}
emit update_output_level(m_audio->level());
emit update_output_level(m_audio->level() * 8);
emit update(m_modeinfo);
}

Expand Down

0 comments on commit e357125

Please sign in to comment.