[gnome-devel-docs: 5/19] Proofread Guitar Tuner C++



commit 4ba03d85313f284db06480b602e286d1bd95f8eb
Author: P. F. Chimento <philip chimento gmail com>
Date:   Mon Mar 21 00:48:24 2011 +0100

    Proofread Guitar Tuner C++

 platform-demos/C/guitar-tuner.cpp.page |   46 ++++++++++++++++----------------
 1 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/platform-demos/C/guitar-tuner.cpp.page b/platform-demos/C/guitar-tuner.cpp.page
index 6d59051..9734086 100644
--- a/platform-demos/C/guitar-tuner.cpp.page
+++ b/platform-demos/C/guitar-tuner.cpp.page
@@ -65,7 +65,7 @@
   
   <list>
   <item>
-    <p>The three <code>#include</code> lines at the top include the <code>config</code> (useful autoconf build defines), <code>gtkmm</code> (user interface) and <code>iostream</code> STL. Functions from these libraries are used in the rest of the code.</p>
+    <p>The three <code>#include</code> lines at the top include the <code>config</code> (useful autoconf build defines), <code>gtkmm</code> (user interface) and <code>iostream</code> (STL). Functions from these libraries are used in the rest of the code.</p>
    </item>
    <item>
     <p>The <code>main</code> function creates a new window by opening a GtkBuilder file (<file>src/guitar-tuner.ui</file>, defined a few lines above) and then displaying it in a window. The GtkBuilder file contains a description of a user interface and all of its elements. You can use Anjuta's editor to design GtkBuilder user interfaces.</p>
@@ -110,7 +110,7 @@ six strings) and the orientation to vertical.</p>
 
 <section>
   <title>GStreamer pipelines</title>
-  <p>GStreamer is GNOME's multimedia framework &#x2014; you can use it for playing, recording, and processing video, audio, webcam streams and the like. Here, we'll be using it to produce single-frequency tones. GStreamermm is the C++-Binding to GStreamer which
+  <p>GStreamer is GNOME's multimedia framework &#x2014; you can use it for playing, recording, and processing video, audio, webcam streams and the like. Here, we'll be using it to produce single-frequency tones. GStreamermm is the C++ binding to GStreamer which
   we will use here.</p>
   <p>Conceptually, GStreamer works as follows: You create a <em>pipeline</em> containing several processing elements going from the <em>source</em> to the <em>sink</em> (output). The source can be an image file, a video, or a music file, for example, and the output could be a widget or the soundcard.</p>
   <p>Between source and sink, you can apply various filters and converters to handle effects, format conversions and so on. Each element of the pipeline has properties which can be used to change its behaviour.</p>
@@ -121,16 +121,16 @@ six strings) and the orientation to vertical.</p>
 
 <section>
   <title>Using GStreamermm</title>
-  <p>To use GStreamermm is has to be initiliased. We do that by adding the following line of code next to the
+  <p>To use GStreamermm, it has to be initialised. We do that by adding the following line of code next to the
   <code>Gtk::Main kit(argc, argv);</code> line in <file>main.cc</file>:</p>
-  <p><code>	Gtk::Main kit(argc, argv);</code></p>
-  <p>While we are on it, also make sure that the <file>gstreamermm.h</file> is included in main.cc properly.</p>
+  <p><code>	Gst::init (argc, argv);</code></p>
+  <p>While we are on it, also make sure that the <file>gstreamermm.h</file> is included in <file>main.cc</file> properly.</p>
   
   <p>In this simple example we will use a tone generator source called <code>audiotestsrc</code> and send the output to the default system sound device, <code>autoaudiosink</code>. We only need to configure the frequency of the tone generator; this is accessible through the <code>freq</code> property of <code>audiotestsrc</code>.</p>
   
