It is currently March 28th, 2024, 12:50 pm

Help with a bluetooth related skin

Get help with creating, editing & fixing problems with skins
Post Reply
rohaanpk03
Posts: 6
Joined: March 9th, 2018, 1:02 am

Help with a bluetooth related skin

Post by rohaanpk03 »

Hey guys, I am fairly new to rainmeter and am wanting to start coding some basic skins for my benefit and was wondering if anyone could help me with coding a skin? I want a skin that can detect when i switch between my laptop speakers and bluetooth headphones (or just detect when a bluetooth device device connect to my pc) and auto refresh rainmeter. Whenever I switch between my laptop speakers and headphones I have to refresh rainmeter to get my VU meters to start working again. I do have a skinthe refreshed rainmeter when I click on it but it would be nice to have a skin to do that for me automatically.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Help with a bluetooth related skin

Post by eclectic-tech »

The Windows7Audio Plugin returns name of the current sound device. You could use an invisible background skin that monitors the audio in a String Measure and uses an OnChangeAction to refresh Rainmeter.

Code: Select all

[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeasureAudioString]
Measure=String
String=[MeasureWin7Audio]
OnChangeAction=[!Refresh "ConfigName"]
DynamicVariables=1

[MeterDummy]
Meter=String
I haven't tested, but this should refresh the specified skins when the sound device changes. To refresh more visuzlizers, simply add another refresh (one after another) to the OnChangeAction bang; [!Refresh "VisBubble"][!Refresh "VU-Meter 3"] etc.

Alternately, you could specify which skins are refreshed, rather than a general !Refresh App, which may be undesirable for webparser skins, timing skins, etc.

Edit: Added DynamicVariables=1 to the string measure. An issue you might encounter is auto switching stops working when a variant of a skin is chosen; the auto refresh will not be properly initialized when switching to a variant, because you are not loading a new skin. Simply refresh the variant to have it start auto switching.
Last edited by eclectic-tech on March 12th, 2018, 3:26 pm, edited 2 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with a bluetooth related skin

Post by balala »

eclectic-tech wrote:Alternately, you could specify which skins are refreshed, rather than a general !Refresh App, which may be undesirable for webparser skins, timing skins, etc.
Definitely a complete refresh isn't desirable. Instead just the appropriate config (skin) should have to be refreshed, adding a Config parameter to a !Refresh bang. Or eventually a !RefreshGroup bang should have to be used, creating an appropriate group of skins, if more then one single skin should have to be refreshed.
rohaanpk03
Posts: 6
Joined: March 9th, 2018, 1:02 am

Re: Help with a bluetooth related skin

Post by rohaanpk03 »

Ok so it refreshes when i swap from the headphones to the built in speakers but not the other way around. Also the skins are set to refresh=0 and just using the refresh in the code doesn't work.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Help with a bluetooth related skin

Post by eclectic-tech »

rohaanpk03 wrote:Ok so it refreshes when i swap from the headphones to the built in speakers but not the other way around.
If it does it once, it will do it twice... ;-)
rohaanpk03 wrote:Also the skins are set to refresh=0 and just using the refresh in the code doesn't work.
What is 'refresh=0'? What does that means? By itself, it means nothing.

I think you are using skins that regenerate themselves after any changes and when first loaded. You may need to ask the authors of those visualizers for guidance on refreshing techniques. :17flag
rohaanpk03
Posts: 6
Joined: March 9th, 2018, 1:02 am

Re: Help with a bluetooth related skin

Post by rohaanpk03 »

here one of the codes

[Metadata]
Skin name=DESKTOP VU-METER (Bottom Stereo White + Delay)
Version number=1.2
Information=SOUND LEVEL
Author=HiTBiT-PA
Website=http://hitbit-pa.deviantart.com/
License=Creative Commons Attribution-Noncommercial-Share Alike 3.0 License

[Rainmeter]
Update=0
ContextTitle=Setup Window
ContextAction=!ActivateConfig "Desktop VU-Meter" "Setup.ini"
ContextTitle2=-
ContextTitle3=Refresh
ContextAction3=!Refresh

[Variables]
@include=#@#Variables.inc
@include2=#@#Data\Stereo Delay.inc

[StyleDelay]
X=26r
W=25
H=2
DynamicVariables=1
SolidColor=0,0,0

[StyleFFT]
X=26r
Y=r
W=25
H=240
BarOrientation=Vertical
BarImage=#@#Images\leds8.png
rohaanpk03
Posts: 6
Joined: March 9th, 2018, 1:02 am

Re: Help with a bluetooth related skin

Post by rohaanpk03 »

The skins are
Desktop VU meter and
Visbubble
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Help with a bluetooth related skin

Post by eclectic-tech »

My bad... ( I hadn't tested it...)

Add DynamicVariables=1 to the String Measure. Without that, it was not seeing the change.

Code: Select all

[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeasureString]
Measure=String
String=[MeasureWin7Audio]
; To refresh other visualizers, add a [!Refresh CONFIGNAME] to the OnChangeAction below
OnChangeAction=[!Refresh VisBubble]
DynamicVariables=1

[MeterDummy]
Meter=String
To refresh other visualizers, add a [!Refresh CONFIGNAME] to the OnChangeAction; e.g. [!Refresh "Desktop VU-Meter 3"].

With this code, VisBubble refreshes on every change of the sound device. (Updated first reply with corrected code...)
Last edited by eclectic-tech on March 12th, 2018, 3:27 pm, edited 1 time in total.
rohaanpk03
Posts: 6
Joined: March 9th, 2018, 1:02 am

Re: Help with a bluetooth related skin

Post by rohaanpk03 »

Thanks it worked
Post Reply