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

Thread2 #2

Merged
merged 15 commits into from
Jun 24, 2022
Merged

Thread2 #2

merged 15 commits into from
Jun 24, 2022

Conversation

Lucarda
Copy link
Owner

@Lucarda Lucarda commented Jun 21, 2022

Improvements to the threading part

@Lucarda Lucarda mentioned this pull request Jun 21, 2022
flite.c Outdated Show resolved Hide resolved
flite.c Outdated Show resolved Hide resolved
@Spacechild1
Copy link

There's still a problem with flite_do_textfile because it calls flite_synth, even if called from the worker thread.

I don't think it's necessary to call flite_synth in flite_do_textfile at all. Instead, the function should only read the text file. (Maybe you can find a better name, e.g. flite_read_textfile. After this function you can call either flite_synth or flite_thread_synth.

@Spacechild1
Copy link

Spacechild1 commented Jun 21, 2022

Finally, please check all places where you set x_inprogress. You should only touch this variable on the main thread: set it to 1 in the Pd method and set it back to 0 in the clock tick function.

In fact, you only have to set x_inprogress=1 in asynchronous methods. E.g. there is no point in doing x_inprogress = 1 and x_inprogress = 0 in flite_synth() because it will execute synchronously on Pd's main thread.

@Spacechild1
Copy link

Spacechild1 commented Jun 21, 2022

Finally, I would recommend to rearrange the code a bit: flite_synth and flite_thr_synth really belong together, while flite_thread_synth belongs to flite_thread. Some thing for other methods. Also, make sure that the code comments are still valid (there's nothing more confusing than outdated comments :-) (For example, the comment above flite_thrd_synth says call the thread to do flite_synth - which is not correct)

This might sound pedantic, but you will thank me when you have to read this code again in 1 year :-)

@Lucarda
Copy link
Owner Author

Lucarda commented Jun 22, 2022

There's still a problem with flite_do_textfile because it calls flite_synth, even if called from the worker thread.

done

Finally, please check all places where you set x_inprogress. You should only touch this variable on the main thread: ...

done

Finally, I would recommend to rearrange the code a bit: flite_synth and flite_thr_synth really belong together, while flite_thread_synth belongs to flite_thread.

I fail to understand what this is about. You mean a better ordering of the functions?

@Spacechild1
Copy link

I fail to understand what this is about. You mean a better ordering of the functions?

yes

@Lucarda
Copy link
Owner Author

Lucarda commented Jun 23, 2022

@Spacechild1 I think this is roughly ready to merge, bump to 0.3.2 and do a Deken release.

What do you think?

flite.c Outdated Show resolved Hide resolved
flite.c Outdated Show resolved Hide resolved
flite.c Outdated Show resolved Hide resolved
flite.c Outdated Show resolved Hide resolved
flite.c Outdated Show resolved Hide resolved
flite.c Outdated

if (!x->x_wave) {
const char *voxstring;
voxstring = vox->s_name;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nitpicky, but why do you have the assignment on a seperate line? This should be simply const char *voxstring = vox->s_name

(I guess this comes from a misunderstanding about C. With C89 you had to declare any local variables at the top of the block, which often lead to a split between declaration and assignment. With C99 local variables can be declared anywhere.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to change it, it's more meant as a comment

@Spacechild1
Copy link

@Spacechild1 I think this is roughly ready to merge, bump to 0.3.2 and do a Deken release.

What do you think?

Looks good to me! I haven't really tested it in practice, but I guess you did :-)

@Lucarda Lucarda merged commit e81ddcf into master Jun 24, 2022
@Lucarda
Copy link
Owner Author

Lucarda commented Jun 24, 2022

Looks good to me! I haven't really tested it in practice, but I guess you did :-)

Total thanks @Spacechild1 :)

v0.3.2 is up on Deken.

Lucarda added a commit that referenced this pull request Oct 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants