[gnome-devel-docs] demos: fix guitar tuner not playing more than 32 times.
- From: Luis Menina <lmenina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] demos: fix guitar tuner not playing more than 32 times.
- Date: Wed, 25 Sep 2013 20:48:59 +0000 (UTC)
commit 8bd090d3b3e0bec861a23803b84259b1ed04e14a
Author: Luis Menina <liberforce freeside fr>
Date: Wed Sep 25 22:39:50 2013 +0200
demos: fix guitar tuner not playing more than 32 times.
This fix is for javascript, python and vala versions.
See bug 687628.
platform-demos/C/guitar-tuner.js.page | 6 +++---
platform-demos/C/guitar-tuner.py.page | 4 ++--
platform-demos/C/guitar-tuner.vala.page | 2 +-
platform-demos/C/guitar-tuner/guitar-tuner.js | 2 +-
platform-demos/C/guitar-tuner/guitar-tuner.py | 2 +-
platform-demos/C/guitar-tuner/guitar-tuner.vala | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/platform-demos/C/guitar-tuner.js.page b/platform-demos/C/guitar-tuner.js.page
index 2d91db4..d9a73eb 100644
--- a/platform-demos/C/guitar-tuner.js.page
+++ b/platform-demos/C/guitar-tuner.js.page
@@ -115,11 +115,11 @@ function playSound(frequency){
pipeline.set_state(Gst.State.PLAYING);
Mainloop.timeout_add(500, function () {
- pipeline.set_state(Gst.State.PAUSED);
+ pipeline.set_state(Gst.State.NULL);
return false;
});
}]]></code>
- <p>The first thing we need to do is decide what tunes we want to make when we push a button. The
frequencies list takes care of that. After that we get to actually making the sounds with the function
playSound. For function playSound we give as an input a frequency (that we just defined in the frequencies
variable). First thing we need to construct is a pipeline, a source and a sink. For the source we set the
frequency. To the pipeline we add both the source and the sink and then we tell it to keep playing. As a last
thing we use the const Mainloop to get the pipeline to pause after a 500ms. </p>
+ <p>The first thing we need to do is decide what tunes we want to make when we push a button. The
frequencies list takes care of that. After that we get to actually making the sounds with the function
playSound. For function playSound we give as an input a frequency (that we just defined in the frequencies
variable). First thing we need to construct is a pipeline, a source and a sink. For the source we set the
frequency. To the pipeline we add both the source and the sink and then we tell it to keep playing. As a last
thing we use the const Mainloop to get the pipeline to stop after a 500ms.</p>
<p>Now we have the method of playing a tune when clicking a button. Next well make the conncetions
between pushing a button and playing the correct sound from that button.</p>
</section>
<section id="connecting">
@@ -194,7 +194,7 @@ function playSound(frequency){
pipeline.set_state(Gst.State.PLAYING);
Mainloop.timeout_add(500, function () {
- pipeline.set_state(Gst.State.PAUSED);
+ pipeline.set_state(Gst.State.NULL);
return false;
});
}
diff --git a/platform-demos/C/guitar-tuner.py.page b/platform-demos/C/guitar-tuner.py.page
index cc5d1ec..117bdc6 100644
--- a/platform-demos/C/guitar-tuner.py.page
+++ b/platform-demos/C/guitar-tuner.py.page
@@ -192,7 +192,7 @@ def play_sound(self, frequency):
<p>Now, we'll write the <code>pipeline_stop</code> function which is called by
<code>GObject.timeout_add</code>. Insert the following code <em>above</em> the <code>play_sound</code>
function:</p>
<code mime="test/x-python"><![CDATA[
def pipeline_stop(self, pipeline):
- pipeline.set_state(Gst.State.PAUSED)
+ pipeline.set_state(Gst.State.NULL)
return False
]]></code>
<p>You need to define the <code>LENGTH</code> constant inside the class, so add this code at the beginning
of the
@@ -200,7 +200,7 @@ main class:</p>
<code mime="test/x-python"><![CDATA[
LENGTH = 500
]]></code>
- <p>The call to <code>pipeline.set_state</code> pauses the playback of the pipeline.</p>
+ <p>The call to <code>pipeline.set_state</code> stops the playback of the pipeline.</p>
</section>
<section id="tones">
diff --git a/platform-demos/C/guitar-tuner.vala.page b/platform-demos/C/guitar-tuner.vala.page
index a4aba0d..bd3edf9 100644
--- a/platform-demos/C/guitar-tuner.vala.page
+++ b/platform-demos/C/guitar-tuner.vala.page
@@ -169,7 +169,7 @@ private void play_sound(double frequency)
var time = new TimeoutSource(200);
time.set_callback(() => {
- pipeline.set_state (Gst.State.PAUSED);
+ pipeline.set_state (Gst.State.NULL);
return false;
});
time.attach(null);
diff --git a/platform-demos/C/guitar-tuner/guitar-tuner.js b/platform-demos/C/guitar-tuner/guitar-tuner.js
index 699f036..a3e08f5 100644
--- a/platform-demos/C/guitar-tuner/guitar-tuner.js
+++ b/platform-demos/C/guitar-tuner/guitar-tuner.js
@@ -36,7 +36,7 @@ function playSound(frequency){
pipeline.set_state(Gst.State.PLAYING);
Mainloop.timeout_add(500, function () {
- pipeline.set_state(Gst.State.PAUSED);
+ pipeline.set_state(Gst.State.NULL);
return false;
});
}
diff --git a/platform-demos/C/guitar-tuner/guitar-tuner.py b/platform-demos/C/guitar-tuner/guitar-tuner.py
index eb87c11..749f39c 100644
--- a/platform-demos/C/guitar-tuner/guitar-tuner.py
+++ b/platform-demos/C/guitar-tuner/guitar-tuner.py
@@ -37,7 +37,7 @@ class GUI:
Gtk.main_quit()
def pipeline_stop(self, pipeline):
- pipeline.set_state(Gst.State.PAUSED)
+ pipeline.set_state(Gst.State.NULL)
return False
def play_sound(self, frequency):
diff --git a/platform-demos/C/guitar-tuner/guitar-tuner.vala b/platform-demos/C/guitar-tuner/guitar-tuner.vala
index e235ee2..238b8e9 100644
--- a/platform-demos/C/guitar-tuner/guitar-tuner.vala
+++ b/platform-demos/C/guitar-tuner/guitar-tuner.vala
@@ -83,7 +83,7 @@ public class Main : Object
var time = new TimeoutSource(200);
time.set_callback(() => {
- pipeline.set_state (Gst.State.PAUSED);
+ pipeline.set_state (Gst.State.NULL);
return false;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]