Exemple #1
0
 public Playback(string soundPath)
 {
     Z2Sound.SoundPath = soundPath;
     soundData         = new Z2Sound(File.OpenRead(soundPath + "\\Z2Sound.baa"));
     musicEngine       = new XAudio2();
     masteringVoice    = new MasteringVoice(musicEngine);
     timer             = new Timer();
     timer.Period      = 1;
     timer.Resolution  = 1;
     timer.Tick       += HandleTick;
     IsPlaying         = false;
 }
Exemple #2
0
            public Track(XAudio2 xAudio2, Z2Sound baa, Dictionary <Tuple <byte, byte>, Instrument> instrumentTable, Dictionary <int, Sample> sampleTable)
            {
                engine               = xAudio2;
                soundData            = baa;
                this.instrumentTable = instrumentTable;
                this.sampleTable     = sampleTable;
                voiceTable           = new Dictionary <byte, NoteData>();
                submix               = new SubmixVoice(engine);
                Echo             effect           = new Echo();
                EffectDescriptor effectDescriptor = new EffectDescriptor(effect)
                {
                    InitialState       = true,
                    OutputChannelCount = 2
                };

                submix.SetEffectChain(effectDescriptor);
                EchoParameters effectParameter = new EchoParameters
                {
                    Delay     = 160f,
                    Feedback  = 0f,
                    WetDryMix = 0f
                };

                submix.SetEffectParameters(0, effectParameter);
                submix.EnableEffect(0);
                outputMatrix    = new float[2];
                Volume          = 127;
                Pitch           = 0;
                Pan             = 63;
                panChanged      = false;
                Bank            = 0;
                Echo            = 0;
                echoChanged     = false;
                Instrument      = 0;
                outputMatrix[0] = (outputMatrix[1] = 0.5f);
            }