Page 1 of 1

something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 9:58 am
by idle
windows only!

Code: Select all

Declare MIDIOpen()
Declare ChargeInstrument(Channel.a,Instrument.a)
Declare SendMIDIMessage(nStatus.l,nChannel.l,nData1.l,nData2.l)
Declare PlayNoteMIDI(Channel.a,Note.a,VelociteDown.a,VelociteUp.a)

Global m_hMidiOut,m_MIDIOpen.a

Procedure SendMIDIMessage(nStatus.l,nChannel.l,nData1.l,nData2.l)
  Protected dwFlags.l = nStatus | nChannel | (nData1 << 8 ) | (nData2 << 16)
  Protected temp.l = midiOutShortMsg_ (m_hMidiOut,dwFlags) ;
  If temp<>0
    MessageRequester ( "Error Midi" , "Error sending message to MIDI" ,0)
  EndIf
EndProcedure

Procedure MIDIOpen()
  If m_MIDIOpen = 0
    If midiOutOpen_ (@m_hMidiOut,#MIDIMAPPER,0,0,0) <> 0
      MessageRequester ( "Error Midi" , "Failed to open MIDI device" ,0)
    Else
      SendMIDIMessage($C0,0,0,0)
      m_MIDIOpen = 1
    EndIf
  EndIf
EndProcedure

Procedure MIDIClose(handle.l)
  midiOutClose_(m_hMidiOut) 
EndProcedure   

Procedure PlayNoteMIDI(Channel.a,Note.a,VelociteDown.a,VelociteUp.a)
  If m_MIDIOpen
    SendMIDIMessage($80 | Channel,0,Note,VelociteDown)
    SendMIDIMessage($90 | Channel,0,Note,VelociteUp)
  EndIf
EndProcedure

Procedure OpenInstrument(Channel.a,Instrument.a)
  If m_MIDIOpen
    SendMIDIMessage($C0 | Channel,0,Instrument,0)
  EndIf
EndProcedure 

MIDIOpen() 
ExamineDesktops()
w.f = DesktopWidth(0)
h.f = DesktopHeight(0)
pt.point 
lx.i
c1 = Random(15)
c2 = Random(15) 
I1 = Random(127)
i2 = Random(127)

OpenInstrument(c1,i1)  
OpenInstrument(c2,i2) 

OpenWindow(#PB_Any, 0, 0, 0, 0, "", #PB_Window_Invisible) 
Repeat
  GetCursorPos_(@pt)
  If lx <> pt\x
    lx=pt\x
    note.f = (((0-127) / (1-w)) * pt\x)   
    If pt\y > h/2 
      PlayNoteMIDI(c1,Int(note),127,127) 
    Else 
      PlayNoteMIDI(c2,Int(note),127,127) 
    EndIf 
  EndIf 
  Delay(note) 
  If GetAsyncKeyState_(#VK_ESCAPE) & $8000 
    End
  EndIf
ForEver  

Re: something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 12:12 pm
by Fangbeast
Sounds more like Phantom Of The Opera music here, no squeaking. But it is funny for an effect.

Re: something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 12:59 pm
by Olli
Hello idle ! (and fangbeast too)

What is this small mistake I can read on the head :

Code: Select all

Declare ChargeInstrument(...)

[...]

Procedure OpenInstrument(...)
?

:lol:

Re: something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 1:15 pm
by BarryG
Weird but nice. And why off-topic? It should go in Announcement, General, or Tips 'n Tricks.

Re: something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 2:06 pm
by Olli
There is a part of humility in putting a source code in the off topic, I find it.

Re: something is up with my mouse, it's squeaking!

Posted: Sat Feb 12, 2022 6:57 pm
by idle
It was an old code from a pure punch 👊 so no it doesn't belong anywhere else. Its also random what sounds you get each time it starts but yes it's a good prank to run it in the background and snigger while the misses looks confused at the cacophony her mouse movement make.

Re: something is up with my mouse, it's squeaking!

Posted: Sun Feb 13, 2022 1:50 am
by BarryG
idle wrote: Sat Feb 12, 2022 6:57 pmit doesn't belong anywhere else
Image

PureBasic code is not in any way related to PureBasic? :? Does not compute. :P

Re: something is up with my mouse, it's squeaking!

Posted: Sun Feb 13, 2022 2:27 am
by idle
While you're correct, I think it's better to keep jokes off topic, even though it written in PureBasic, the language isn't the subject matter which is my mouse and it squeaking. If it really bugs you I'm move it.

Re: something is up with my mouse, it's squeaking!

Posted: Sun Feb 13, 2022 2:35 am
by BarryG
idle wrote: Sun Feb 13, 2022 2:27 amIf it really bugs you I'm move it.
Nah, it's okay. I'm in a weird mood. I got it off my chest now.

Re: something is up with my mouse, it's squeaking!

Posted: Sun Feb 13, 2022 6:20 am
by Fangbeast
/me bows to Olli from the channel corner while Idle's missus (his favourite sheep) mauls him repeatedly for messing with her:):)

Re: something is up with my mouse, it's squeaking!

Posted: Sun Feb 13, 2022 9:44 am
by idle
Now see what you've stared up
https://youtu.be/ZrMmvCj9IFo

Re: something is up with my mouse, it's squeaking!

Posted: Fri Apr 08, 2022 10:21 am
by Cognizant
Ooomg it's funny, I like those small jokes :D to develop the idea: suddenly the "cracks" (broken black lines) start to cover the screen and the speakers start playing some weird music. And all of that buzz starts with... well.. I have to develop this idea more thoroughly)