private void mButtonNext_Click(object sender, EventArgs e) { try { VolumeSource source = CreateSource(); BaseArchive archive = CreateArchive(); string vidFilename = mObject.StoragePath + PWLib.Platform.Windows.Path.DirectorySeparatorChar + mObject.Name + ".vol"; VolumeDescriptor vdesc = VolumeDescriptorList.Instance.AddNewDescriptor(mObject.Name, vidFilename, source, archive); if (mObject.RevisionsToKeep > 0) { vdesc.RevisionsToKeep = mObject.RevisionsToKeep; } else { vdesc.TimePeriodToMonitor = mObject.TimePeriodToKeep; } if (mStartBackupNow.Checked) { Log.WriteLine(LogType.TextLogVerbose, "Backing up volume by adding it through GUI"); MainForm.Instance.BackupVolume(vdesc); } } catch (System.Exception ex) { Log.WriteException("Add new volume failed", ex); } MainForm.Instance.ControlSwitcher.SwitchUserControl(FormControlType.Welcome, FormControlSwitchType.Finish); }
/// <summary> /// Initializes WasapiOut instance and prepares all resources for playback. /// Note that properties like <see cref="Device" />, <see cref="Latency" />,... won't affect WasapiOut after calling /// <see cref="Initialize" />. /// </summary> /// <param name="source">The source to prepare for playback.</param> public void Initialize(IWaveSource source) { CheckForInvalidThreadCall(); lock (_lockObj) { CheckForDisposed(); if (source == null) { throw new ArgumentNullException("source"); } if (PlaybackState != PlaybackState.Stopped) { throw new InvalidOperationException( "PlaybackState has to be Stopped. Call WasapiOut::Stop to stop the playback."); } _playbackThread.WaitForExit(); source = new InterruptDisposingChainSource(source); _volumeSource = new VolumeSource(source.ToSampleSource()); _source = _volumeSource.ToWaveSource(); CleanupResources(); InitializeInternal(); _isInitialized = true; } }
public AudioTrack(string name, ISampleSource sample, VolumeSource volume) { this.name = name; this.sampleSource = sample; this.volumeSource = volume; //this.shifter = shifter; }
void UpdateVolumeItem(Transform root, VolumeSource vs) { Slider slider = root.GetComponentInChildren <Slider>(); slider.value = Settings.GetVolume(vs); slider.onValueChanged.RemoveAllListeners(); slider.onValueChanged.AddListener(delegate { Settings.SetVolume(vs, slider.value); }); }
public VolumeDescriptor AddNewDescriptor(string volName, string volFilename, VolumeSource source, BaseArchive archive) { VolumeDescriptor vd = new VolumeDescriptor(mEventController, volName, volFilename, source, archive); lock ( mDescriptorList ) { mDescriptorList.Add(vd); } Config.Active.Save(); return(vd); }
void UpdateOptionsMenu() { Transform l = _optionsPanel.transform.Find("list"); //setup audio for (int i = 0; i < System.Enum.GetNames(typeof(VolumeSource)).Length; i++) { VolumeSource v = (VolumeSource)i; UpdateVolumeItem(l.Find(v.ToString().ToLower()), v); } //setup graphics for (int i = 0; i < System.Enum.GetNames(typeof(GraphicSetting)).Length; i++) { GraphicSetting g = (GraphicSetting)i; UpdateSimpleGraphicItem(l.Find(g.ToString().ToLower()), g); } }
public IWaveSource MixAudioAndVoice(IWaveSource audio, out VolumeSource vol1, IWaveSource voice, out VolumeSource vol2) { mixer = new Mixer.SimpleMixer(2, mixerSampleRate) //output: stereo, 44,1kHz { FillWithZeros = true, DivideResult = false //you may play around with this }; mixer.AddSource(audio .ChangeSampleRate(mixerSampleRate) .ToStereo() .AppendSource(x => new VolumeSource(x.ToSampleSource()), out vol1)); mixer.AddSource(voice .ChangeSampleRate(mixerSampleRate) .ToStereo() .AppendSource(x => new VolumeSource(x.ToSampleSource()), out vol2)); return(mixer.ToWaveSource()); }
public void Open(string filename) { CleanupPlayback(); var source = CodecFactory.Instance.GetCodec(filename); volumeSource = new VolumeSource(source); equalizer = Equalizer.Create10BandEqualizer(volumeSource); finalSource = equalizer .ToStereo() .ChangeSampleRate(44100) .AppendSource(Equalizer.Create10BandEqualizer, out equalizer) .ToWaveSource(16); if (WasapiOut.IsSupportedOnCurrentPlatform) { soundOut = new WasapiOut() { Latency = 100, Device = PlaybackDevice } } ; else { soundOut = new DirectSoundOut(); } soundOut.Initialize(finalSource); soundOut.Volume = deviceVolume; if (this.OpenCompleted != null) { this.OpenCompleted(this, new EventArgs()); } }
public VolumeDescriptor(VolumeEventController eventController, string volName, string volFilename, VolumeSource source, BaseArchive archive) { mEventController = eventController; mName = volName; mVolumeFilename = volFilename; mVolume = new Volume(mEventController, this, source, archive); ConnectToVolumeEvents(mVolume); mIsAvailable = true; SaveVolumeData(); }
public static float GetVolume(VolumeSource v) { return(_volumes[(int)v]); }
public SourceMenu (ImportCommand command) { this.command = command; source_count = 0; SourceItem item = new SourceItem (new BrowseSource ()); item.Activated += HandleActivated; this.Append (item); this.Append (new Gtk.SeparatorMenuItem ()); // Add external hard drives to the menu foreach (Gnome.Vfs.Volume vol in monitor.MountedVolumes) { if (!vol.IsUserVisible || vol.DeviceType == Gnome.Vfs.DeviceType.Unknown) continue; System.Console.WriteLine ("{0} - {1} - {2} {3} {4} {5} {6}", vol.DisplayName, vol.Icon, vol.VolumeType.ToString (), vol.ActivationUri, vol.IsUserVisible, vol.IsMounted, vol.DeviceType); if (vol.Drive != null) System.Console.WriteLine (vol.Drive.DeviceType.ToString ()); ImportSource source = new VolumeSource (vol); item = new SourceItem (source); item.Activated += HandleActivated; this.Append (item); source_count++; } GPhotoCamera cam = new GPhotoCamera (); cam.DetectCameras (); int camera_count = cam.CameraList.Count (); if (camera_count > 0) { source_count += camera_count; for (int i = 0; i < camera_count; i++) { string handle = cam.CameraList.GetValue (i); if (camera_count == 1 || handle != "usb:") { if (handle.StartsWith ("disk:")) { string path = handle.Substring ("disk:".Length); if (FindItemPosition (path) != -1) continue; } ImportSource source = new CameraSource (cam, i); item = new SourceItem (source); item.Activated += HandleActivated; this.Append (item); } } } else { ImportSource source = new BrowseSource (Catalog.GetString ("(No Cameras Detected)"), "emblem-camera"); item = new SourceItem (source); item.Activated += HandleActivated; item.Sensitive = false; this.Append (item); } /* this.Append (new Gtk.SeparatorMenuItem ()); foreach (Gnome.Vfs.Drive drive in monitor.ConnectedDrives) { ImportSource source = new DriveSource (drive); Gtk.ImageMenuItem item = new SourceItem (source); item.Sensitive = drive.IsMounted; this.Append (item); } */ this.ShowAll (); }
public static void SetVolume(VolumeSource v, float f) { _volumes[(int)v] = f; OnVolumeChanged?.Invoke(v, f); }
void Set(VolumeSource vs, float volume) { _master.SetFloat(vs.ToString(), (-40f * (1 - volume))); }
public SourceMenu(ImportCommand command) { this.command = command; source_count = 0; SourceItem item = new SourceItem(new BrowseSource()); item.Activated += HandleActivated; this.Append(item); this.Append(new Gtk.SeparatorMenuItem()); // Add external hard drives to the menu foreach (Gnome.Vfs.Volume vol in monitor.MountedVolumes) { if (!vol.IsUserVisible || vol.DeviceType == Gnome.Vfs.DeviceType.Unknown) { continue; } System.Console.WriteLine("{0} - {1} - {2} {3} {4} {5} {6}", vol.DisplayName, vol.Icon, vol.VolumeType.ToString(), vol.ActivationUri, vol.IsUserVisible, vol.IsMounted, vol.DeviceType); if (vol.Drive != null) { System.Console.WriteLine(vol.Drive.DeviceType.ToString()); } ImportSource source = new VolumeSource(vol); item = new SourceItem(source); item.Activated += HandleActivated; this.Append(item); source_count++; } GPhotoCamera cam = new GPhotoCamera(); cam.DetectCameras(); int camera_count = cam.CameraList.Count(); if (camera_count > 0) { source_count += camera_count; for (int i = 0; i < camera_count; i++) { string handle = cam.CameraList.GetValue(i); if (camera_count == 1 || handle != "usb:") { if (handle.StartsWith("disk:")) { string path = handle.Substring("disk:".Length); if (FindItemPosition(path) != -1) { continue; } } ImportSource source = new CameraSource(cam, i); item = new SourceItem(source); item.Activated += HandleActivated; this.Append(item); } } } else { ImportSource source = new BrowseSource(Catalog.GetString("(No Cameras Detected)"), "emblem-camera"); item = new SourceItem(source); item.Activated += HandleActivated; item.Sensitive = false; this.Append(item); } /* * this.Append (new Gtk.SeparatorMenuItem ()); * * foreach (Gnome.Vfs.Drive drive in monitor.ConnectedDrives) { * ImportSource source = new DriveSource (drive); * * Gtk.ImageMenuItem item = new SourceItem (source); * item.Sensitive = drive.IsMounted; * this.Append (item); * } */ this.ShowAll(); }
void Source_MediaAvailableChanged(VolumeSource source, bool isAvailable) { mEventController.InvokeVolumeSourceActiveStateChanged(this, isAvailable); }
public Volume(VolumeEventController eventController, VolumeDescriptor volumeDesc, VolumeSource source, BaseArchive archive) { mEventController = eventController; mVolumeDesc = volumeDesc; mBackupRestoreObject = new BackupRestoreVolume(mVolumeDesc.VolumeName, source, archive); Init(); }
private IWaveSource WrapVolumeSource(VolumeSource volumeSource) { //since we want to reuse the volumesource in the case of a streamswitch (see streamrouting) //we prevent the source chain from disposing our volume source. return(new InterruptDisposingChainSampleSource(volumeSource).ToWaveSource()); }