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

Proposal: NPipe() #10

Open
wsc1 opened this issue Aug 23, 2018 · 0 comments
Open

Proposal: NPipe() #10

wsc1 opened this issue Aug 23, 2018 · 0 comments

Comments

@wsc1
Copy link
Member

wsc1 commented Aug 23, 2018

I would like to propose the addition of a function

NPipe(vSrc, vSnk Form, n int, p func(snkd, src []float64) error) (src Source, snk Sink)

which would

act like pipe, except

  • the Form of src would be vSrc
  • the Form of snk would be vSnk, and hence could differ
  • calls to src.Receive and snk.Send would return an error if the block size were not n
  • the function p, if not nil, would be called on every []float64 sent through the pipe and
    if it resulted in an error, then that error would be returned to both the source and sink side.
    If p is nil, and vSrc.Channels() != vSnk.Channels(), then a non-nil error would be returned.
    If p is nil, and vSrc.Channels() == v.Snk.Channels(), then it would effectively pass through
    the data without error.

This would

  • allow a developer to easily guarantee synchonized buffer sizes, and have corresponding efficiency benefits
  • allow for easy dynamic resampling and channel mapping and what not without needing to multiplex i/o beyond 1 input and 1 output.

Thoughts appreciated.

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

1 participant