Search found 103 matches

by TheOm
Mon Nov 02, 2020 6:41 pm
Forum: General
Topic: Transfer array between instances
Replies: 11
Views: 35981

Re: Transfer array between instances

I have reworked the code a bit and added some simple synchronization, just to guarantee that the whole shared memory region is updated atomically.
by TheOm
Sun Nov 01, 2020 4:01 pm
Forum: General
Topic: Transfer array between instances
Replies: 11
Views: 35981

Re: Transfer array between instances

trogluddite wrote:but unfortunately I ran into problems that were a bit beyond my C++ coding chops!

What problems did you encounter? I have experience with c++ and the windows api, so I might be able to help
by TheOm
Tue Apr 21, 2020 9:44 am
Forum: General
Topic: Not Flowstone related - Ruby code question
Replies: 10
Views: 23885

Re: Not Flowstone related - Ruby code question

Essentially this adds a Module method (same as a class method aka a "static" method) called __add_one_arg_setter to the module.
For a real explanation of the class << self thing look at this old stackoverflow question:
m

The method does some metaprogramming. It takes a class and for every instance ...
by TheOm
Tue Oct 29, 2019 9:00 pm
Forum: General
Topic: How to do this properly in Ruby?
Replies: 7
Views: 15798

Re: How to do this properly in Ruby?

I post this here as alternative method, more or less performat of other?

num = 5
a = &#91;2, 3, 4&#93;
a&#46;sort&#46;find{|x| x >= num} || a&#46;first # =>2


That will only work if the array is sorted. It will return the first element that's greater than num, not necessarily the closest ...
by TheOm
Tue Oct 29, 2019 7:10 pm
Forum: General
Topic: How to do this properly in Ruby?
Replies: 7
Views: 15798

Re: How to do this properly in Ruby?

I would probably use min_by with the difference to the target number. It's O(n) and no temporary array.

Code: Select all

num = 20
a = [2, 4, 6, 7, 9, 18, 1, 7]

closest = a.min_by { |e| e >= num ? e - num : Float::INFINITY }
by TheOm
Tue Oct 23, 2018 1:54 pm
Forum: DSP
Topic: passive analogue circuit in digital representation
Replies: 17
Views: 58183

Re: passive analogue circuit in digital representation

There exist multiple methods for transforming continouus time circuits to discrete time.
See:
Impulse Invariance
Bilinear Transform
Matched Z-Transform

I also recommend this paper where another method called topology-preserving transform is introduced
https&#58;//www&#46;native-instruments ...
by TheOm
Sun Aug 05, 2018 5:08 pm
Forum: General
Topic: C/C++ programmers, please confirm
Replies: 5
Views: 12463

Re: C/C++ programmers, please confirm

I think opening a modern file dialog from within ruby is actually not possible.
You would need to call methods like SetOptions or Show through the function pointers in the IFileDialog VTable, and I don't think you can do this in ruby.
Reimplementing a file dialog in ruby would also be a huge task.
I ...
by TheOm
Sun Aug 05, 2018 1:07 am
Forum: General
Topic: C/C++ programmers, please confirm
Replies: 5
Views: 12463

Re: C/C++ programmers, please confirm

1) enum is a list of specific integer values that are accessed by their name
You can think of it that way, though it's not technically true. An enum value like D_Mon is of some enum type (in your example its an unnamed enum type), but it is guaranteed to be implicitely convertible to its ...
by TheOm
Fri Jan 19, 2018 6:24 pm
Forum: DSP
Topic: Time dependend code
Replies: 7
Views: 27869

Re: Time dependend code

So you don't want a sample and hold? I'm not quite sure what you mean by this:
tulamide wrote: My goal is to simplify the waveform through linear interpolation, but keep the overall shape similar as long as possible

Can you explain a bit more what you want to achieve?
by TheOm
Sat Jan 13, 2018 2:14 pm
Forum: User Examples
Topic: tula's DSP modules
Replies: 40
Views: 106373

Re: tula's DSP modules

martinvicanek wrote:Do you happen to have a simpler expression for the abs bitmask as well?

No, unfortunately not without using stage0. I don't think there's a way to type NaN in the code module, is there?