コード例 #1
0
 public SampleControl(Sample sample, SoundEffect soundEffect)
 {
     this.InitializeComponent();
     Sample = sample;
     SoundEffect = soundEffect;
     SampleNameText.Text = Sample.Name;
     SampleWeightSlider.Value = Sample.Weight;
     SampleVolumeSlider.Value = Sample.Volume;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 private void AddSampleButton_Click(object sender, RoutedEventArgs e)
 {
     Sample sample = new Sample();
     SoundEffect.Samples.Add(sample);
     CreateSampleControl(SoundEffect, sample);
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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();
        }