Loc/Zone Packets (Partial)
This commit is contained in:
1 parent
ac3938c306
commit
e5438f79a4
14 files changed
+2851
-2648
No files matched your search
@@ -6,60 +6,60 @@
|
||||
*/
|
||||
public class SoundEnvelope {
|
||||
|
||||
public int length;
|
||||
public int[] shapeDelta;
|
||||
public int[] shapePeak;
|
||||
public int start;
|
||||
public int end;
|
||||
public int form;
|
||||
public int threshold;
|
||||
public int position;
|
||||
public int delta;
|
||||
public int amplitude;
|
||||
public int ticks;
|
||||
public int length;
|
||||
public int[] shapeDelta;
|
||||
public int[] shapePeak;
|
||||
public int start;
|
||||
public int end;
|
||||
public int form;
|
||||
public int threshold;
|
||||
public int position;
|
||||
public int delta;
|
||||
public int amplitude;
|
||||
public int ticks;
|
||||
|
||||
public SoundEnvelope() {
|
||||
}
|
||||
public SoundEnvelope() {
|
||||
}
|
||||
|
||||
public void read(Buffer buffer) {
|
||||
form = buffer.get1U();
|
||||
start = buffer.get4();
|
||||
end = buffer.get4();
|
||||
readShape(buffer);
|
||||
}
|
||||
public void read(Buffer buffer) {
|
||||
form = buffer.get1U();
|
||||
start = buffer.get4();
|
||||
end = buffer.get4();
|
||||
readShape(buffer);
|
||||
}
|
||||
|
||||
public void readShape(Buffer buffer) {
|
||||
length = buffer.get1U();
|
||||
shapeDelta = new int[length];
|
||||
shapePeak = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
shapeDelta[i] = buffer.get2U();
|
||||
shapePeak[i] = buffer.get2U();
|
||||
}
|
||||
}
|
||||
public void readShape(Buffer buffer) {
|
||||
length = buffer.get1U();
|
||||
shapeDelta = new int[length];
|
||||
shapePeak = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
shapeDelta[i] = buffer.get2U();
|
||||
shapePeak[i] = buffer.get2U();
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
threshold = 0;
|
||||
position = 0;
|
||||
delta = 0;
|
||||
amplitude = 0;
|
||||
ticks = 0;
|
||||
}
|
||||
public void reset() {
|
||||
threshold = 0;
|
||||
position = 0;
|
||||
delta = 0;
|
||||
amplitude = 0;
|
||||
ticks = 0;
|
||||
}
|
||||
|
||||
public int evaluate(int delta) {
|
||||
if (ticks >= threshold) {
|
||||
amplitude = shapePeak[position++] << 15;
|
||||
if (position >= length) {
|
||||
position = length - 1;
|
||||
}
|
||||
threshold = (int) (((double) shapeDelta[position] / 65536D) * (double) delta);
|
||||
if (threshold > ticks) {
|
||||
this.delta = ((shapePeak[position] << 15) - amplitude) / (threshold - ticks);
|
||||
}
|
||||
}
|
||||
amplitude += this.delta;
|
||||
ticks++;
|
||||
return (amplitude - this.delta) >> 15;
|
||||
}
|
||||
public int evaluate(int delta) {
|
||||
if (ticks >= threshold) {
|
||||
amplitude = shapePeak[position++] << 15;
|
||||
if (position >= length) {
|
||||
position = length - 1;
|
||||
}
|
||||
threshold = (int) (((double) shapeDelta[position] / 65536D) * (double) delta);
|
||||
if (threshold > ticks) {
|
||||
this.delta = ((shapePeak[position] << 15) - amplitude) / (threshold - ticks);
|
||||
}
|
||||
}
|
||||
amplitude += this.delta;
|
||||
ticks++;
|
||||
return (amplitude - this.delta) >> 15;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user