コード例 #1
0
        internal SoundEffect(string fileName)
        {
            _filename = fileName;

            if (_filename == string.Empty)
            {
                throw new FileNotFoundException("Supported Sound Effect formats are wav, mp3, acc, aiff");
            }

            int      size;
            ALFormat format;
            double   rate;
            double   duration;

            _data = OpenALSupport.LoadFromFile(_filename,
                                               out size, out format, out rate, out duration);

            _name = Path.GetFileNameWithoutExtension(fileName);

            Rate      = (float)rate;
            Size      = size;
            Format    = format;
            _duration = TimeSpan.FromSeconds(duration);
            //Console.WriteLine ("From File: " + _name + " - " + Format + " = " + Rate + " / " + Size + " -- "  + Duration);
        }
コード例 #2
0
ファイル: OpenALSupport.cs プロジェクト: SongArc/MonoGame
 public static byte[] LoadFromFile(string filename, out int dataBufferSize, out ALFormat alFormat, out double sampleRate, out double duration)
 {
     return(OpenALSupport.GetOpenALAudioDataAll(NSUrl.FromFilename(filename),
                                                out dataBufferSize, out alFormat, out sampleRate, out duration));
 }