forked from OpenRA/OpenRA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDummySoundEngine.cs
75 lines (62 loc) · 1.9 KB
/
DummySoundEngine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.IO;
namespace OpenRA.Platforms.Default
{
sealed class DummySoundEngine : ISoundEngine
{
public bool Dummy { get { return true; } }
public SoundDevice[] AvailableDevices()
{
var defaultDevices = new[]
{
new SoundDevice(null, "No Sound Output"),
};
return defaultDevices;
}
public DummySoundEngine(string deviceName) { }
public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate)
{
return new NullSoundSource();
}
public ISound Play2D(ISoundSource soundSource, bool loop, bool relative, WPos pos, float volume, bool attenuateVolume)
{
return new NullSound();
}
public ISound Play2DStream(Stream stream, int channels, int sampleBits, int sampleRate, bool loop, bool relative, WPos pos, float volume)
{
return null;
}
public float Volume
{
get { return 0; }
set { }
}
public void PauseSound(ISound sound, bool paused) { }
public void SetAllSoundsPaused(bool paused) { }
public void SetSoundVolume(float volume, ISound music, ISound video) { }
public void StopSound(ISound sound) { }
public void StopAllSounds() { }
public void SetListenerPosition(WPos position) { }
public void Dispose() { }
}
class NullSoundSource : ISoundSource
{
public void Dispose() { }
}
class NullSound : ISound
{
public float Volume { get; set; }
public float SeekPosition { get { return 0; } }
public bool Complete { get { return false; } }
public void SetPosition(WPos position) { }
}
}