File: Sound.cs

package info (click to toggle)
opentk 1.0.20101006%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 38,896 kB
  • ctags: 68,704
  • sloc: cs: 424,330; xml: 96,546; ansic: 3,597; makefile: 24
file content (87 lines) | stat: -rw-r--r-- 2,269 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
#region --- License ---
/* Licensed under the MIT/X11 license.
 * Copyright (c) 2006-2008 the OpenTK Team.
 * This notice may not be removed from any source distribution.
 * See license.txt for licensing details.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace OpenTK.Audio
{
#if false
    /// <summary>Defines methods to load and hold sound buffer.</summary>
    public class Sound<SampleType> : IDisposable
    {
        bool disposed;
        SoundReader<SampleType> reader;
        SoundData<SampleType> data;

        public Sound(Stream s)
        {
            if (s == null) throw new ArgumentNullException("s", "Must be a valid System.IO.Stream.");

            reader = SoundReader.Create(s);
        }

        public Sound(string filename)
        {
            if (String.IsNullOrEmpty(filename)) throw new ArgumentNullException("s", "Must be a valid System.IO.Stream.");

            reader = SoundReader.Create(filename);
        }

        #region --- Public Members ---

        public SoundData ReadSamples(int count)
        {
            if (count <= 0) throw new ArgumentOutOfRangeException("count", "Must be larger than zero.");
            throw new NotImplementedException();
        }

        public SoundData ReadToEnd()
        {
            return reader.ReadToEnd();
        }

        public SoundData SoundData { get { return data; } }

        public void WriteToBuffer(int buffer, int length)
        {
            if (buffer == 0) throw new ArgumentOutOfRangeException("buffer", "May not be zero.");
        }

        #endregion

        #region --- IDisposable Members ---

        /// <summary>Disposes of the sound buffer.</summary>
        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool manual)
        {
            if (!disposed)
            {
                if (manual)
                    reader.Dispose();
                disposed = true;
            }
        }

        ~Sound()
        {
            this.Dispose(false);
        }

        #endregion
    }
#endif
}