Commit d5ad7ded authored by Meg Ford's avatar Meg Ford

chnage behavior of playback and record widgets during recording

parent bf58343e
......@@ -49,6 +49,7 @@ let play = null;
let recordPipeline = null;
let recordButton = null;
let selectable = null;
let previousSelRow = null;
let setVisibleID = null;
let view = null;
let volumeValue = [];
......@@ -174,7 +175,7 @@ const MainView = new Lang.Class({
},
onPlayStopClicked: function() {
//this.playButton.set_active(false);
//recordButton.set_sensitive(true);
play.stopPlaying();
},
......@@ -182,7 +183,7 @@ const MainView = new Lang.Class({
this._record.stopRecording();
this.recordGrid.hide();
recordPipeline = RecordPipelineStates.STOPPED;
recordButton.set_sensitive(true);
recordButton.set_sensitive(true);
},
_formatTime: function(unformattedTime) {
......@@ -481,9 +482,10 @@ const MainView = new Lang.Class({
},
listBoxRefresh: function() {
this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
fileUtil = new FileUtil.FileUtil();
list.enumerateDirectory();
this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
},
scrolledWinDelete: function() {
......@@ -493,11 +495,10 @@ const MainView = new Lang.Class({
log("destroy " + w);
},
rowGridCallback: function(selectedRow) {
if (selectedRow) {
if (this._selectedRow) {
let rowWidget = this._selectedRow.get_child(this.widget);
hasPreviousSelRow: function() {
log("this._selectedRow " + previousSelRow);
if (previousSelRow != null) {
let rowWidget = previousSelRow.get_child(this.widget);
rowWidget.foreach(Lang.bind(this,
function(child) {
let alwaysShow = child.get_no_show_all();
......@@ -511,10 +512,19 @@ const MainView = new Lang.Class({
log("this.activeState == PipelineStates.PLAYING");
play.stopPlaying();
}
}
this._selectedRow = selectedRow;
let selectedRowWidget = this._selectedRow.get_child(this.widget);
}
previousSelRow = null;
},
rowGridCallback: function(selectedRow) {
if (selectedRow) {
log("this._selectedRow " + previousSelRow);
if (previousSelRow != null) {
this.hasPreviousSelRow();
}
previousSelRow = selectedRow;
let selectedRowWidget = previousSelRow.get_child(this.widget);
selectedRowWidget.show_all();
selectedRowWidget.foreach(Lang.bind(this,
function(child) {
......@@ -527,7 +537,7 @@ const MainView = new Lang.Class({
child.sensitive = true;
}));
}
},
},
_getFileNameFromRow: function(selected) {
this._selected = selected;
......@@ -594,6 +604,8 @@ const RecordButton = new Lang.Class({
},
_onRecord: function() {
view.hasPreviousSelRow();
view.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
this.set_sensitive(false);
setVisibleID = ActiveArea.RECORD;
view.recordGrid.show_all();
......
......@@ -234,7 +234,7 @@ const Record = new Lang.Class({
log("profile!" + this.profile);
if (val > 0)
val = 0;
val = 0;
let value = Math.pow(10, val/20);
this.peak = value;
......
......@@ -130,14 +130,15 @@ const WaveForm = new Lang.Class({
if (peakVal) {
let val = peakVal.get_nth(0);
log(val);
if (val > 0)
val = 0;
let value = Math.pow(10, val/20);
log(value);
peaks.push(peaknumber);
log("wave height" + peaknumber);
peaks.push(value);
log("wave height" + value);
}
}
}
......@@ -170,13 +171,15 @@ const WaveForm = new Lang.Class({
},
fillSurface: function(drawing, cr) {
let start = 0;
if (this.waveType == WaveType.PLAY) {
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);
}
start = Math.floor(this.playTime);
} else {
if (this.recordTime >= 0)
start = this.recordTime;
......@@ -184,10 +187,11 @@ const WaveForm = new Lang.Class({
let i = 0;
let xAxis = 0;
let end = start + 40;
let width = this.drawing.get_allocated_width();
log(width);
let waveheight = this.drawing.get_allocated_height();
log(waveheight);
let length = this.nSamples;
let pixelsPerSample = width/waveSamples;
......@@ -200,7 +204,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);
}
......@@ -214,6 +218,7 @@ const WaveForm = new Lang.Class({
}
cr.lineTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)));
log(peaks[i] * waveheight + "lines");
}
xAxis += 1;
......
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