Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "app/src/main/jni/moonlight-core/moonlight-common-c"]
path = app/src/main/jni/moonlight-core/moonlight-common-c
url = https://github.com/ClassicOldSong/moonlight-common-c
url = https://github.com/logabell/moonlight-common-c
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ android {
buildTypes {
debug {
applicationIdSuffix ".noirdebug"
resValue "string", "app_label", "Diana"
resValue "string", "app_label_root", "Diana (Root)"
resValue "string", "app_label_game", "Diana (Game)"
resValue "string", "app_label", "Artemis-mic"
resValue "string", "app_label_root", "Artemis-mic (Root)"
resValue "string", "app_label_game", "Artemis-mic"

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -135,9 +135,9 @@ android {
//
// TL;DR: Leave the following line alone!
applicationIdSuffix ".noir"
resValue "string", "app_label", "Artemis"
resValue "string", "app_label_root", "Artemis (Root)"
resValue "string", "app_label_game", "Artemis (Game)"
resValue "string", "app_label", "Artemis-mic"
resValue "string", "app_label_root", "Artemis-mic (Root)"
resValue "string", "app_label_game", "Artemis-mic"

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down
16 changes: 10 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA"/>
Expand All @@ -16,9 +17,12 @@
android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
android:maxSdkVersion="33" />

<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
Expand Down Expand Up @@ -266,4 +270,4 @@

</application>

</manifest>
</manifest>
45 changes: 44 additions & 1 deletion app/src/main/java/com/limelight/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import com.limelight.binding.PlatformBinding;
import com.limelight.binding.audio.AndroidAudioRenderer;
import com.limelight.binding.audio.MicrophoneCaptureManager;
import com.limelight.binding.input.ControllerHandler;
import com.limelight.binding.input.GameInputDevice;
import com.limelight.binding.input.KeyboardTranslator;
Expand Down Expand Up @@ -232,6 +233,7 @@ public class Game extends AppCompatActivity implements SurfaceHolder.Callback,

private MediaCodecDecoderRenderer decoderRenderer;
private boolean reportedCrash;
private MicrophoneCaptureManager microphoneCaptureManager;

private WifiManager.WifiLock highPerfWifiLock;
private WifiManager.WifiLock lowLatencyWifiLock;
Expand Down Expand Up @@ -796,6 +798,7 @@ public void notifyCrash(Exception e) {
.setAttachedGamepadMask(gamepadMask)
.setClientRefreshRateX100((int)(displayRefreshRate * 100))
.setAudioConfiguration(prefConfig.audioConfiguration)
.setEnableMicrophone(prefConfig.enableMicrophone)
.setColorSpace(decoderRenderer.getPreferredColorSpace())
.setColorRange(decoderRenderer.getPreferredColorRange())
.setPersistGamepadsAfterDisconnect(!prefConfig.multiController)
Expand Down Expand Up @@ -1700,6 +1703,7 @@ public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {

@Override
protected void onDestroy() {
stopMicrophoneCapture();
super.onDestroy();

instance = null;
Expand Down Expand Up @@ -3437,6 +3441,8 @@ public void stageComplete(String stage) {
}

private void stopConnection() {
stopMicrophoneCapture();

if (connecting || connected) {
connecting = connected = false;
updatePipAutoEnter();
Expand Down Expand Up @@ -3468,6 +3474,42 @@ public void run() {
}
}

private void stopMicrophoneCapture() {
if (microphoneCaptureManager != null) {
microphoneCaptureManager.stop();
}
}

private void startMicrophoneCapture() {
if (!prefConfig.enableMicrophone) {
return;
}

if (!MicrophoneCaptureManager.hasRecordAudioPermission(this)) {
LimeLog.info("Skipping microphone capture because RECORD_AUDIO permission is missing");
displayTransientMessage(getString(R.string.microphone_stream_permission_revoked));
return;
}

if (!MoonBridge.isMicrophoneStreamActive()) {
LimeLog.info("Host did not negotiate microphone streaming");
displayTransientMessage(getString(R.string.microphone_host_not_negotiated));
return;
}

if (microphoneCaptureManager == null) {
microphoneCaptureManager = new MicrophoneCaptureManager(this);
}

LimeLog.info("Starting microphone streaming on device id " + prefConfig.microphoneDeviceId +
" (encrypted=" + MoonBridge.isMicrophoneEncryptionEnabled() + ")");

if (!microphoneCaptureManager.startStreaming(prefConfig.microphoneDeviceId, null)) {
LimeLog.warning("Unable to start local microphone capture for the current stream");
displayTransientMessage(getString(R.string.microphone_stream_start_failed));
}
}

@Override
public boolean stageFailed(final String stage, final int portFlags, final int errorCode) {
// Perform a connection test if the failure could be due to a blocked port
Expand Down Expand Up @@ -3697,6 +3739,7 @@ public void run() {
setupOverlayToggleButton();

hideSystemUi(1000);
startMicrophoneCapture();

if (prefConfig.preventPacketLoss) {
timerHandler.postDelayed(backgroundPing, 1000);
Expand Down Expand Up @@ -4346,4 +4389,4 @@ private SurfaceView findFirstSurfaceViewFrom(View v) {
return null;
}

}
}
Loading