MeterGadget.pbi, create analog style meters for your program

Share your advanced PureBasic knowledge/code with the community.
Simo_na
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Mar 03, 2013 9:01 am

Re: MeterGadget.pbi, create analog style meters for your pro

Post by Simo_na »

BasicallyPure wrote:
If the input signal value is one half of full scale then the dB is calculate like this.
dB = 20 * Log10(0.5)
the result is -6 dB.
So if full scale is +3 then half scale is +3 dB subtract 6 dB gives -3 dB.
This is the value shown at half scale on the VU scale.

BP
Thank you

I have understand correctly ? :oops:
:)

Code: Select all

.........

For cnt=0 To #N

outputarray(cnt)=(IMX(cnt)*IMX(cnt))+(REX(cnt)*REX(cnt))

Next

SortArray(outputarray(),#PB_Sort_Descending)

media1=(outputarray(0))

;my_log=(20*Log10(media1/44100*4096)*1.081)  ;old code

;my_log = (media1 / 8192)

my_log= 20 * Log10(media1 * 0.5) 

SetMeterState(my_ll,my_log)

EndProcedure

.......


EDIT
i've modified few lines...
now seems work fine... (i'm waiting your approbation.... :| )
thank you.
....
#SAMPLE_RATE=32767
....
flags=#MTR_STYLE_VU | #MTR_STYLE_LED | #MTR_NEEDLE_VAR1
.....
rex(i2)=(value/#SAMPLE_RATE)
.....
my_log=(20*Log10(media1*0.14))
......
Simo_na
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Mar 03, 2013 9:01 am

Re: MeterGadget.pbi, create analog style meters for your pro

Post by Simo_na »

Hi, I would like to pass the X and Y variables below

Code: Select all

      .....
      EndIf
     
      position = Radian(0.9 * position - 45)
      x = \mid_X  + Sin(position) * (\arcRadius)  
      y = \height - Cos(position) * (\arcRadius)
     
      StartDrawing(CanvasOutput(GadNum))
      ....
@ this point...

Code: Select all

               .....
               py = \height - Cos(Radian(angle)) * (\arcRadius - 5)
               x  = \mid_X  + Sin(Radian(angle)) * (\arcRadius + 5)
               y  = \height - Cos(Radian(angle)) * (\arcRadius + 5)
               LineXY(px, py, x, y, \scaleColor)
    ------> . <------ here
               DrawingFont(FontID(\scaleFont))
               x  = \mid_X  + Sin(Radian(angle-1)) * (\arcRadius + 20)
               y  = \height - Cos(Radian(angle-1)) * (\arcRadius + 20)
               DrawRotatedText(x, y, Str(angle/9 + 5), -angle, \captionColor)
               
               angle + inc
            Until angle > 45
            ......
what method can do that ?
i've used *null = @null and PeekL (*null) but it is volatile.... :oops:
User avatar
minimy
Enthusiast
Enthusiast
Posts: 552
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: MeterGadget.pbi, create analog style meters for your pro

Post by minimy »

Some boby know how take the peaks from the speakers output? not mic, speakers please.
is possible that without external libraries, using the Windows API?
Thanks friends!!
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 539
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: MeterGadget.pbi, create analog style meters for your pro

Post by BasicallyPure »

minimy wrote:Some boby know how take the peaks from the speakers output? not mic, speakers please.
This is the only help I have to offer.

http://www.sevenforums.com/tutorials/20 ... nable.html

BP
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 552
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: MeterGadget.pbi, create analog style meters for your pro

Post by minimy »

Thank you very much, you help me a little smoothing the way, but still do not know how to access the audio output. Even so thank you very much BasicallyPure !
If translation=Error: reply="Sorry, Im Spanish": Endif
Post Reply