示例#1
0
 public SoundClip(string path, SoundFormat format, byte[] data)
 {
     buffer      = AL.GenBuffer();
     this.data   = data;
     this.path   = path;
     this.format = format;
 }
示例#2
0
        private static ALFormat GetSoundFormat(SoundFormat clipFormat)
        {
            switch (clipFormat.channels)
            {
            case 1:
                switch (clipFormat.bitDepth)
                {
                case 8:
                    return(ALFormat.Mono8);

                case 16:
                    return(ALFormat.Mono16);
                }
                break;

            case 2:
                switch (clipFormat.sampleRate)
                {
                case 8:
                    return(ALFormat.Stereo8);

                case 16:
                    return(ALFormat.Stereo16);
                }
                break;

            default:
                throw new NotSupportedException("The specified sound format is not supported.");
            }

            return(ALFormat.Mono8);
        }