修改图片

This commit is contained in:
2025-11-03 18:34:07 +08:00
parent f5377127ce
commit 520bc8e1bb
25 changed files with 159 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
package com.xscm.moduleutil.rtc;
import java.util.HashMap;
import java.util.Map;
/**
* com.xscm.moduleutil.rtc
* qx
* 2025/11/3
* 声网声音管理类
*/
public class VolumeManager {
private static VolumeManager instance;
private Map<String, Integer> userMusicVolumeMap = new HashMap<>();
private Map<String, Integer> userPlayoutVolumeMap = new HashMap<>();
private Map<String, Boolean> userPlayoutBzMap = new HashMap<>();
private String currentUserId;
private VolumeManager() {}
public static VolumeManager getInstance() {
if (instance == null) {
synchronized (VolumeManager.class) {
if (instance == null) {
instance = new VolumeManager();
}
}
}
return instance;
}
public void setCurrentUserId(String userId) {
this.currentUserId = userId;
}
public void saveCurrentVolumes(int musicVolume, int playoutVolume) {
if (currentUserId != null) {
userMusicVolumeMap.put(currentUserId, musicVolume);
userPlayoutVolumeMap.put(currentUserId, playoutVolume);
}
}
public void clearCurrentVolumes() {
if (currentUserId != null) {
userMusicVolumeMap.remove(currentUserId);
userPlayoutVolumeMap.remove(currentUserId);
}
userPlayoutBzMap.clear();
}
public void saveBz(String userId, boolean bz){
userPlayoutBzMap.clear();
userPlayoutBzMap.put(userId, bz);
}
public boolean getBz(String userId){
Boolean bz = userPlayoutBzMap.get(userId);
if (bz == null) {
bz = true; // 默认值原唱 false 伴奏
}
return bz;
}
public int[] getUserVolumes(String userId) {
Integer musicVolume = userMusicVolumeMap.get(userId);
Integer playoutVolume = userPlayoutVolumeMap.get(userId);
if (musicVolume == null) {
musicVolume = 100; // 默认值
}
if (playoutVolume == null) {
playoutVolume = 50; // 默认值
}
return new int[]{musicVolume, playoutVolume};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB