Skip to content

Commit

Permalink
Removed waveOut since it is already in Sharpex2D
Browse files Browse the repository at this point in the history
  • Loading branch information
ThuCommix committed Jul 2, 2014
1 parent 1cbb70d commit 78566e8
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 290 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2012-2014 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


namespace Sharpex2D.Framework.Audio.DirectSound
{
[Developer("ThuCommix", "developer@sharpex2d.de")]
[TestState(TestState.Tested)]
public class DirectSoundInitializer : ISoundInitializer
{
/// <summary>
/// Creates the ISoundProvider.
/// </summary>
/// <returns>ISoundProvider</returns>
public ISoundProvider CreateProvider()
{
return new DirectSoundProvider(this);
}

/// <summary>
/// A value indicating whether the ISoundInitializer is supported.
/// </summary>
/// <remarks>CSCore dont provide any info about that, so we return true.</remarks>
public bool IsSupported { get { return true; } }
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
using System;
// Copyright (c) 2012-2014 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using CSCore;
using CSCore.Codecs;
using CSCore.SoundOut;
using CSCore.Streams;

namespace Sharpex2D.Framework.Media.Sound.DirectSound
namespace Sharpex2D.Framework.Audio.DirectSound
{
[Developer("ThuCommix", "developer@sharpex2d.de")]
[Copyright("©Sharpex2D 2013 - 2014")]
[TestState(TestState.Tested)]
public class DirectSoundProvider : ISoundProvider
{
Expand All @@ -29,9 +48,11 @@ public Guid Guid
/// <summary>
/// Initializes a new CSCoreSoundProvider class.
/// </summary>
internal DirectSoundProvider()
/// <param name="soundInitializer">The SoundInitializer.</param>
internal DirectSoundProvider(ISoundInitializer soundInitializer)
{
_directSoundOut = new DirectSoundOutExtended();
SoundInitializer = soundInitializer;
}

/// <summary>
Expand All @@ -47,7 +68,7 @@ private PlaybackState PlaybackState
/// </summary>
/// <param name="soundFile">The Soundfile.</param>
/// <param name="playMode">The PlayMode.</param>
public void Play(Sound soundFile, PlayMode playMode)
public void Play(Audio.Sound soundFile, PlayMode playMode)
{
Play(CodecFactory.Instance.GetCodec(soundFile.ResourcePath), playMode);
}
Expand Down Expand Up @@ -119,6 +140,11 @@ public float Volume
set { _directSoundOut.Volume = value; }
}

/// <summary>
/// Gets the SoundInitializer.
/// </summary>
public ISoundInitializer SoundInitializer { private set; get; }

/// <summary>
/// Disposes the SoundProvider.
/// </summary>
Expand All @@ -128,15 +154,6 @@ public void Dispose()
GC.SuppressFinalize(this);
}

/// <summary>
/// Clones the SoundProvider.
/// </summary>
/// <returns></returns>
public object Clone()
{
return MemberwiseClone();
}

/// <summary>
/// Plays the sound.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2012-2014 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using CSCore.SoundOut;

namespace Sharpex2D.Framework.Audio.Wasapi
{
[Developer("ThuCommix", "developer@sharpex2d.de")]
[TestState(TestState.Tested)]
public class WasapiSoundInitializer : ISoundInitializer
{
/// <summary>
/// Creates a new SoundProvider class.
/// </summary>
/// <returns>SoundProvider</returns>
public ISoundProvider CreateProvider()
{
if (!WasapiOut.IsSupportedOnCurrentPlatform)
throw new InvalidOperationException("Wasapi is not supported for your system. (Vista and higher)");
return new WasapiSoundProvider(this);
}

/// <summary>
/// A value indicating whether the ISoundInitializer is supported.
/// </summary>
public bool IsSupported { get { return WasapiOut.IsSupportedOnCurrentPlatform; } }
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
using System;
// Copyright (c) 2012-2014 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using CSCore;
using CSCore.Codecs;
using CSCore.CoreAudioAPI;
using CSCore.SoundOut;
using CSCore.Streams;

namespace Sharpex2D.Framework.Media.Sound.Wasapi
namespace Sharpex2D.Framework.Audio.Wasapi
{
[Developer("ThuCommix", "developer@sharpex2d.de")]
[Copyright("©Sharpex2D 2013 - 2014")]
[TestState(TestState.Tested)]
public class WasapiSoundProvider : ISoundProvider
{
Expand All @@ -31,9 +50,11 @@ public Guid Guid
/// <summary>
/// Initializes a new WasapiSoundProvider class.
/// </summary>
internal WasapiSoundProvider()
/// <param name="soundInitializer">The SoundInitializer.</param>
internal WasapiSoundProvider(ISoundInitializer soundInitializer)
{
_soundOut = new WasapiOut(false, AudioClientShareMode.Shared, 100);
SoundInitializer = soundInitializer;
}

/// <summary>
Expand All @@ -53,21 +74,12 @@ public void Dispose()
GC.SuppressFinalize(this);
}

/// <summary>
/// Clones the SoundProvider.
/// </summary>
/// <returns></returns>
public object Clone()
{
return MemberwiseClone();
}

/// <summary>
/// Plays the sound.
/// </summary>
/// <param name="soundFile">The Soundfile.</param>
/// <param name="playMode">The PlayMode.</param>
public void Play(Sound soundFile, PlayMode playMode)
public void Play(Audio.Sound soundFile, PlayMode playMode)
{
Play(CodecFactory.Instance.GetCodec(soundFile.ResourcePath), playMode);
}
Expand Down Expand Up @@ -139,6 +151,11 @@ public float Volume
set { _soundOut.Volume = value; }
}

/// <summary>
/// Gets the SoundInitializer.
/// </summary>
public ISoundInitializer SoundInitializer { private set; get; }

/// <summary>
/// Disposes the SoundProvider.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
using System.Reflection;
// Copyright (c) 2012-2014 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System.Reflection;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Framework\Media\Sound\DirectSound\DirectSoundInitializer.cs" />
<Compile Include="Framework\Media\Sound\DirectSound\DirectSoundProvider.cs" />
<Compile Include="Framework\Media\Sound\Wasapi\WasapiSoundInitializer.cs" />
<Compile Include="Framework\Media\Sound\Wasapi\WasapiSoundProvider.cs" />
<Compile Include="Framework\Media\Sound\WaveOut\WaveOutSoundInitializer.cs" />
<Compile Include="Framework\Media\Sound\WaveOut\WaveOutSoundProvider.cs" />
<Compile Include="Framework\Audio\DirectSound\DirectSoundInitializer.cs" />
<Compile Include="Framework\Audio\DirectSound\DirectSoundProvider.cs" />
<Compile Include="Framework\Audio\Wasapi\WasapiSoundInitializer.cs" />
<Compile Include="Framework\Audio\Wasapi\WasapiSoundProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 78566e8

Please sign in to comment.