📄 vojxtacallcontrol.java
字号:
*/ public void adjustMicGainControl(float newValue) { micControl.adjustGainControl(newValue); } /** * Control state accessor */ public float getMicMaxGain() { return micControl.getMaxGainValue(); } /** * Control state accessor */ public float getMicMinGain() { return micControl.getMinGainValue(); } /** * Control state accessor */ public String getMicGainUnits() { return micControl.getGainUnits(); } /** * Control state accessor */ public String getMicMaxGainLabel() { return micControl.getMaxLabel(); } /** * Control state accessor */ public String getMicMinGainLabel() { return micControl.getMinLabel(); } /** * Control state accessor */ public boolean isSpeakerGainSupported() { return speakerControl.isGainControlSupported(); } /** * Control state accessor */ public float getSpeakerGainValue() { return speakerControl.getGainValue(); } /** * Control state accessor */ public void adjustSpeakerGainControl(float newValue) { speakerControl.adjustGainValue(newValue); } /** * Control state accessor */ public float getSpeakerMaxGain() { return speakerControl.getMaxGainValue(); } /** * Control state accessor */ public float getSpeakerMinGain() { return speakerControl.getMinGainValue(); } /** * Control state accessor */ public String getSpeakerGainUnits() { return speakerControl.getGainUnits(); } /** * Control state accessor */ public String getSpeakerMaxGainLabel() { return speakerControl.getMaxGainLabel(); } /** * Control state accessor */ public String getSpeakerMinGainLabel() { return speakerControl.getMinGainLabel(); } /** * Returns the voice quality set by local user */ protected int getLocalVoiceQuality() { return localVoiceQuality; } /** * Called by the UI to set prefered voice quality */ public void setLocalVoiceQuality(int localVoiceQuality) { if (localVoiceQuality >= this.MINIMUM_QUALITY && localVoiceQuality <= this.MAXIMUM_QUALITY) { this.localVoiceQuality = localVoiceQuality; } else { this.localVoiceQuality = this.DEFAULT_QUALITY; } } /** * Returns the voice quality preferred by thte remote peer */ protected int getRemoteVoiceQuality() { return remoteVoiceQuality; } /** * Sets the preferred voice quality of the remote peer */ protected void setRemoteVoiceQuality(int remoteVoiceQuality) { if (remoteVoiceQuality >= this.MINIMUM_QUALITY && remoteVoiceQuality <= this.MAXIMUM_QUALITY) { this.remoteVoiceQuality = remoteVoiceQuality; } else { this.remoteVoiceQuality = this.DEFAULT_QUALITY; } } /** * Sets the preferred voice quality of the remote peer */ protected void setRemoteVoiceQuality(String remoteVoiceQuality) { try { setRemoteVoiceQuality(Integer.valueOf(remoteVoiceQuality).intValue()); } catch (NumberFormatException nfx) { nfx.printStackTrace(); setRemoteVoiceQuality(this.DEFAULT_QUALITY); } } /** * Sets preferred local voice quality. */ public void setLocalVoiceQuality(String localVoiceQuality) { try { setLocalVoiceQuality(Integer.valueOf(localVoiceQuality).intValue()); } catch (NumberFormatException nfx) { nfx.printStackTrace(); setLocalVoiceQuality(this.DEFAULT_QUALITY); } } /** * Returns the lesser of local and remote preferred voice qualities. */ public int getMinimumVoiceQuality() { int localVQ = getLocalVoiceQuality(); int remoteVQ = getRemoteVoiceQuality(); int rtn = 0; if (localVQ == remoteVQ) { rtn = localVQ; } else if (localVQ < remoteVQ) { rtn = localVQ; } else { rtn = remoteVQ; } return rtn; } /** * Statistical accessor */ public int getIncomingBufferSize() { return speakerControl.getBufferSize(); } /** * Statistical accessor */ public int getIncomingBufferCapacity() { return speakerControl.getBufferCapacity(); } /** * Statistical accessor */ public int getOutgoingBufferSize() { return micControl.getBufferSize(); } /** * Statistical accessor */ public int getOutgoingBufferCapacity() { return micControl.getBufferCapacity(); } /** * Command StartAccept received from remote */ protected void localActionStartAcceptReceived(DialogMessage msg) { MessageElement me = msg.getMessageElement(this.TAG_QUALITY_ELEMENT); if (me != null) { ByteArrayMessageElement remoteVoiceQualityElement = (ByteArrayMessageElement) me; String remoteVoiceQualityString = remoteVoiceQualityElement.toString(); if (remoteVoiceQualityString != null) { setRemoteVoiceQuality(remoteVoiceQualityString); } } } /** * Command SendStartRquest to remote. */ protected void localActionSendStartRequest() { /* DialogMessage startRequestMsg = (DialogMessage)templateMessage.clone (); StringMessageElement commandElement = new StringMessageElement ( TAG_SESSION_COMMAND, this.COMMAND_VOJXTA_START_REQUEST, null); startRequestMsg.addMessageElement (TAG_SESSION_COMMAND, commandElement); String voiceQualityString = String.valueOf (getLocalVoiceQuality ()); StringMessageElement voiceQualityElement = new StringMessageElement ( TAG_QUALITY_ELEMENT, voiceQualityString, null); startRequestMsg.addMessageElement (TAG_QUALITY_ELEMENT, voiceQualityElement); this.vojxtaDialog.dispatch (startRequestMsg); */ String voiceQualityString = String.valueOf(getLocalVoiceQuality()); StringMessageElement voiceQualityElement = new StringMessageElement( TAG_QUALITY_ELEMENT, voiceQualityString, null); HashMap elementMap = new HashMap(); elementMap.put(TAG_QUALITY_ELEMENT, voiceQualityElement); sendCommand(this.COMMAND_VOJXTA_START_REQUEST, this.COMMAND_VOJXTA_START_ACCEPT, elementMap); setProtocolState(this.SESSION_VOJXTA_START_REQUEST_SENT); } /** * Command StartRquest received from remote */ protected void localActionStartRequestReceived(DialogMessage msg) { /** retrieve the quality element */ MessageElement me = msg.getMessageElement(this.TAG_QUALITY_ELEMENT); if (me != null) { ByteArrayMessageElement remoteVoiceQualityElement = (ByteArrayMessageElement) me; String remoteVoiceQualityString = remoteVoiceQualityElement.toString(); if (remoteVoiceQualityString != null) { setRemoteVoiceQuality(remoteVoiceQualityString); } /** determine who has the lowest quality and send to remote */ String commonVoiceQualityString = String.valueOf(getMinimumVoiceQuality()); /* DialogMessage startAcceptMsg = (DialogMessage)templateMessage.clone (); StringMessageElement commandElement = new StringMessageElement ( TAG_SESSION_COMMAND, this.COMMAND_VOJXTA_START_ACCEPT, null); startAcceptMsg.addMessageElement (TAG_SESSION_COMMAND, commandElement); StringMessageElement voiceQualityElement = new StringMessageElement ( TAG_QUALITY_ELEMENT, commonVoiceQualityString, null); startAcceptMsg.addMessageElement (TAG_QUALITY_ELEMENT, voiceQualityElement); this.vojxtaDialog.dispatch (startAcceptMsg); */ StringMessageElement voiceQualityElement = new StringMessageElement( TAG_QUALITY_ELEMENT, commonVoiceQualityString, null); HashMap elementMap = new HashMap(); elementMap.put(TAG_QUALITY_ELEMENT, voiceQualityElement); sendCommand(this.COMMAND_VOJXTA_START_ACCEPT, null, elementMap); setProtocolState(this.SESSION_VOJXTA_START_ACCEPT_SENT); } else { if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) { LOG.info("remote voice quality element is NULL"); } } } /** * Sets if this sesseion is to be persisted * TODO */ public void setPersistSession(boolean persist, String fileName) { this.sessionPersisted = persist; this.sessionFileName = fileName; } /** * determines if this audio session is to be persisted */ public boolean isSessionPersisted() { return this.sessionPersisted; } /** * Return the file name to which we persist this audio session */ public String getSessionPersistFileName() { return this.sessionFileName; } /** * Called by UI to alert us to start this audio call */ public void viewActionPlaceCall() { sendCommand(this.COMMAND_VOJXTA_INVITE_REQUEST, this.COMMAND_VOJXTA_INVITE_ACCEPT); setProtocolState(this.SESSION_VOJXTA_INVITE_REQUEST_SENT); } /** * Command EndCall reveived from remote peer */ private void localActionEndCall() { if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) { LOG.info("localActionEndCall"); } setCallEndTime(); receiveTimeoutThread.stopThread(); if (micControl != null) { micControl.endMic(); micControl.releaseHardware(); } if (speakerControl != null) { speakerControl.endSpeaker(); speakerControl.releaseHardware(); } } /** * start the audio controls for sending and receiving */ private void localActionStartVoiceTransmision() { if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) { LOG.info("localActionStartVoiceTransmision"); } setCallStartTime(); micControl.beginMic(); speakerControl.beginSpeaker(); receiveTimeoutThread = new ReceivedMessageTimeoutThread(); receiveTimeoutThread.start(); } /** * Sets the time in ms this call started */ protected void setCallStartTime() { this.callStartTime = System.currentTimeMillis(); } /** * Sets the time in ms this call ended */ protected void setCallEndTime() { this.callEndTime = System.currentTimeMillis(); } /** * Command HoldCall reveived from remote */ private void localActionHoldCall(boolean myHold) { micControl.pauseMic(); speakerControl.pauseSpeaker(); } /** * Command Resume call received from remote */ /** * Command ResumeCall received from remote */ private void localActionResumeCall() { micControl.resumeMic(); speakerControl.resumeSpeaker(); } /** * Command EndSession received from remote */ private void localActionEndSession() { if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) { LOG.info("localActionEndSession");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -