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

Add IDevice::close() #748

Closed
gavv opened this issue Jul 12, 2024 · 4 comments
Closed

Add IDevice::close() #748

gavv opened this issue Jul 12, 2024 · 4 comments
Assignees
Labels
easy hacks The solution is expected to be straightforward even if you are new to the project help wanted An important and awaited task but we have no human resources for it yet much-needed This issue is needed most among other help-wanted issues refactoring sound io Audio I/O
Milestone

Comments

@gavv
Copy link
Member

gavv commented Jul 12, 2024

Implement explicit closing of devices & files.

sndio::IDevice is an interface implemented by audio devices and files and network senders and receivers. See doxygen. Currently devices perform closing in their destructor. We need to be able to do it explicitly before calling destructor. This is needed for #677.

Steps:

  • add virtual status::StatusCode close() = 0 to sndio::IDevice
  • add this method to all IDevice implementations
  • in implementations in roc::sndio, move closing of file/device from destructor to close(); and in destructor call roc_panic() if close() was not called
  • in implementation in roc::pipeline, close() may be no-op (just return StatusOK)
  • sndio::Pump should invoke close() before exiting from run()

Related: #703.

@gavv gavv added refactoring help wanted An important and awaited task but we have no human resources for it yet easy hacks The solution is expected to be straightforward even if you are new to the project sound io Audio I/O labels Jul 12, 2024
@gavv gavv added this to Roc Toolkit Jul 12, 2024
@github-project-automation github-project-automation bot moved this to Frontlog in Roc Toolkit Jul 12, 2024
@gavv gavv moved this from Frontlog to Help wanted in Roc Toolkit Jul 12, 2024
@gavv gavv added the much-needed This issue is needed most among other help-wanted issues label Jul 13, 2024
@runei
Copy link

runei commented Jul 17, 2024

Hi, I am interested in solving this issue.

@gavv
Copy link
Member Author

gavv commented Jul 17, 2024

Thanks, Leonardo! Be sure to pull fresh develop, it has some recent changes in IDevice.

@runei
Copy link

runei commented Jul 23, 2024

Hi @gavv , what status code should it return in case the device does not close successfully? Or it always return StatusOK?

@gavv
Copy link
Member Author

gavv commented Jul 23, 2024

Hi @gavv , what status code should it return in case the device does not close successfully? Or it always return StatusOK?

Same as from write - ErrFile or ErrDevice depending on device type.

@gavv gavv added this to the next milestone Jul 28, 2024
gavv pushed a commit to runei/roc-toolkit that referenced this issue Jul 28, 2024
gavv pushed a commit that referenced this issue Jul 28, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jul 28, 2024
- Destructors should not panic if close was called, but failed.
  Device should be marked as closed in all cases.

- Remove redundant log messages.

- Formatting & methods order.
@gavv gavv closed this as completed Jul 28, 2024
@github-project-automation github-project-automation bot moved this from Help wanted to Done in Roc Toolkit Jul 28, 2024
jeshwanthreddy13 pushed a commit to jeshwanthreddy13/roc-toolkit that referenced this issue Aug 6, 2024
jeshwanthreddy13 pushed a commit to jeshwanthreddy13/roc-toolkit that referenced this issue Aug 6, 2024
- Destructors should not panic if close was called, but failed.
  Device should be marked as closed in all cases.

- Remove redundant log messages.

- Formatting & methods order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy hacks The solution is expected to be straightforward even if you are new to the project help wanted An important and awaited task but we have no human resources for it yet much-needed This issue is needed most among other help-wanted issues refactoring sound io Audio I/O
Projects
Status: Done
Development

No branches or pull requests

2 participants