-  <p>To simplify the handling of the pipeline we will define a helper class Sound. We do
-  that in <file>main.cc</file> for keeping this example simple while you may want
-  to use a seperate file usually:</p>
+  <p>To simplify the handling of the pipeline we will define a helper class <code>Sound</code>. We do
+  that in <file>main.cc</file> in order to keep this example simple, whereas you might usually want
+  to use a separate file:</p>
   <code><![CDATA[
 class Sound
 {
@@ -178,17 +178,17 @@ bool Sound::stop_playing()
   <p>The code has the following purpose:</p>  
   <steps>
     <item>
-    <p>In the constructor source and sink GStreamer elements (<code>Gst::Element</code>) are created, and a pipeline element (which will be used as a container for the other two elements). The pipeline is given the name "note"; the source is named "source" and is set to the <code>audiotestsrc</code> source; and the sink is named "output" and set to the <code>autoaudiosink</code> sink (default sound card output). After the elements have been added to the pipeline and linked together, the pipeline is ready to run.</p>
+    <p>In the constructor, source and sink GStreamer elements (<code>Gst::Element</code>) are created, and a pipeline element (which will be used as a container for the other two elements). The pipeline is given the name "note"; the source is named "source" and is set to the <code>audiotestsrc</code> source; and the sink is named "output" and set to the <code>autoaudiosink</code> sink (default sound card output). After the elements have been added to the pipeline and linked together, the pipeline is ready to run.</p>
     </item>
     <item>
-    <p><code>start_playing()</code> set the source element to play a particular frequency and then start the pipeline so the sound
-    actually starts playing. As we don't want to have the annoying sound for ages, a timeout is setup to stop the pipeline
-    after 200 ms by calling <code>stop_playing()</code></p>
+    <p><code>start_playing</code> sets the source element to play a particular frequency and then starts the pipeline so the sound
+    actually starts playing. As we don't want to have the annoying sound for ages, a timeout is set up to stop the pipeline
+    after 200 ms by calling <code>stop_playing</code>.</p>
     </item>
     <item>
-    <p>In <code>stop_playing()</code> which is called when the timeout ellapsed, the pipeline is stopped and as such there isn't
+    <p>In <code>stop_playing</code> which is called when the timeout has elapsed, the pipeline is stopped and as such there isn't
     any sound output anymore. As GStreamermm uses reference counting through the <code>Glib::RefPtr</code> object, the memory
-    is automatically free'd once the <code>Sound</code> class is destroyed.</p>
+    is automatically freed once the <code>Sound</code> class is destroyed.</p>
     </item>
   </steps> 
 </section>
@@ -200,7 +200,7 @@ bool Sound::stop_playing()
   called function which tone to play. GTKmm makes that quite easy as we can easily bind information with the <em>sigc</em>
   library.</p> 
   
-  <p>The function that is called when the user clicks a button can be pretty simple now as
+  <p>The function that is called when the user clicks a button can be pretty simple, as
   all the interesting stuff is done in the helper class now:</p>
   <code mime="text/x-csrc"><![CDATA[
 static void
@@ -216,12 +216,12 @@ on_button_clicked(double frequency, Sound* sound)
   <p>The code to set up the signals should be added to the <code>main()</code> function just after the 
   <code>builder->get_widget("main_window", main_win);</code> line:</p>
   <code mime="text/x-csrc"><![CDATA[
-    Sound sound;
-    Gtk::Button* button;
-  
-	builder->get_widget("button_E", button);
-	button->signal_clicked().connect (sigc::bind<double, Sound*>(sigc::ptr_fun(&on_button_clicked),
-	                                              369.23, &sound));
+Sound sound;
+Gtk::Button* button;
+
+builder->get_widget("button_E", button);
+button->signal_clicked().connect (sigc::bind<double, Sound*>(sigc::ptr_fun(&on_button_clicked),
+                                              369.23, &sound));
 ]]></code>
 	<steps>
 	<item>
@@ -233,14 +233,14 @@ on_button_clicked(double frequency, Sound* sound)
 	that <em>button_E</em> is the name we gave to the first button.</p>
 	</item>
 	<item>
-	<p>Finally we connect the <em>clicked</em>-signal. This isn't fully straighforward because this is done in a fully type-safe
+	<p>Finally we connect the <em>clicked</em> signal. This isn't fully straightforward because this is done in a fully type-safe
 	way and we actually want to pass the frequency and our helper class to the signal handler. 
 	<code>sigc::ptr_fun(&amp;on_button_clicked)</code> creates a <em>slot</em> for the <code>on_button_clicked</code> method
 	we defined above. With <code>sigc::bind</code> we are able to pass additional arguments to the slot and in this
 	case we pass the frequency (as double) and our helper class.</p>
 	</item>
   </steps>
-  <p>Now that we have setup the <em>E</em> button we also need to connect the other buttons according to their frequencies,
+  <p>Now that we have set up the <em>E</em> button we also need to connect the other buttons according to their frequencies:
   440 for A,  587.33 for D, 783.99 for G, 987.77 for B and 1318.5 for the high E. This is done in the same way, just passing
   a different frequency to the handler.</p> 
 </section>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]