Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The audioFileReader object is not responding, causing it to be unable to play #1072

Open
Super-Badmen-Viper opened this issue Sep 20, 2023 · 5 comments

Comments

@Super-Badmen-Viper
Copy link

When playing FLAC lossless and higher-quality audio formats, setting the playback progress of a song using audioFileReader.CurrentTime = newTime; has a very high chance of causing the audioFileReader object to become unresponsive.

When there is an issue with "audioFileReader.CurrentTime = newTime;" in the code, the Debug debugger does not allow debugging of any code after "audioFileReader.CurrentTime = newTime;." Instead, it simply skips all subsequent code within the function containing this line and exits, without providing any error messages.

Please note that at this point, you cannot use Dispose() to release memory for the audioFileReader; the only way to release memory is by setting it to null. If "audioFileReader.CurrentTime = newTime;" is executed on the UI thread, the UI interface will freeze, rendering it unresponsive to user interactions.

@Super-Badmen-Viper
Copy link
Author

When playing FLAC lossless and higher-quality audio formats, setting the playback progress of a song using audioFileReader.CurrentTime = newTime; has a very high chance of causing the audioFileReader object to become unresponsive.

When there is an issue with "audioFileReader.CurrentTime = newTime;" in the code, the Debug debugger does not allow debugging of any code after "audioFileReader.CurrentTime = newTime;." Instead, it simply skips all subsequent code within the function containing this line and exits, without providing any error messages.

Please note that at this point, you cannot use Dispose() to release memory for the audioFileReader; the only way to release memory is by setting it to null. If "audioFileReader.CurrentTime = newTime;" is executed on the UI thread, the UI interface will freeze, rendering it unresponsive to user interactions.

My application scenario is a. NET WPF desktop application, and the Naudio version is the latest version. The testing scenario is my open source music project MoZhiMusic

@markheath
Copy link
Contributor

Hmm, that is very strange. Under the hood it is using Media Foundation. But this has generally been very reliable over the years, so not sure what exactly might be causing the problem. Have you tried repositioning with Position instead and see if that exhibits the same issue?

@Super-Badmen-Viper
Copy link
Author

Super-Badmen-Viper commented Sep 27, 2023

Hmm, that is very strange. Under the hood it is using Media Foundation. But this has generally been very reliable over the years, so not sure what exactly might be causing the problem. Have you tried repositioning with Position instead and see if that exhibits the same issue?

I have made changes to the code based on your suggestions and used the 'Position' attribute to track the progress of audio playback. However, this issue remains the same as before, especially when playing audio in FLAC format, setting the audio playback position may cause the 'audioFileReader' object to not respond. This is the code I updated:

image
image

In this annotated code snippet, I integrated the FFPEG extension of CsCore Use NAudio to play FLAC format audio. And add my FFPmpegAudioReaderClass to initialize FLAC format audio and use my MediaElement_ Song class for playback and other operations. The FFmpeg extension of CsCore is working properly and can seamlessly integrate with NAudio's "audioFileReader" and equalizer. NAudio is an important component of mine because it has many functions that I rely on. Combining the FFmpeg extension of CsCore with NAudio can help solve common FLAC playback and equalizer settings issues I encounter when implementing with NAudio.
Thank you for your reply

@yueyinqiu
Copy link

perhaps my discussion #1130 is related to this issue?

@Super-Badmen-Viper
Copy link
Author

perhaps my discussion #1130 is related to this issue?

After my personal verification, NAudio can indeed be used with ffmpeng to support all formats that ffmpeng can support (such as flac). You can refer to my code, but I'm not sure if Naudio plans to support ffmpeng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants