Skip to content

Commit

Permalink
Upgraded to Visual Studio 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
Memorix101 committed May 8, 2019
1 parent c84d25a commit 93ade32
Show file tree
Hide file tree
Showing 4,698 changed files with 921,730 additions and 18 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

\.vs/
16 changes: 16 additions & 0 deletions BuildReleasePackage.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rmdir /S /Q ReleasePackage
mkdir ReleasePackage
xcopy /S OpenC1\bin\x86\Release\* ReleasePackage
copy Engine\Lib\Microsoft.DirectX.* ReleasePackage
cd ReleasePackage
mkdir tmp
c:\progra~2\Microsoft\ilmerge\ilmerge.exe /out:tmp\OpenC1.exe OpenC1.exe 1amstudiosEngine.dll Ionic.Zip.Reduced.dll
del OpenC1.*
del 1amstudiosEngine.*
del Ionic.Zip.Reduced.dll
copy tmp\* .
rmdir /S /Q tmp
rmdir /S /Q Lib
copy ..\license.txt .
copy ..\readme.txt .
pause
19 changes: 19 additions & 0 deletions Engine_XNA3/Audio/IListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace OneAmEngine.Audio
{
public interface IListener
{
void SetOrientation(Vector3 forward);
Matrix Orientation { set; }
Vector3 Position { get; set; }
Vector3 Velocity { set; }
float DistanceFactor { set; }
float RolloffFactor { set; }
void BeginUpdate();
void CommitChanges();
}
}
28 changes: 28 additions & 0 deletions Engine_XNA3/Audio/ISound.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace OneAmEngine.Audio
{

public interface ISound
{
int Id { get; set; }
object Owner { get; set; }
float Duration { get; }
float Volume { get; set; }
void Pause();
void Stop();
void Reset();
void Play(bool loop);
Vector3 Position { get; set; }
Vector3 Velocity { set; }
int Frequency { set; }
bool IsPlaying { get; }
float MinimumDistance { get; set; }
float MaximumDistance { get; set; }
bool MuteAtMaximumDistance { get; set; }
// bool
}
}
18 changes: 18 additions & 0 deletions Engine_XNA3/Audio/ISoundEngine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace OneAmEngine.Audio
{
public interface ISoundEngine
{
void SetDefaultVolume(int volume);
IListener GetListener();
ISound Load(string name, bool is3d);
//void Play(ISound sound, float duration);
void Register3dSound(ISound sound);
void Unregister3dSound(ISound sound);
void Update();
void StopAll();
}
}
76 changes: 76 additions & 0 deletions Engine_XNA3/Audio/Mdx/MdxListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.DirectSound;
using Microsoft.Xna.Framework;

namespace OneAmEngine.Audio
{
class MdxListener : IListener
{
Listener3D _listener;

public MdxListener(Device device)
{
BufferDescription desc = new BufferDescription();
desc.PrimaryBuffer = true;
desc.Control3D = true;
desc.Mute3DAtMaximumDistance = true;

Microsoft.DirectX.DirectSound.Buffer buffer = new Microsoft.DirectX.DirectSound.Buffer(desc, device);
_listener = new Listener3D(buffer);

Orientation = Matrix.Identity;
}

public Matrix Orientation
{
set
{
Listener3DOrientation orientation = _listener.Orientation;
orientation.Front = MdxHelpers.ToMdx(Vector3.Normalize(value.Forward));
orientation.Top = MdxHelpers.ToMdx(Vector3.Normalize(value.Up));
_listener.Orientation = orientation;
}
}

public void SetOrientation(Vector3 forward)
{
Listener3DOrientation orientation = _listener.Orientation;
orientation.Front = MdxHelpers.ToMdx(forward);
orientation.Top = MdxHelpers.ToMdx(Vector3.Up);
_listener.Orientation = orientation;
}

public Vector3 Position
{
get { return MdxHelpers.ToXna(_listener.Position); }
set { _listener.Position = MdxHelpers.ToMdx(value); }
}

public Vector3 Velocity
{
set { _listener.Velocity = MdxHelpers.ToMdx(value); }
}

public float DistanceFactor
{
set { _listener.DistanceFactor = value; }
}

public float RolloffFactor
{
set { _listener.RolloffFactor = value; }
}

public void BeginUpdate()
{
_listener.Deferred = true;
}

public void CommitChanges()
{
_listener.CommitDeferredSettings();
}
}
}
145 changes: 145 additions & 0 deletions Engine_XNA3/Audio/Mdx/MdxSound.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.DirectSound;
using Microsoft.Xna.Framework;

namespace OneAmEngine.Audio
{
class MdxSound : ISound
{
SecondaryBuffer _buffer;
Buffer3D _buffer3d;
bool _is3d;

public int Id { get; set; }
public object Owner { get; set; }
public bool MuteAtMaximumDistance { get; set; }

internal MdxSound(Device device, string filename, bool is3d)
{
BufferDescription desc = new BufferDescription();

if (is3d)
{
desc.Control3D = true;
desc.Guid3DAlgorithm = DSoundHelper.Guid3DAlgorithmDefault;
desc.Mute3DAtMaximumDistance = true;
}
desc.ControlVolume = true;
desc.ControlFrequency = true;
_buffer = new SecondaryBuffer(filename, desc, device);

if (is3d)
{
_buffer3d = new Buffer3D(_buffer);
_buffer3d.Mode = Mode3D.Normal;
_is3d = true;
}
}

public float Volume
{
get { return _buffer.Volume; }
set { _buffer.Volume = (int)value; }
}

public float Duration
{
get
{
return (float)_buffer.Caps.BufferBytes / (float)_buffer.Format.SamplesPerSecond;
}
}

public Vector3 Position
{
get
{
if (_buffer3d == null) return Vector3.Zero;
return MdxHelpers.ToXna(_buffer3d.Position);
}
set
{
if (_buffer3d == null) return;
_buffer3d.Position = MdxHelpers.ToMdx(value);
}
}

public Vector3 Velocity
{
set
{
if (_buffer3d == null) return;
_buffer3d.Velocity = MdxHelpers.ToMdx(value);
}
}

public int Frequency
{
set { _buffer.Frequency = value; }
}

public void Play(bool loop)
{
_buffer.Play(0, loop ? BufferPlayFlags.Looping : BufferPlayFlags.Default);
if (_is3d && loop && MuteAtMaximumDistance)
{
Engine.Audio.Register3dSound(this);
}
}

public void Stop()
{
_buffer.Stop();
_buffer.SetCurrentPosition(0);
Engine.Audio.Unregister3dSound(this);
}

public void Pause()
{
_buffer.Stop();
}

public void Reset()
{
_buffer.SetCurrentPosition(0);
}

public bool IsPlaying
{
get
{
return _buffer.Status.Playing;
}
}

public float MaximumDistance
{
get
{
if (_buffer3d == null) return 0;
return _buffer3d.MaxDistance;
}
set
{
if (_buffer3d == null) return;
_buffer3d.MaxDistance = value;
}
}

public float MinimumDistance
{
get
{
if (_buffer3d == null) return 0;
return _buffer3d.MinDistance;
}
set
{
if (_buffer3d == null) return;
_buffer3d.MinDistance = value;
}
}
}
}
Loading

0 comments on commit 93ade32

Please sign in to comment.