[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

midi scheduler in ruby

Gaspard Bucher

9/25/2007 2:44:00 PM

I am writing ruby wrappers around rtMidi
(http://www.music.mcgill.ca/~ga...) and need to trigger "note
off".

This is the api I wish to implement:
@midiout = RtMidi.new('port name')
note = 62
velocity = 100
duration = 0.25 # 1/4
@midiout.play(note, velocity, duration)

When a note is played, a first midi event is created for the velocity,
then, a little later a second for the note off:
[note on ]
[wait ]
[note off]

1. What is the best way to implement such a scheduler ?

2. Should I create a thread in C that checks for events in a buffer ?

3. Should this scheduler be implemented in Ruby ?
class Scheduler
def initialize
@events = []
Thread.new
while(true) do
sleep 0.01 # ?
if @events[0] && @events[0].time >= Time.now
@events.shift.trigger
end
end
end
end

def <<(e)
i = 0
while(@events[i] && e.time <= @events[i])
i += 1
end
if @events[i]
@events[i..i] << [e, i]
else
@events << e
end
end
end

Many thanks for your insight.

Gaspard

2 Answers

Jack Bruce

5/1/2011 8:32:00 PM

0

Ray Fischer wrote:
> Jack Bruce <BLT@bass.gov> wrote:
>
>>Ray Fischer wrote:
>>
>>>Jack Bruce <BLT@bass.gov> wrote:
>>>
>>>>Ray Fischer wrote:
>>>>
>>>>
>>>>>"computers did exist in the 1900s"
>>>>>
>>>>>The 1970s were about 70 years later, dumbass.
>>>>
>>>>Stick an abacus up yer dumb ass
>>>
>>>That's not a computer, asshole.
>>
>>"n., pl., ab??a??cus??es, or ab??a??ci (??b'??-s??', ??-b??k'??').
>>A manual computing device
>
>
> Q.E.D. It's a "computing device".

Therefore, a COMPUTER!
(sigh)


> It is not "an electronic device

Who said shit about anything having to be electronic, you retard?
I bet you think-n-believe that all music/media has to be wired up, eh?

Admit defeat, say yer sorry, and stuff a lit M80 up yer ass, you retard!

An Abucus IS, by even your deffinition, a computing device!

Now lay down and die!


Jack Bruce

5/1/2011 8:53:00 PM

0

Ray Fischer wrote:

> RD Sandman <rdsandman@comcast[remove].net> wrote:
>
>>rfischer@sonic.net (Ray Fischer) wrote in news:4dbdaed2$0$10585
>>
>>>Jack Bruce <BLT@bass.gov> wrote:
>>>
>>>>Ray Fischer wrote:
>>>>
>>>>>Jack Bruce <BLT@bass.gov> wrote:
>>>>>
>>>>>>Ray Fischer wrote:
>>>>>>
>>>>>>
>>>>>>>"computers did exist in the 1900s"
>>>>>>>
>>>>>>>The 1970s were about 70 years later, dumbass.
>>>>>>
>>>>>>Stick an abacus up yer dumb ass
>>>>>
>>>>>That's not a computer, asshole.
>>>>
>>>>"n., pl., ab??a??cus??es, or ab??a??ci (??b'??-s??', ??-b??k'??').
>>>>A manual computing device
>>>
>>>Q.E.D. It's a "computing device". It is not "an electronic device
>>>for storing and processing data, typically in binary form, according
>>>to instructions" (New Oxford American Dictionary)
>>>
>>>Obviously you're a moron who doesn't know when to stop digging.
>>
>>Just where is it written that a computing device MUST be electronic?
>
>
> The subject is "computers", not "computing devices", moron.

And again, Where does it say that a computer has to be electronic, you
retard?

And also, the "subject" is Whom would Jesus Screw, as written by the
other Socialist retard, DooDoo.

Are you two retards related to Lookout?