public MainWindow() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); soundManager = new SoundManager(new AudioDevice(), ManagerGlue.FMOD, 1, 40) { ContentPath = "Data/Sound/" }; soundManager.LoadSounds(true); timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = 1000 / 60; Vector3 middle = new Vector3(Size.Width / 2f, Size.Height / 2f, 0); position = middle; floatingPoint = middle; InsertUnit(middle, soundManager.GetSFX(SFX.DogBite1)); //IPlayable ipSound = soundManager.GetSoundResourceGroup(soundManager.GetSFX(SFX.DogBite1), soundManager.GetSFX(SFX.HitBySword1)); //intervalChannel = ipSound.PlayLoopedWithIntervals(0.1f, 5f, 2f, GetFloatingPoint, () => { return Vector3.Zero; }); //movingUnitBasePosition = middle; //movingUnit = new Unit { Position = movingUnitBasePosition, Sound = soundManager.GetSFX(SFX.HumanDeath1) }; ////var channel = movingUnit.Sound.Play(() => { return movingUnit.Position; }, () => { return Vector3.Zero; }); //movingUnitChannel = movingUnit.Sound.Play(); //movingUnitChannel.Looping = true; //var u1 = InsertUnit(middle + new Vector3(30, 0, 0), soundManager.GetSFX(SFX.DogBite1)); //var u2 = InsertUnit(middle - new Vector3(30, 0, 0), soundManager.GetSFX(SFX.PiranhaAttack1)); //panChannel1 = (SoundChannel)u1.Sound.Play(u1.Position, Vector3.Zero); //panChannel1.Looping = true; //panChannel2 = (SoundChannel)u2.Sound.Play(u2.Position, Vector3.Zero); //panChannel2.Looping = true; //InsertUnit(middle + new Vector3(30, 30, 0), soundManager.GetSFX(SFX.DogBite1)); //InsertUnit(middle - new Vector3(30, -30, 0), soundManager.GetSFX(SFX.PiranhaAttack1)); //InsertUnit(middle - new Vector3(30, 30, 0), soundManager.GetSFX(SFX.Charge1)); //InsertUnit(middle + new Vector3(30, 30, 0), soundManager.GetSoundResourceGroup(soundManager.GetSFX(SFX.FireBreath1), soundManager.GetSFX(SFX.RottenTreeHitBySword1))); //InsertUnit(middle - new Vector3(30, 30, 0), soundManager.GetSFX(SFX.RifleFire1)); //InsertUnit(middle - new Vector3(30, -30, 0), soundManager.GetSFX(SFX.HumanDeath1)); //InsertUnit(middle + new Vector3(30, 30, 0), new SoundInstanceGroup(soundEffects[Sounds.SFX.HitsFlesh1], soundEffects[Sounds.SFX.SwordHitWood1])); //InsertUnit(middle - new Vector3(30, 30, 0), soundEffects[Sounds.SFX.SwordRing3]); //InsertUnit(middle - new Vector3(30, -30, 0), soundEffects[Sounds.SFX.MonsterSqueal1]); //volumeTestChannel = SoundManager.Instance.GetStream(Stream.InGameMusic4).Play(); //volumeTestResource = volumeTestChannel.CurrentSoundResource; //volumeTestSoundGroup = SoundManager.Instance.GetSoundGroup(SoundGroups.Music); //volumeTestChannelVolume = volumeTestChannel.Volume; //volumeTestResourceVolume = volumeTestResource.Volume; //volumeTestSoundGroupVolume = volumeTestSoundGroup.Volume; //volumeTestChannel = SoundManager.Instance.GetSoundResourceGroup(SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic1), // SoundManager.Instance.GetStream(Graphics.Sound.Stream.MainMenuMusic1)).PlayLoopedWithIntervals(0.5f, 0.5f, 0.2f); //volumeTestChannel = SoundManager.Instance.GetSoundResourceGroup(SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic2), // SoundManager.Instance.GetStream(Graphics.Sound.Stream.InGameMusic3)).Play(); //volumeTestChannel = SoundManager.Instance.GetStream(Stream.InGameMusic3).PlayLoopedWithIntervals(0.5f, 0.5f, 0.2f); //volumeTestResource = volumeTestChannel.CurrentSoundResource; //volumeTestChannelVolume = volumeTestChannel.Volume; //uint bufferLength = 0; //int numBuffers = 0; //((SoundManager)soundManager).FMODSystem.getDSPBufferSize(ref bufferLength, ref numBuffers); //var asdf = (SoundResource)soundManager.GetStream(Stream.TestSong); //float frequency = 0, dummy = 0; //int dummyI = 0; //asdf.Sound.getDefaults(ref frequency, ref dummy, ref dummy, ref dummyI); timer.Enabled = true; }
public TestState() { soundManager = new SoundManager(new AudioDevice(), ManagerGlue.JMOD, 5, 200) { ContentPath = "Data/Sound/" }; soundManager.LoadSounds(true); }