Sketcher2 source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.1 KiB

package com.jotuntech.sketcher.client.voice;
public class VoiceEvent {
/** No-operation type */
public final static int TYPE_NONE = 0;
/** Sent after voice client and recording line is running */
public final static int TYPE_START = 10;
/** Sent after voice client has shut down completely */
public final static int TYPE_STOP = 20;
/** Sent if there was an error starting the recording or playback lines */
public final static int TYPE_ERROR = 30;
/** Sent if there was a non-critical error starting the recording or playback lines */
public final static int TYPE_WARN = 31;
/** Sent when a channel is receiving too many packets (non-critical) */
public final static int TYPE_PACKET_OVERFLOW = 40;
/** Sent when a channel is receiving too few packets (non-critical) */
public final static int TYPE_PACKET_UNDERFLOW = 50;
/** Sent when a channel packet is received normally */
public final static int TYPE_PACKET_RECEIVED = 60;
/** Sent when a channel packet is lost (non-critical) */
public final static int TYPE_PACKET_LOST = 70;
/** Sent when a channel is receiving packets for buffering */
public final static int TYPE_PACKET_BUFFERING = 80;
/** Sent when a new voice channel is added */
public final static int TYPE_CHANNEL_NEW = 90;
/** Sent when a voice channel dies */
public final static int TYPE_CHANNEL_DEAD = 100;
/** Volume, sent when a packet is decoded */
public final static int TYPE_PACKET_VOLUME = 110;
private int type;
private Integer channel;
private int data1;
private int data2;
private String errorMessage;
public VoiceEvent() {
type = TYPE_NONE;
}
public VoiceEvent(int type) {
this.type = type;
}
public VoiceEvent(int type, String errorMessage) {
this.type = type;
this.errorMessage = errorMessage;
}
public VoiceEvent(int type, Integer channel) {
this.type = type;
this.channel = channel;
}
public VoiceEvent(int type, Integer channel, int data1) {
this.type = type;
this.channel = channel;
this.data1 = data1;
}
public VoiceEvent(int type, Integer channel, int data1, int data2) {
this.type = type;
this.channel = channel;
this.data1 = data1;
this.data2 = data2;
}
public VoiceEvent(int type, Integer channel, String errorMessage) {
this.type = type;
this.channel = channel;
this.errorMessage = errorMessage;
}
/** Returns a type from list of constants above */
public int getType() {
return type;
}
/** Channel number the event is coming from or null if none */
public Integer getChannel() {
return channel;
}
/** Error message associated with event or null if none */
public String getErrorMessage() {
return errorMessage;
}
/** Buffer size percentage or 0 if none */
public int getBufferPercent() {
return data1;
}
/** Recording buffer size in bytes, or 0 if none */
public int getBufferSize() {
return data1;
}
/** Moving average of quality (packet received vs packet lost) percentage or 0 if none */
public int getQualityPercent() {
return data2;
}
/** Peak volume of this packet */
public int getVolume() {
return data1;
}
}