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,83 @@
using System;
using System.Threading;
using SFML;
using SFML.Audio;
namespace sample_soundcapture
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
// Check that the device can capture audio
if (SoundRecorder.CanCapture == false)
{
Console.WriteLine("Sorry, audio capture is not supported by your system");
return;
}
// Choose the sample rate
Console.WriteLine("Please choose the sample rate for sound capture (44100 is CD quality) : ");
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();
// Audio capture is done in a separate thread, so we can block the main thread while it is capturing
Recorder.Start(SampleRate);
Console.WriteLine("Recording... press enter to stop");
Console.ReadLine();
Recorder.Stop();
// Get the buffer containing the captured data
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");
// 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());
if (Choice == 's')
{
// Choose the filename
Console.WriteLine("Choose the file to create : ");
string Filename = Console.ReadLine();
// Save the buffer
Buffer.SaveToFile(Filename);
}
else
{
// Create a sound instance and play it
Sound Sound = new Sound(Buffer);
Sound.Play();
// Wait until finished
while (Sound.Status == SoundStatus.Playing)
{
// Display the playing position
Console.CursorLeft = 0;
Console.Write("Playing... " + Sound.PlayingOffset + " sec ");
// Leave some CPU time for other threads
Thread.Sleep(100);
}
}
// Finished !
Console.WriteLine("\nDone !");
}
}
}

View file

@ -0,0 +1,56 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F2F48990-F81E-41BA-AD01-168F6178C807}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>sample_soundcapture</RootNamespace>
<AssemblyName>sound-capture</AssemblyName>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Audio\sfml-audio.csproj">
<Project>{0B202C4D-A457-47FE-84A3-031DD878C6BE}</Project>
<Name>sfml-audio</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Window\sfml-window.csproj">
<Project>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</Project>
<Name>sfml-window</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="SoundCapture.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>