Skip to content

Commit 61ba50c

Browse files
committed
add new options and set auto gain to true
1 parent a60638e commit 61ba50c

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
import static com.zoffcc.applications.nativeaudio.NativeAudio.na_set_audio_play_volume_percent;
130130
import static com.zoffcc.applications.nativeaudio.NativeAudio.set_aec_active;
131131
import static com.zoffcc.applications.nativeaudio.NativeAudio.set_audio_aec_delay;
132+
import static com.zoffcc.applications.nativeaudio.NativeAudio.set_gainprocessing_active;
133+
import static com.zoffcc.applications.nativeaudio.NativeAudio.set_rnnoise_active;
132134
import static com.zoffcc.applications.trifa.AudioReceiver.channels_;
133135
import static com.zoffcc.applications.trifa.AudioReceiver.sampling_rate_;
134136
import static com.zoffcc.applications.trifa.AudioRecording.audio_engine_starting;
@@ -526,6 +528,8 @@ public class MainActivity extends AppCompatActivity
526528
static int PREF__ngc_audio_bitrate = NGC_AUDIO_BITRATE;
527529
static int PREF__ngc_audio_samplerate = 48000;
528530
static int PREF__ngc_audio_channels = 1;
531+
static boolean PREF__gainprocessing_active = true;
532+
static boolean PREF__rnnoise_active = false;
529533

530534
static String versionName = "";
531535
static int versionCode = -1;
@@ -1280,6 +1284,26 @@ public void onNotYetInstalled()
12801284
PREF__use_push_service = true;
12811285
}
12821286

1287+
try
1288+
{
1289+
PREF__gainprocessing_active = settings.getBoolean("gainprocessing_active", true);
1290+
}
1291+
catch (Exception e)
1292+
{
1293+
e.printStackTrace();
1294+
PREF__gainprocessing_active = true;
1295+
}
1296+
1297+
try
1298+
{
1299+
PREF__rnnoise_active = settings.getBoolean("rnnoise_active", false);
1300+
}
1301+
catch (Exception e)
1302+
{
1303+
e.printStackTrace();
1304+
PREF__rnnoise_active = false;
1305+
}
1306+
12831307
//if (MainActivity.IS_GPLAY_VERSION)
12841308
//{
12851309
try
@@ -2820,6 +2844,42 @@ else if (PREF__higher_audio_quality == 1)
28202844
PREF__use_push_service = true;
28212845
}
28222846

2847+
try
2848+
{
2849+
PREF__gainprocessing_active = settings.getBoolean("gainprocessing_active", true);
2850+
}
2851+
catch (Exception e)
2852+
{
2853+
e.printStackTrace();
2854+
PREF__gainprocessing_active = true;
2855+
}
2856+
if (PREF__gainprocessing_active)
2857+
{
2858+
set_gainprocessing_active(1);
2859+
}
2860+
else
2861+
{
2862+
set_gainprocessing_active(0);
2863+
}
2864+
2865+
try
2866+
{
2867+
PREF__rnnoise_active = settings.getBoolean("rnnoise_active", false);
2868+
}
2869+
catch (Exception e)
2870+
{
2871+
e.printStackTrace();
2872+
PREF__rnnoise_active = false;
2873+
}
2874+
if (PREF__rnnoise_active)
2875+
{
2876+
set_rnnoise_active(1);
2877+
}
2878+
else
2879+
{
2880+
set_rnnoise_active(0);
2881+
}
2882+
28232883
//if (MainActivity.IS_GPLAY_VERSION)
28242884
//{
28252885
try

android-refimpl-app/app/src/main/res/values/strings.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@
133133
<string name="pref_title_mic_gain_factor_toggle">Mic Gain to lower Volume</string>
134134
<string name="pref_description_mic_gain_factor_toggle">If your microphone records with too much sensitivity, enable this setting and the Mic Gain Factor will actually lower the Volume of the microphone</string>
135135

136+
<string name="pref_title_gainprocessing_active">Microphone Gain</string>
137+
<string name="pref_description_gainprocessing_active">adjust Microphone Gain semi automatically to make Sound louder.\nIf there is a problem during Calls try turning off this option</string>
138+
<string name="pref_title_rnnoise_active">Background Noise</string>
139+
<string name="pref_description_rnnoise_active">Remove Background Noise with RNNoise</string>
140+
141+
136142
<string name="pref_title_higher_audio_quality">Audio Quality</string>
137143
<string name="pref_description_higher_audio_quality">Use better Audio quality.\nChange needs RESTART!</string>
138144
<string-array name="pref_higher_audio_quality_titles">

android-refimpl-app/app/src/main/res/xml/pref_general.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@
182182
android:summary="@string/pref_description_mic_gain_factor_toggle"
183183
android:title="@string/pref_title_mic_gain_factor_toggle" />
184184

185+
<SwitchPreference
186+
android:defaultValue="true"
187+
android:key="gainprocessing_active"
188+
android:summary="@string/pref_description_gainprocessing_active"
189+
android:title="@string/pref_title_gainprocessing_active" />
190+
191+
<SwitchPreference
192+
android:defaultValue="false"
193+
android:key="rnnoise_active"
194+
android:summary="@string/pref_description_rnnoise_active"
195+
android:title="@string/pref_title_rnnoise_active" />
196+
185197
<ListPreference
186198
android:defaultValue="1"
187199
android:entries="@array/pref_higher_audio_quality_titles"

0 commit comments

Comments
 (0)