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

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post 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  
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

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

Post by Fangbeast »

Sounds more like Phantom Of The Opera music here, no squeaking. But it is funny for an effect.
Amateur Radio, D-STAR/VK3HAF
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

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

Post 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:
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

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

Post by BarryG »

Weird but nice. And why off-topic? It should go in Announcement, General, or Tips 'n Tricks.
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

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

Post by Olli »

There is a part of humility in putting a source code in the off topic, I find it.
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post 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.
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post 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.
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

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

Post by Fangbeast »

/me bows to Olli from the channel corner while Idle's missus (his favourite sheep) mauls him repeatedly for messing with her:):)
Amateur Radio, D-STAR/VK3HAF
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post by idle »

Now see what you've stared up
https://youtu.be/ZrMmvCj9IFo
User avatar
Cognizant
New User
New User
Posts: 5
Joined: Thu Apr 07, 2022 3:18 pm
Contact:

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

Post 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)
My gaming project: Kevin.games
Post Reply