public void stop() { if (!running) { return; } running = false; MainActivity.Instance.VolumeControlStream = Stream.NotificationDefault; if (audioPlayer != null) { try { audioPlayer.Stop(); audioPlayer.Release(); } catch (Exception) { } audioPlayer.Dispose(); audioPlayer = null; } if (audioDecoder != null) { audioDecoder.stop(); audioDecoder.Dispose(); audioDecoder = null; } bufferSize = 0; }
public void stop() { if (!running) { return; } running = false; if (audioPlayer != null) { try { audioPlayer.Stop(); } catch (Exception) { } audioPlayer.Dispose(); audioPlayer = null; } if (audioDecoder != null) { audioDecoder.stop(); audioDecoder.Dispose(); audioDecoder = null; } if (provider != null) { provider.ClearBuffer(); } }
private void ProcessFileCallback(string fingerprint, long time) { Action action = () => { fp = fingerprint; // Release audio file handle. decoder.Dispose(); }; Dispatcher.BeginInvoke(action); }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "MP3 files (*.mp3)|*.mp3|WAV files (*.wav)|*.wav"; if (dlg.ShowDialog() == DialogResult.OK) { if (decoder != null) { decoder.Dispose(); } try { decoder = new NAudioDecoder(dlg.FileName); //decoder = new BassDecoder(); lbFile.Text = dlg.FileName; ResetAll(); int bits = decoder.Format.BitDepth; int channels = decoder.Format.Channels; lbAudio.Text = String.Format("{0}Hz, {1}bit{2}, {3}", decoder.Format.SampleRate, bits, bits != 16 ? " (not supported)" : "", channels == 2 ? "stereo" : (channels == 1 ? "mono" : "multi-channel")); lbDuration.Text = decoder.Format.Duration.ToString(); btnFingerPrint.Enabled = true; } catch { lbAudio.Text = "Failed to load audio"; lbDuration.Text = String.Empty; } } }
public void Dispose() { if (!AudioSystem.Active) { return; } if (decoder != null) { decoder.Dispose(); } DisposeOpenALResources(); Marshal.FreeHGlobal(decodedData); }
public void stop() { if (!running) { return; } running = false; AVAudioSession.SharedInstance().SetActive(false); if (audioPlayer != null) { try { audioPlayer.Stop(); audioPlayer.Reset(); } catch (Exception) { } audioPlayer.Dispose(); audioPlayer = null; } if (audioDecoder != null) { audioDecoder.stop(); audioDecoder.Dispose(); audioDecoder = null; } if (audioEngine != null) { try { audioEngine.Stop(); audioEngine.Reset(); } catch (Exception) { } audioEngine.Dispose(); audioEngine = null; } }
public void Dispose() { Decoder?.Dispose(); }
public void Dispose() => Decoder?.Dispose();