Changed naming convention for local variables

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1181 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-17 08:11:03 +00:00
parent 34817446c0
commit 16275d05e8
5 changed files with 174 additions and 174 deletions

View file

@ -21,55 +21,55 @@ namespace sample_soundcapture
// Choose the sample rate
Console.WriteLine("Please choose the sample rate for sound capture (44100 is CD quality) : ");
uint SampleRate = uint.Parse(Console.ReadLine());
uint sampleRate = uint.Parse(Console.ReadLine());
// Wait for user input...
Console.WriteLine("Press enter to start recording audio");
Console.ReadLine();
// Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer
SoundBufferRecorder Recorder = new SoundBufferRecorder();
SoundBufferRecorder recorder = new SoundBufferRecorder();
// Audio capture is done in a separate thread, so we can block the main thread while it is capturing
Recorder.Start(SampleRate);
recorder.Start(sampleRate);
Console.WriteLine("Recording... press enter to stop");
Console.ReadLine();
Recorder.Stop();
recorder.Stop();
// Get the buffer containing the captured data
SoundBuffer Buffer = Recorder.SoundBuffer;
SoundBuffer buffer = recorder.SoundBuffer;
// Display captured sound informations
Console.WriteLine("Sound information :");
Console.WriteLine(" " + Buffer.Duration + " seconds");
Console.WriteLine(" " + Buffer.SampleRate + " samples / seconds");
Console.WriteLine(" " + Buffer.ChannelsCount + " channels");
Console.WriteLine(" " + buffer.Duration + " seconds");
Console.WriteLine(" " + buffer.SampleRate + " samples / seconds");
Console.WriteLine(" " + buffer.ChannelsCount + " channels");
// Choose what to do with the recorded sound data
Console.WriteLine("What do you want to do with captured sound (p = play, s = save) ? ");
char Choice = char.Parse(Console.ReadLine());
char choice = char.Parse(Console.ReadLine());
if (Choice == 's')
if (choice == 's')
{
// Choose the filename
Console.WriteLine("Choose the file to create : ");
string Filename = Console.ReadLine();
string filename = Console.ReadLine();
// Save the buffer
Buffer.SaveToFile(Filename);
buffer.SaveToFile(filename);
}
else
{
// Create a sound instance and play it
Sound Sound = new Sound(Buffer);
Sound.Play();
Sound sound = new Sound(buffer);
sound.Play();
// Wait until finished
while (Sound.Status == SoundStatus.Playing)
while (sound.Status == SoundStatus.Playing)
{
// Display the playing position
Console.CursorLeft = 0;
Console.Write("Playing... " + Sound.PlayingOffset + " sec ");
Console.Write("Playing... " + sound.PlayingOffset + " sec ");
// Leave some CPU time for other threads
Thread.Sleep(100);