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

Feature Request : buffer_setsize() or any other good name, provide change buffer size function #29

Open
leico opened this issue Jan 6, 2019 · 2 comments

Comments

@leico
Copy link
Contributor

leico commented Jan 6, 2019

Hello and Happy new year C74 Dev team.
First, I want to tell thank you, I appreciate your great jobs.

In this issue I would like to talk a above feature. Now I am creating a external object. It manipulate buffer~, I would like to implement a feature like std :: vector. I implemented like :

...
err = buffer_unlock( buffer_obj );
if( err != MAX_ERR_NONE ) //exception routine

object_method( buffer_obj, gensym("sizeinsamps"), samples * 2);

err = buffer_lock( buffer_obj );
if( err != MAX_ERR_NONE ) //exception routine
...

I guessed need to unlock a critical section to use buffer~ 's "sizeinsamps" message. But it allowed to interrupt other thread. This code may safe about multi thread process, but it can not guarantee data integrity.

If can change size without unlock, buffer manipulation is going to more useful I guess.

On the other hands, yes you can tell It doesn't need, or It is not supported.

Thanks to read.

@tap
Copy link
Contributor

tap commented Jan 8, 2019

Changing buffer sizes is indeed a tricky situation.

If the buffer is locked then it will not resize, as you note. When you send the message to the buffer object, the buffer will lock itself (or wait until it can lock itself).

@leico
Copy link
Contributor Author

leico commented Jan 9, 2019

@tap , thanks reply. Now I am manipulating a buffer~ in normal thread. Above point, sometimes DSP thread steal buffer~ . groove~ plays fragment data, also 'record~' overwrites buffer~. I would like to keep buffer~ when change buffer~ size.

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

2 participants