Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-01-28 16:18:34 +00:00
commit 2f524481c1
974 changed files with 295448 additions and 0 deletions

View file

@ -0,0 +1,70 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Collections.Generic;
namespace SFML
{
namespace Audio
{
////////////////////////////////////////////////////////////
/// <summary>
/// Specialized SoundRecorder which saves the captured
/// audio data into a sound buffer
/// </summary>
////////////////////////////////////////////////////////////
public class SoundBufferRecorder : SoundRecorder
{
////////////////////////////////////////////////////////////
/// <summary>
/// Sound buffer containing the recorded data (invalid until the capture stops)
/// </summary>
////////////////////////////////////////////////////////////
public SoundBuffer SoundBuffer
{
get
{
return mySoundBuffer;
}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Called when a new capture starts
/// </summary>
/// <returns>False to abort recording audio data, true to continue</returns>
////////////////////////////////////////////////////////////
protected override bool OnStart()
{
mySamplesArray.Clear();
return true;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Process a new chunk of recorded samples
/// </summary>
/// <param name="samples">Array of samples to process</param>
/// <returns>False to stop recording audio data, true to continue</returns>
////////////////////////////////////////////////////////////
protected override bool OnProcessSamples(short[] samples)
{
mySamplesArray.AddRange(samples);
return true;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Called when the current capture stops
/// </summary>
////////////////////////////////////////////////////////////
protected override void OnStop()
{
mySoundBuffer = new SoundBuffer(mySamplesArray.ToArray(), 1, SampleRate);
}
List<short> mySamplesArray = new List<short>();
SoundBuffer mySoundBuffer = null;
}
}
}