Moved all bindings to the "bindings" sub-directory
Renamed the CSFML directory to c Renamed the DSFML directory to d --> bindings must now be updated to match the new organization! git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1630 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
0cc5563cac
commit
0e2297af28
417 changed files with 0 additions and 0 deletions
82
bindings/dotnet/examples/sound/Sound.cs
Normal file
82
bindings/dotnet/examples/sound/Sound.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using SFML;
|
||||
using SFML.Audio;
|
||||
|
||||
namespace sound
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Play a sound
|
||||
PlaySound();
|
||||
Console.Clear();
|
||||
|
||||
// Play a music
|
||||
PlayMusic();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play a sound
|
||||
/// </summary>
|
||||
private static void PlaySound()
|
||||
{
|
||||
// Load a sound buffer from a wav file
|
||||
SoundBuffer buffer = new SoundBuffer("resources/canary.wav");
|
||||
|
||||
// Display sound informations
|
||||
Console.WriteLine("canary.wav :");
|
||||
Console.WriteLine(" " + buffer.Duration + " sec");
|
||||
Console.WriteLine(" " + buffer.SampleRate + " samples / sec");
|
||||
Console.WriteLine(" " + buffer.ChannelsCount + " channels");
|
||||
|
||||
// Create a sound instance and play it
|
||||
Sound sound = new Sound(buffer);
|
||||
sound.Play();
|
||||
|
||||
// Loop while the sound is playing
|
||||
while (sound.Status == SoundStatus.Playing)
|
||||
{
|
||||
// Display the playing position
|
||||
Console.CursorLeft = 0;
|
||||
Console.Write("Playing... " + sound.PlayingOffset + " sec ");
|
||||
|
||||
// Leave some CPU time for other processes
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play a music
|
||||
/// </summary>
|
||||
private static void PlayMusic()
|
||||
{
|
||||
// Load an ogg music file
|
||||
Music music = new Music("resources/orchestral.ogg");
|
||||
|
||||
// Display music informations
|
||||
Console.WriteLine("orchestral.ogg :");
|
||||
Console.WriteLine(" " + music.Duration + " sec");
|
||||
Console.WriteLine(" " + music.SampleRate + " samples / sec");
|
||||
Console.WriteLine(" " + music.ChannelsCount + " channels");
|
||||
|
||||
// Play it
|
||||
music.Play();
|
||||
|
||||
// Loop while the music is playing
|
||||
while (music.Status == SoundStatus.Playing)
|
||||
{
|
||||
// Display the playing position
|
||||
Console.CursorLeft = 0;
|
||||
Console.Write("Playing... " + music.PlayingOffset + " sec ");
|
||||
|
||||
// Leave some CPU time for other processes
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
bindings/dotnet/examples/sound/resources/canary.wav
Normal file
BIN
bindings/dotnet/examples/sound/resources/canary.wav
Normal file
Binary file not shown.
BIN
bindings/dotnet/examples/sound/resources/orchestral.ogg
Normal file
BIN
bindings/dotnet/examples/sound/resources/orchestral.ogg
Normal file
Binary file not shown.
60
bindings/dotnet/examples/sound/sound.csproj
Normal file
60
bindings/dotnet/examples/sound/sound.csproj
Normal file
|
@ -0,0 +1,60 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{16E177F3-A0FF-4091-8521-562E0EBAA3AB}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>sound</RootNamespace>
|
||||
<AssemblyName>sound</AssemblyName>
|
||||
<StartupObject>sound.Program</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\</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="Sound.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>
|
Loading…
Add table
Add a link
Reference in a new issue