GithubHelp home page GithubHelp logo

Comments (6)

ChristopherKing42 avatar ChristopherKing42 commented on June 6, 2024

For the array suggestion, you could even make the channel index polymorphic. That is, instead of (Int, Int), it would be Ix i => (Int, i). The user could still make i be Int, but they could also use something like data Channel = Left | Right or what not. The functions needed to convert arrays to pointers do not care what index you use as long as it is Ix.

from bindings-portaudio.

fumieval avatar fumieval commented on June 6, 2024

I'm not a big fan of using Arrays or lists; there's a deliberate design choice of using a storable vector of static length data (e.g. V2), because it doesn't make sense to have dynamically changing number of channels in a stream. It also helps to have cache-friendly efficient operations.

from bindings-portaudio.

ChristopherKing42 avatar ChristopherKing42 commented on June 6, 2024

Storable Arrays can not change length in any dimension. Also, the current library does not guarantee static length, since Foldables can have a length that is different than the number of items they physically contain, perhaps in a variable way. For example, you can have data Foo a = Foo Int a, with toList (Foo n a) = replicate n a.

from bindings-portaudio.

ChristopherKing42 avatar ChristopherKing42 commented on June 6, 2024

If you want the length to be encoded in the type, you could use arrays where the bounds for the channel are (minBound, maxBound), or use fixed-vector which provides this typeclass specifically for fixed length vector types.

from bindings-portaudio.

fumieval avatar fumieval commented on June 6, 2024

I don't want 2D arrays because of the lack of API and you'll have to write elements one by one, for each channel. Fixed length vectors from the linear package are intended ones right now.

from bindings-portaudio.

ChristopherKing42 avatar ChristopherKing42 commented on June 6, 2024

Okay, I think I understand why the library is the way it is now. I'll just close this issue.

from bindings-portaudio.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.