Commit fe1b7515 authored by Meg Ford's avatar Meg Ford

add changes from patch that wouldn't apply

parent 2e911663
......@@ -187,18 +187,16 @@ const _TENTH_SEC = 100000000;
this.view.setLabel(0);
}
this.absoluteTime = this.clock.get_time();
if (this.baseTime == 0)
this.baseTime = this.absoluteTime;
log("base time " + this.baseTime);
let clockTime = this.clock.get_time();
let baseTime = this.pipeline.get_base_time();
let runningTime = clockTime - baseTime;
log("clock time " + clockTime);
log("base time " + baseTime);
log("running time " + runningTime);
let approxTime = Math.round(runningTime / _TENTH_SEC);
let runTime = this.absoluteTime- this.baseTime;
log(runTime);
log("current clocktime " + this.absoluteTime);
let approxTime = Math.round(runTime/_TENTH_SEC);
log("approx" + approxTime);
MainWindow.wave._drawEvent(approxTime);
MainWindow.wave._drawEvent(approxTime, this.peak);
return true;
},
......
......@@ -48,7 +48,6 @@ const Record = new Lang.Class({
Name: "Record",
_recordPipeline: function() {
this.baseTime = 0;
this._view = MainWindow.view;
this._buildFileName = new BuildFileName();
this.initialFileName = this._buildFileName.buildInitialFilename();
......@@ -132,23 +131,8 @@ const Record = new Lang.Class({
_updateTime: function() {
let time = this.pipeline.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
if (time >= 0) {
if (time >= 0)
this._view.setLabel(time, 0);
}
this.absoluteTime = this.clock.get_time();
if (this.baseTime == 0)
this.baseTime = this.absoluteTime;
log("base time " + this.baseTime);
this.runTime = this.absoluteTime- this.baseTime;
log(this.runTime);
log("current clocktime " + this.absoluteTime);
let approxTime = Math.round(this.runTime/_TENTH_SEC);
log("approx" + approxTime);
log("peakruntime" + this.peak);
MainWindow.wave._drawEvent(approxTime, this.peak);
return true;
},
......@@ -245,21 +229,26 @@ const Record = new Lang.Class({
if (peakVal) {
let val = peakVal.get_nth(0);
log("val" + val);
log("profile!" + this.profile);
if (val > 0)
val = 0;
let value = Math.pow(10, val/20);
log(value);
if (value <= 0)
this.peak = 0;
else if (value >= 1)
this.peak = 1;
else
this.peak = value;
log("wave height" + this.peak);
}
}
this.peak = value;
let clockTime = this.clock.get_time();
let baseTime = this.pipeline.get_base_time();
let runningTime = clockTime - baseTime;
log("clock time " + clockTime);
log("base time " + baseTime);
log("running time " + runningTime);
let approxTime = Math.round(runningTime / _TENTH_SEC);
log("approx" + approxTime);
MainWindow.wave._drawEvent(approxTime, this.peak);
}
}
}
break;
case Gst.MessageType.EOS:
......
......@@ -131,16 +131,13 @@ const WaveForm = new Lang.Class({
if (peakVal) {
let val = peakVal.get_nth(0);
log("val" + val);
if (val > 0)
val = 0;
let value = Math.pow(10, val/20);
log(value);
if (value <= 0)
peaknumber = 0;
else if (value >= 1)
peaknumber = 1;
else
peaknumber = value;
this.peak = value;
peaks.push(peaknumber);
log("wave height" + peaknumber);
}
......@@ -175,17 +172,23 @@ const WaveForm = new Lang.Class({
},
fillSurface: function(drawing, cr) {
let start = 0;
if (this.waveType == WaveType.PLAY) {
if (peaks.length != this.playTime) {
this.pipeline.set_state(Gst.State.PLAYING);
log("continue drawing " + peaks.length);
start = Math.floor(this.playTime);
}
} else {
if (this.recordTime >= 0)
start = Math.floor(this.recordTime);
}
let i = 0;
let xAxis = 0;
let start = Math.floor(this.playTime);
let end = start + 40;
log(start + "start");
log(end + "end");
let width = this.drawing.get_allocated_width();
let waveheight = this.drawing.get_allocated_height();
let length = this.nSamples;
......@@ -200,7 +203,7 @@ const WaveForm = new Lang.Class({
for(i = start; i <= end; i++) {
// Keep moving until we get to a non-null array member
if (peaks[i] < 0) { //|| (this.tick >= 40 && xAxis == 0)) {
if (peaks[i] < 0) {
cr.moveTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)))
log(i);
}
......@@ -249,7 +252,8 @@ const WaveForm = new Lang.Class({
if (peaks.length < this.recordTime) {
log("error");
}
log(peaks.length);
log("draw event");
this.drawing.queue_draw();
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment