public SampleControl(Sample sample, SoundEffect soundEffect)
 {
     this.InitializeComponent();
     Sample = sample;
     SoundEffect = soundEffect;
     SampleNameText.Text = Sample.Name;
     SampleWeightSlider.Value = Sample.Weight;
     SampleVolumeSlider.Value = Sample.Volume;
 }
 private void AddSceneButton_Click(object sender, RoutedEventArgs e)
 {
     Scene scene = new Scene();
     Module.Scenes.Add(scene);
     AddSceenControl(scene);
     SoundEffect soundEffect = new SoundEffect();
     scene.SoundEffects.Add(soundEffect);
     Sample sample = new Sample();
     soundEffect.Samples.Add(sample);
     Module.ReverbTime = 0;
     Module.ReverbMix = 0;
 }
 private void AddSampleButton_Click(object sender, RoutedEventArgs e)
 {
     Sample sample = new Sample();
     SoundEffect.Samples.Add(sample);
     CreateSampleControl(SoundEffect, sample);
 }
 private void LoadSoundEffect()
 {
     SoundEffectNameText.Text = SoundEffect.Name;
     MuteCheckBox.IsChecked = SoundEffect.Mute;
     VolumeSlider.Value = SoundEffect.SoundEffectVolume;
     PreDelayCheckBox.IsChecked = SoundEffect.PreDelay;
     LoopCheckBox.IsChecked = SoundEffect.IsLooping;
     SliderHigh.Value = SoundEffect.LoopGap + SoundEffect.LoopGapVariance;
     SliderLow.Value = SoundEffect.LoopGap;
     SequentialCheckBox.IsChecked = SoundEffect.IsPlayList;
     ChangeLoopText();
     foreach (Sample sample in SoundEffect.Samples)
     {
         CreateSampleControl(SoundEffect, sample);
     }
     if (SoundEffect.Samples.Count == 0)
     {
         Sample sample = new Sample();
         SoundEffect.Samples.Add(sample);
         CreateSampleControl(SoundEffect, sample);
     }
 }
 private void CreateSampleControl(SoundEffect soundEffect, Sample sample)
 {
     SampleControl sampleControl = new SampleControl(sample, soundEffect);
     SamplesStackPanel.Children.Add(sampleControl);
     sampleControl.Removed += new EventHandler(sampleControl_Removed);
     sampleControl.LoadingSample += new EventHandler(sampleControl_LoadingSample);
 }
Пример #6
0
 public void RemoveSample(Sample sample)
 {
     BassMix.BASS_Mixer_ChannelRemove(sample.Channel);
     Bass.BASS_StreamFree(sample.Channel);
     Samples.Remove(sample);
 }
Пример #7
0
        public void LoadSample(Sample sample)
        {
            if (sample.FileName == null) return;
            if (sample.FileName.EndsWith(".wma"))
            {
                sample.Channel = BassWma.BASS_WMA_StreamCreateFile(sample.FileName, 0L, 0L,
                    BASSFlag.BASS_STREAM_DECODE |
                    BASSFlag.BASS_SAMPLE_FLOAT);
            }
            else
            {
                sample.Channel = Bass.BASS_StreamCreateFile(sample.FileName, 0L, 0L,
                    BASSFlag.BASS_STREAM_DECODE |
                    BASSFlag.BASS_SAMPLE_FLOAT);
            }

            BassMix.BASS_Mixer_StreamAddChannel(SoundEffectMixerChannel, sample.Channel,
                BASSFlag.BASS_MIXER_PAUSE);
            Bass.BASS_ChannelSetSync(sample.Channel, BASSSync.BASS_SYNC_END, 0, endSync, IntPtr.Zero);

            //sample.Weight = 1;

            if (CurrentSample == null)
            {
                CurrentSample = sample;
            }
            SetLoop();
        }