Indian Scale tuner

need a feature, suggest here

Re: Indian Scale tuner

Postby Broomy » Sat Nov 18, 2017 2:09 pm

brummer10 wrote:Yes, we can...

Cool, I have to study up on the code, but this seems doable.

brummer10 wrote:Be aware that we enter now multi threading, that means that note and ratio could change even in the middle of a expose call, that means you must control that the chosen note is inside the note array. So, to say, if you switch to a smaller note set, and in the expose call already a higher note is detected, the program crash. You must integrate a control that the selected note is smaller then the array size.

To avoid this problem, would it be possible to stop the current thread before starting a new one when a preset is changed?
Something like this: thread with Preset 1 data is active --> Preset 2 is called for --> stop thread --> now start thread with preset 2 data --> preset x is called for --> stop thread --> start thread with preset x data, and so on.
Would that involve this: std::terminate() ?
From what I understand this can be a problem when using complex handling of memory / temporarily storing big chunks of data, but that's not really the case here, right?

brummer10 wrote:Oh, I forgot to mention, nice maths you come up with. :)

;) I can improve it a little bit, but it seems to work for now...

Hans
User avatar
Broomy
 
Posts: 195
Joined: Thu Apr 24, 2014 7:53 am

Re: Indian Scale tuner

Postby brummer10 » Sat Nov 18, 2017 2:46 pm

Broomy wrote:To avoid this problem, would it be possible to stop the current thread before starting a new one when a preset is changed?
Something like this: thread with Preset 1 data is active --> Preset 2 is called for --> stop thread --> now start thread with preset 2 data --> preset x is called for --> stop thread --> start thread with preset x data, and so on.
Would that involve this: std::terminate() ?


No, that wouldn't help, as it is a race condition. What is needed is just check if display_note is not bigger then numberofnotes before access a element of the note array. Otherwise just return;
That will skip the step in case a race condition has happen.
User avatar
brummer10
Site Admin
 
Posts: 783
Joined: Thu Mar 26, 2009 6:57 pm

Re: Indian Scale tuner

Postby Broomy » Sat Nov 18, 2017 3:28 pm

Ok, will check on that.
Would it be an alternative to put a check at the end of the block which checks if the preset has changed.
That way it would always finish a cycle before starting a new one.
User avatar
Broomy
 
Posts: 195
Joined: Thu Apr 24, 2014 7:53 am

Previous

Return to Suggestion Box

Who is online

Users browsing this forum: No registered users and 1 guest

cron