This commit is contained in:
tzim 2014-12-02 23:45:58 +00:00
parent 6fe272c32e
commit 46afd98e9b
4 changed files with 51 additions and 20 deletions

View file

@ -212,7 +212,7 @@ namespace DMX2
protected void OnBtnGotoClicked (object sender, EventArgs e) protected void OnBtnGotoClicked (object sender, EventArgs e)
{ {
TimeSpan ts; /*TimeSpan ts;
string[] formats = new string[]{ string[] formats = new string[]{
@"m\:s\.f", @"m\:s\.f",
@"m\:s", @"m\:s",
@ -220,7 +220,8 @@ namespace DMX2
@"h\:m\:s\.f" @"h\:m\:s\.f"
}; };
if(!TimeSpan.TryParseExact(txtGoto.Text,formats,null,out ts)) return; if(!TimeSpan.TryParseExact(txtGoto.Text,formats,null,out ts)) return;
sequenceur.PlayTime = ts; sequenceur.PlayTime = ts;*/
sequenceur.Command(txtGoto.Text);
} }
protected void OnListFilesCursorChanged (object sender, EventArgs e) protected void OnListFilesCursorChanged (object sender, EventArgs e)

View file

@ -49,7 +49,8 @@ namespace DMX2
delegate void Task (); delegate void Task ();
Queue<Task> taskQueue = new Queue<Task>(); System.Collections.Concurrent.ConcurrentQueue<Task> taskQueue =
new System.Collections.Concurrent.ConcurrentQueue<Task>();
TimeSpan fading=TimeSpan.Zero; TimeSpan fading=TimeSpan.Zero;
TimeSpan fadeLen; TimeSpan fadeLen;
@ -107,10 +108,9 @@ namespace DMX2
set{ set{
if(element==null) return; if(element==null) return;
if(element.CurrentState != Gst.State.Paused && element.CurrentState != Gst.State.Playing){ if(element.CurrentState != Gst.State.Paused && element.CurrentState != Gst.State.Playing){
lock(this) taskQueue.Enqueue(delegate(){
taskQueue.Enqueue(delegate(){ PlayTime = value;
PlayTime = value; });
});
return; return;
} }
long pos = (long)(value.TotalMilliseconds) * 1000000; long pos = (long)(value.TotalMilliseconds) * 1000000;
@ -163,10 +163,9 @@ namespace DMX2
{ {
if(element == null)return; if(element == null)return;
if(element.CurrentState != Gst.State.Paused && element.CurrentState != Gst.State.Playing){ if(element.CurrentState != Gst.State.Paused && element.CurrentState != Gst.State.Playing){
lock(this) taskQueue.Enqueue(delegate(){
taskQueue.Enqueue(delegate(){ Play();
Play(); });
});
return; return;
} }
@ -183,7 +182,8 @@ namespace DMX2
element.SetState(Gst.State.Null); element.SetState(Gst.State.Null);
element.Dispose(); element.Dispose();
element=null; element=null;
taskQueue.Clear(); Task t;
while(taskQueue.TryDequeue (out t));
} }
static void GstInit () static void GstInit ()
@ -222,11 +222,13 @@ namespace DMX2
public override void Tick (TimeSpan time) public override void Tick (TimeSpan time)
{ {
if(element!=null && taskQueue.Count>0) if (element != null) {
if(element.CurrentState == Gst.State.Paused || element.CurrentState == Gst.State.Playing) if (element.CurrentState == Gst.State.Paused || element.CurrentState == Gst.State.Playing)
lock(this) {
taskQueue.Dequeue()(); Task t;
while(taskQueue.TryDequeue(out t)) t();
}
}
if (fading != TimeSpan.Zero) { if (fading != TimeSpan.Zero) {
fading-=time; fading-=time;
if(fading<=TimeSpan.Zero){ if(fading<=TimeSpan.Zero){

View file

@ -43,6 +43,7 @@ namespace DMX2
private global::Gtk.Toolbar toolbar4; private global::Gtk.Toolbar toolbar4;
private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.ScrolledWindow GtkScrolledWindow;
private global::Gtk.NodeView listFiles; private global::Gtk.NodeView listFiles;
private global::Gtk.Label label1;
private global::Gtk.Label GtkLabel9; private global::Gtk.Label GtkLabel9;
protected virtual void Build () protected virtual void Build ()
@ -344,7 +345,7 @@ namespace DMX2
this.btnGoto.CanFocus = true; this.btnGoto.CanFocus = true;
this.btnGoto.Name = "btnGoto"; this.btnGoto.Name = "btnGoto";
this.btnGoto.UseUnderline = true; this.btnGoto.UseUnderline = true;
this.btnGoto.Label = "GoTo"; this.btnGoto.Label = "Cmd";
this.hbox3.Add (this.btnGoto); this.hbox3.Add (this.btnGoto);
global::Gtk.Box.BoxChild w73 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnGoto])); global::Gtk.Box.BoxChild w73 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.btnGoto]));
w73.Position = 8; w73.Position = 8;
@ -407,6 +408,17 @@ namespace DMX2
this.vbox2.Add (this.GtkScrolledWindow); this.vbox2.Add (this.GtkScrolledWindow);
global::Gtk.Box.BoxChild w80 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.GtkScrolledWindow])); global::Gtk.Box.BoxChild w80 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.GtkScrolledWindow]));
w80.Position = 1; w80.Position = 1;
// Container child vbox2.Gtk.Box+BoxChild
this.label1 = new global::Gtk.Label ();
this.label1.Name = "label1";
this.label1.Xalign = 0F;
this.label1.LabelProp = "Commands : \n[XX][gMM:SS.f][vVOL,T][p|ps|s]\n(FileNumber)(g=goto)(v=volume,fade in/out time)(p=play,ps=pause,s=stop)";
this.label1.UseMarkup = true;
this.vbox2.Add (this.label1);
global::Gtk.Box.BoxChild w81 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label1]));
w81.Position = 2;
w81.Expand = false;
w81.Fill = false;
this.GtkAlignment.Add (this.vbox2); this.GtkAlignment.Add (this.vbox2);
this.frame1.Add (this.GtkAlignment); this.frame1.Add (this.GtkAlignment);
this.GtkLabel9 = new global::Gtk.Label (); this.GtkLabel9 = new global::Gtk.Label ();

View file

@ -3842,7 +3842,7 @@ trames DMX (ms)</property>
<property name="MemberName" /> <property name="MemberName" />
<property name="CanFocus">True</property> <property name="CanFocus">True</property>
<property name="Type">TextOnly</property> <property name="Type">TextOnly</property>
<property name="Label" translatable="yes">GoTo</property> <property name="Label" translatable="yes">Cmd</property>
<property name="UseUnderline">True</property> <property name="UseUnderline">True</property>
<signal name="Clicked" handler="OnBtnGotoClicked" /> <signal name="Clicked" handler="OnBtnGotoClicked" />
</widget> </widget>
@ -3896,7 +3896,7 @@ trames DMX (ms)</property>
<property name="ShowArrow">False</property> <property name="ShowArrow">False</property>
<property name="ButtonStyle">Icons</property> <property name="ButtonStyle">Icons</property>
<property name="IconSize">SmallToolbar</property> <property name="IconSize">SmallToolbar</property>
<node name="__gtksharp_92_Stetic_Editor_ActionToolbar" type="Toolbar"> <node name="toolbar4" type="Toolbar">
<node type="Toolitem" action="closeAction1" /> <node type="Toolitem" action="closeAction1" />
<node type="Toolitem" action="actAddFile" /> <node type="Toolitem" action="actAddFile" />
<node type="Toolitem" action="actDelFile" /> <node type="Toolitem" action="actDelFile" />
@ -3936,6 +3936,22 @@ trames DMX (ms)</property>
<property name="AutoSize">True</property> <property name="AutoSize">True</property>
</packing> </packing>
</child> </child>
<child>
<widget class="Gtk.Label" id="label1">
<property name="MemberName" />
<property name="Xalign">0</property>
<property name="LabelProp" translatable="yes">Commands :
[XX][gMM:SS.f][vVOL,T][p|ps|s]
(FileNumber)(g=goto)(v=volume,fade in/out time)(p=play,ps=pause,s=stop)</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>