예제 #1
0
        public MyAudio(float soundEffectVolume)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo("music");
            int           length        = 0;

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                if (file.Name.Split('.')[1] == "ogg")
                {
                    ++length;
                    this.musicNames.Add(file.Name);
                }
            }
            this.musiclength = new int[2, length];
            try
            {
                this.waveOut           = new WaveOut(-1, 44100, 16, 2);
                this.xaDevice          = new SlimDX.XAudio2.XAudio2();
                this.xaMaster          = new MasteringVoice(this.xaDevice);
                this.SoundEffectVolume = soundEffectVolume;
            }
            catch
            {
                this.disabled = true;
            }
            this.thread_1 = new Thread(new ThreadStart(this.Init));
            this.thread_1.Start();

            this.pianoNotePlayer = new PianoNotePlayer();
        }
예제 #2
0
        public OpenALAudio(float soundEffectVolume, string tcdFile, string password, string graphicsFormat)
        {
            this.audio = AudioEngine.Instance;
            this.audio.SetVolume(0.5f, OpenALAudio.BGMVolumeGroup);
            this.audio.SetVolume(soundEffectVolume, OpenALAudio.SEVolumeGroup);

            this.pianoNotePlayer = new PianoNotePlayer();

            var loopPointContents = File.ReadAllText(FilePath, Encoding.GetEncoding("Shift_JIS"));

            //TODO:
            this.bgmListAlternate = new List <OggData>();

            this.bgmList = loopPointContents.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
                           .Where(res => res != string.Empty)
                           .Select(res => ReadOggData(res)).ToList();

            this.loadStrategy = new TCDLoadStrategy(tcdFile, password, graphicsFormat);

            var loadThread = new Thread(new ThreadStart(this.Init));

            loadThread.Start();
        }