public AudioDialog(EventSequence sequence, bool autoSize, int deviceIndex) { InitializeComponent(); Icon = common.Resources.VixenPlus; _fmod = (deviceIndex > 0) ? fmod.GetInstance(deviceIndex) : fmod.GetInstance(-1); _timer = new Timer(10.0); _timer.Elapsed += TimerElapsed; _eventSequence = sequence; _keyStates = new bool[_eventSequence.FullChannelCount]; _stopwatch = new Stopwatch(); _newEventValues = new byte[_eventSequence.Rows,_eventSequence.Cols]; listBoxChannels.Items.AddRange(_eventSequence.FullChannels.ToArray()); _originalAudio = sequence.Audio; if (sequence.Audio != null) { if (LoadAudio(_eventSequence.Audio.FileName) == null) { sequence.Audio = null; buttonRemoveAudio.Enabled = false; ClearAudio(); } else { buttonRemoveAudio.Enabled = true; } } else { buttonRemoveAudio.Enabled = false; ClearAudio(); } checkBoxAutoSize.Checked = autoSize; if (!autoSize) { UpdateRecordableLength(); } var items = (_eventSequence.FullChannels.ToArray()); channel1ToolStripMenuItem.Items.AddRange(items); channel2ToolStripMenuItem.Items.AddRange(items); channel3ToolStripMenuItem.Items.AddRange(items); channel4ToolStripMenuItem.Items.AddRange(items); channel5ToolStripMenuItem.Items.AddRange(items); channel6ToolStripMenuItem.Items.AddRange(items); channel7ToolStripMenuItem.Items.AddRange(items); channel8ToolStripMenuItem.Items.AddRange(items); channel9ToolStripMenuItem.Items.AddRange(items); channel0ToolStripMenuItem.Items.AddRange(items); channel1ToolStripMenuItem.SelectedIndex = Math.Min(0, _eventSequence.FullChannelCount - 1); channel2ToolStripMenuItem.SelectedIndex = Math.Min(1, _eventSequence.FullChannelCount - 1); channel3ToolStripMenuItem.SelectedIndex = Math.Min(2, _eventSequence.FullChannelCount - 1); channel4ToolStripMenuItem.SelectedIndex = Math.Min(3, _eventSequence.FullChannelCount - 1); channel5ToolStripMenuItem.SelectedIndex = Math.Min(4, _eventSequence.FullChannelCount - 1); channel6ToolStripMenuItem.SelectedIndex = Math.Min(5, _eventSequence.FullChannelCount - 1); channel7ToolStripMenuItem.SelectedIndex = Math.Min(6, _eventSequence.FullChannelCount - 1); channel8ToolStripMenuItem.SelectedIndex = Math.Min(7, _eventSequence.FullChannelCount - 1); channel9ToolStripMenuItem.SelectedIndex = Math.Min(8, _eventSequence.FullChannelCount - 1); channel0ToolStripMenuItem.SelectedIndex = Math.Min(9, _eventSequence.FullChannelCount - 1); comboBoxAudioDevice.Items.Add(Resources.UseApplicationDefaultAudio); comboBoxAudioDevice.Items.AddRange(fmod.GetSoundDeviceList()); comboBoxAudioDevice.SelectedIndex = _eventSequence.AudioDeviceIndex + 1; }
public FmodInstance(string fileName=null) { lock (lockObject) { _audioSystem = fmod.GetInstance(fileName==null?-1:Vixen.Sys.State.Variables.SelectedAudioDeviceIndex); if (_audioSystem == null || _audioSystem.SystemObject==null) return; _audioSystem.SystemObject.createDSPByType(FMOD.DSP_TYPE.LOWPASS, ref dsplowpass); _audioSystem.SystemObject.createDSPByType(FMOD.DSP_TYPE.HIGHPASS, ref dsphighpass); } //Load(fileName); //Changed from the above to allow sampling of the data. Could not extract data for waveform from the default //Is there another way to get the data with the default wrapper method. if (!string.IsNullOrWhiteSpace(fileName)) { LoadAsSample(fileName); populateStats(); } fmodUpdateTimer = new Timer(); fmodUpdateTimer.Elapsed += fmodUpdateTimer_Elapsed; fmodUpdateTimer.Interval = 100; fmodUpdateTimer.Enabled = true; }
public void Dispose() { if (_audioSystem != null) { fmodUpdateTimer.Stop(); fmodUpdateTimer.Elapsed -= fmodUpdateTimer_Elapsed; //*** channel need to be disposed? If so, then should reloading the channel // cause an intermediate disposal? _audioSystem.Stop(_channel); if (_channel != null) { _audioSystem.ReleaseSound(_channel); } _audioSystem.Shutdown(); _audioSystem = null; } GC.SuppressFinalize(this); }
public void Dispose() { //*** channel need to be disposed? If so, then should reloading the channel // cause an intermediate disposal? _audioSystem.Stop(_channel); if (_channel != null) { _audioSystem.ReleaseSound(_channel); } _audioSystem.Shutdown(); _audioSystem = null; GC.SuppressFinalize(this); }
public FmodInstance(string fileName) { _audioSystem = fmod.GetInstance(-1); //Load(fileName); //Changed from the above to allow sampling of the data. Could not extract data for waveform from the default //Is there another way to get the data with the default wrapper method. LoadAsSample(fileName); populateStats(); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_audioSystem != null) { if (fmodUpdateTimer != null) { fmodUpdateTimer.Stop(); fmodUpdateTimer.Elapsed -= fmodUpdateTimer_Elapsed; fmodUpdateTimer.Dispose(); } //*** channel need to be disposed? If so, then should reloading the channel // cause an intermediate disposal? _audioSystem.Stop(_channel); if (_channel != null) { _audioSystem.ReleaseSound(_channel); } _audioSystem.Shutdown(); _audioSystem = null; } } }
private void ConstructUsing(EngineMode mode, Host host, int audioDeviceIndex) { Mode = mode; _host = host; _plugInRouter = Host.Router; if (mode == EngineMode.Synchronous) { _eventTimer = new Timer(1.0); _eventTimer.Elapsed += EventTimerElapsed; _fmod = fmod.GetInstance(audioDeviceIndex); } else { _eventTimer = null; _fmod = null; } _engineContext = new EngineContext(); InstanceList.Add(this); }