Skip to content

Commit c5be1a7

Browse files
committed
#8: Audio project and initial XAudio2 project.
1 parent 10e6ade commit c5be1a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+109
-8
lines changed

Diff for: Vortice.sln

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawTriangle", "src\samples
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawTriangle.Windows", "src\samples\Graphics\DrawTriangle.Windows\DrawTriangle.Windows.csproj", "{96F40ED5-9D9E-4D06-A308-BA76E0F3616C}"
3333
EndProject
34-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vortice.Graphics", "src\Vortice.Graphics\Vortice.Graphics.csproj", "{AFF4E338-AA0B-4B5A-9B62-E21410D03862}"
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vortice.Graphics", "src\Graphics\Vortice.Graphics\Vortice.Graphics.csproj", "{AFF4E338-AA0B-4B5A-9B62-E21410D03862}"
3535
EndProject
3636
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{FD5B16DA-11E1-4A00-90E7-C5EE246B7C4E}"
3737
EndProject
@@ -41,6 +41,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Audio", "Audio", "{F0193F7C
4141
EndProject
4242
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vortice.Input", "src\Vortice.Input\Vortice.Input.csproj", "{5276BD22-F00F-4C77-B762-C7700AA4128F}"
4343
EndProject
44+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Grapihcs", "Grapihcs", "{783D107C-4D46-4B9D-95C1-0DD706142BE2}"
45+
EndProject
46+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vortice.Audio", "src\Audio\Vortice.Audio\Vortice.Audio.csproj", "{03BCF697-C6A0-4A76-B4F0-255920B95DD0}"
47+
EndProject
48+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vortice.Audio.XAudio2", "src\Audio\Vortice.Audio.XAudio2\Vortice.Audio.XAudio2.csproj", "{43FB232A-784D-4BE7-916C-022D7CAD8C7E}"
49+
EndProject
4450
Global
4551
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4652
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +81,14 @@ Global
7581
{5276BD22-F00F-4C77-B762-C7700AA4128F}.Debug|Any CPU.Build.0 = Debug|Any CPU
7682
{5276BD22-F00F-4C77-B762-C7700AA4128F}.Release|Any CPU.ActiveCfg = Release|Any CPU
7783
{5276BD22-F00F-4C77-B762-C7700AA4128F}.Release|Any CPU.Build.0 = Release|Any CPU
84+
{03BCF697-C6A0-4A76-B4F0-255920B95DD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85+
{03BCF697-C6A0-4A76-B4F0-255920B95DD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{03BCF697-C6A0-4A76-B4F0-255920B95DD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{03BCF697-C6A0-4A76-B4F0-255920B95DD0}.Release|Any CPU.Build.0 = Release|Any CPU
88+
{43FB232A-784D-4BE7-916C-022D7CAD8C7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
89+
{43FB232A-784D-4BE7-916C-022D7CAD8C7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
90+
{43FB232A-784D-4BE7-916C-022D7CAD8C7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
91+
{43FB232A-784D-4BE7-916C-022D7CAD8C7E}.Release|Any CPU.Build.0 = Release|Any CPU
7892
EndGlobalSection
7993
GlobalSection(SolutionProperties) = preSolution
8094
HideSolutionNode = FALSE
@@ -83,7 +97,10 @@ Global
8397
{4E0EA7FF-529D-4F30-977E-A5C7F3D83835} = {D8EC0278-B4F9-4EF5-A4BE-FE2284C6ECED}
8498
{0DB41C96-7D02-41EE-8E7B-F2B1024A8659} = {4E0EA7FF-529D-4F30-977E-A5C7F3D83835}
8599
{96F40ED5-9D9E-4D06-A308-BA76E0F3616C} = {4E0EA7FF-529D-4F30-977E-A5C7F3D83835}
100+
{AFF4E338-AA0B-4B5A-9B62-E21410D03862} = {783D107C-4D46-4B9D-95C1-0DD706142BE2}
86101
{F6A4373B-0A3F-45F1-BA64-7AD30BB7F04C} = {FD5B16DA-11E1-4A00-90E7-C5EE246B7C4E}
102+
{03BCF697-C6A0-4A76-B4F0-255920B95DD0} = {F0193F7C-734B-48E9-BDA2-5ECD97AC37EC}
103+
{43FB232A-784D-4BE7-916C-022D7CAD8C7E} = {F0193F7C-734B-48E9-BDA2-5ECD97AC37EC}
87104
EndGlobalSection
88105
GlobalSection(ExtensibilityGlobals) = postSolution
89106
SolutionGuid = {85020CE7-9EF6-4502-94F6-98643E762B78}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="..\Vortice.Audio\Vortice.Audio.csproj" />
9+
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.20348-rc2.1411011823" Condition="'$(ExcludeD3D12)' != 'true'" />
10+
</ItemGroup>
11+
12+
</Project>

Diff for: src/Audio/Vortice.Audio.XAudio2/XAudio2Helpers.cs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright © Amer Koleci and Contributors.
2+
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
3+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
using Microsoft.Toolkit.Diagnostics;
7+
using TerraFX.Interop;
8+
using static TerraFX.Interop.Windows;
9+
10+
namespace Vortice.Audio
11+
{
12+
internal static unsafe class XAudio2Helpers
13+
{
14+
public static void ThrowIfFailed(HRESULT hr)
15+
{
16+
if (hr.FAILED)
17+
{
18+
ThrowHelper.ThrowWin32Exception(hr);
19+
}
20+
}
21+
}
22+
}

Diff for: src/Audio/Vortice.Audio.XAudio2/XAudio2System.cs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright © Amer Koleci and Contributors.
2+
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
3+
4+
using System;
5+
using Microsoft.Toolkit.Diagnostics;
6+
using TerraFX.Interop;
7+
using static TerraFX.Interop.Windows;
8+
using static Vortice.Audio.XAudio2Helpers;
9+
10+
namespace Vortice.Audio
11+
{
12+
public sealed unsafe class XAudio2System : AudioSystem
13+
{
14+
private readonly ComPtr<IXAudio2> _xaudio2;
15+
16+
public XAudio2System()
17+
{
18+
ThrowIfFailed(XAudio2Create(_xaudio2.GetAddressOf()));
19+
}
20+
}
21+
}

Diff for: src/Audio/Vortice.Audio/AudioSystem.cs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright © Amer Koleci and Contributors.
2+
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
3+
4+
using System;
5+
using Microsoft.Toolkit.Diagnostics;
6+
7+
namespace Vortice.Audio
8+
{
9+
public abstract class AudioSystem //: GameSystem
10+
{
11+
protected AudioSystem()
12+
{
13+
}
14+
}
15+
}

Diff for: src/Audio/Vortice.Audio/Vortice.Audio.csproj

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="..\..\Vortice\Vortice.csproj" />
9+
</ItemGroup>
10+
11+
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: src/Vortice.Graphics/Vortice.Graphics.csproj renamed to src/Graphics/Vortice.Graphics/Vortice.Graphics.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
5-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
65
<ExcludeVulkan>true</ExcludeVulkan>
76
<DefineConstants Condition="'$(ExcludeD3D12)' == 'true'">$(DefineConstants);EXCLUDE_D3D12_BACKEND</DefineConstants>
87
<DefineConstants Condition="'$(ExcludeVulkan)' == 'true'">$(DefineConstants);EXCLUDE_VULKAN_BACKEND</DefineConstants>

Diff for: src/Vortice.Games/Game.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Generic;
66
using System.Diagnostics;
77
using Microsoft.Extensions.DependencyInjection;
8+
using Vortice.Audio;
89
using Vortice.Graphics;
910
using Vortice.Input;
1011

@@ -36,9 +37,11 @@ protected Game(GameContext context)
3637
View = _serviceProvider.GetRequiredService<GameView>();
3738
Input = _serviceProvider.GetRequiredService<InputManager>();
3839

40+
// Get optional services.
41+
Audio = _serviceProvider.GetService<AudioSystem>();
42+
3943
// Create GraphicsDeviceFactory
4044
ValidationMode validationMode = ValidationMode.Disabled;
41-
4245
#if DEBUG
4346
validationMode = ValidationMode.Enabled;
4447
#endif
@@ -69,6 +72,7 @@ protected Game(GameContext context)
6972
public GameView View { get; }
7073

7174
public InputManager Input { get; }
75+
public AudioSystem? Audio { get; }
7276

7377
public GraphicsDeviceFactory GraphicsDeviceFactory { get; }
7478

Diff for: src/Vortice.Games/Vortice.Games.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0</TargetFrameworks>
@@ -16,9 +16,10 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<ProjectReference Include="..\Vortice.Graphics\Vortice.Graphics.csproj" />
20-
<ProjectReference Include="..\Vortice.Input\Vortice.Input.csproj" />
2119
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0-rc.2.21480.5" />
20+
<ProjectReference Include="..\Audio\Vortice.Audio\Vortice.Audio.csproj" />
21+
<ProjectReference Include="..\Graphics\Vortice.Graphics\Vortice.Graphics.csproj" />
22+
<ProjectReference Include="..\Vortice.Input\Vortice.Input.csproj" />
2223
</ItemGroup>
2324

2425
<Import Project="..\targets\Vortice.MultiTargeting.targets" />

Diff for: src/Vortice/Vortice.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0</TargetFrameworks>
5-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
4+
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
65
</PropertyGroup>
76

87
<ItemGroup>

0 commit comments

Comments
 (0)