buzz forums

forums of the buzz
It is currently Mon Mar 27, 2017 2:26 pm

All times are UTC




Post new topic Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Wed Jan 18, 2017 11:23 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
I wonder, since the machines have a on/offbutton in the left top corner and a closebutton in the top right, would it be possible to add more buttons. I think it would be nice to also have a solo and a Bypassbutton.

I also remember being able to pan in old Buzz. Would it be possible to use this function as a fader? It would be very nice with the KrossIn Krossout.

Joachip, I hope you're ok with me using your nice avatar.


Attachments:
buzz forums • Viewing profile   Joachip.png
buzz forums • Viewing profile Joachip.png [ 11.5 KiB | Viewed 336 times ]
Top
 Profile  
 
PostPosted: Thu Jan 19, 2017 1:12 pm 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
I think it should be possible to do anything you like if you have the XAML skills. Sadly I don't have the skills. :(


Top
 Profile  
 
PostPosted: Thu Jan 19, 2017 11:32 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
IXix wrote:
I think it should be possible to do anything you like if you have the XAML skills. Sadly I don't have the skills. :(

Ah. That xaml... Unfortunately I don't have that skills either.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2017 9:34 am 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
AndersBrontosaurus wrote:
Ah. That xaml... Unfortunately I don't have that skills either.

It's a valid idea though.

New buttons should be fairly easy to work out. Panning might be a little bit more difficult but I don't really know. It's basically just a matter of defining an element and binding it to the appropriate command. This is the led/mute button definition from MachineControl.xaml...
Code:
<Button Name="ledButton" Command="{Binding MuteCommand}" Canvas.Left="2" Canvas.Top="2" Style="{StaticResource SmallButtonStyle}" BorderBrush="Black" BorderThickness="1" ToolTip="Mute">
  <Button.Background>
    <SolidColorBrush Color="{Binding Path=MachineLEDOffColor}"/>
  </Button.Background>
  <Image Name="ledButtonSkinImage" Visibility="Collapsed"/>
</Button>

As you can see, it's not actually that complicated, even though there's a lot of it. The bit that makes it work is the command binding, so if you find out what commands are available then you can make any button you like.

edit: okay, I admit I probably do have the skills.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2017 11:16 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
Yes. Being a zero on coding this is what I was thinking or hoping, that they were bound together in some way. I assume "solo" would be easier then since there is a solofunction already while bypassing demands more coding since there isno command to bind it to yet?

IXix wrote:
edit: okay, I admit I probably do have the skills.

Ummm...yes, it certainly looks so. :-)


Top
 Profile  
 
PostPosted: Sat Jan 21, 2017 10:37 am 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
AndersBrontosaurus wrote:
I assume "solo" would be easier then since there is a solofunction already while bypassing demands more coding since there isno command to bind it to yet?

No, there will be a bypass command to bind to. Same with the panning, you just have to bind a control to the correct machine parameter but I don't know how to access that without some digging. Here are most of the commands (the ones that should work as buttons) defined by the MachineControl, if you feel like getting your toes wet...
Code:
DeleteCommand
MuteCommand
SoloCommand
BypassCommand
OversampleCommand
WirelessCommand
LatencyCommand
CloneCommand

:twisted:


Top
 Profile  
 
PostPosted: Sat Jan 21, 2017 2:13 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
Ooh! I'll definitely try. Seems like I can't really mess something up and it would be awesome to contribute with actual coding. (even if it'll most be copy-edit-paste). Right now it seems like the biggest task will be where to get and put the code. :-)


Top
 Profile  
 
PostPosted: Sat Jan 21, 2017 3:59 pm 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
AndersBrontosaurus wrote:
Ooh! I'll definitely try. Seems like I can't really mess something up and it would be awesome to contribute with actual coding. (even if it'll most be copy-edit-paste). Right now it seems like the biggest task will be where to get and put the code. :-)


That's the spirit! Make a backup before you start tinkering. :)

Program Files\Jeskola Buzz\Themes\<your_theme>\MachineView\MachineControl.xaml


Top
 Profile  
 
PostPosted: Sat Jan 21, 2017 8:56 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
Ok. It wasn't as simple as I had hoped. I thought I'd get away with just renaming and rebinding to other commands but I got several windows full of complaints about object references. Any obvious mistakes?


Attachment:
wireless2.jpg
wireless2.jpg [ 229.96 KiB | Viewed 274 times ]



[spoiler]
Code:
<!-- led/mute button -->
                <Canvas>
                  <Button Name="ledButton" Command="{Binding MuteCommand}" Canvas.Left="2" Canvas.Top="2" Style="{StaticResource SmallButtonStyle}" BorderBrush="Black" BorderThickness="1" ToolTip="Mute">
                    <Button.Background>
                      <SolidColorBrush Color="{Binding Path=MachineLEDOffColor}"/>
                    </Button.Background>
                    <Image Name="ledButtonSkinImage" Visibility="Collapsed"/>
                  </Button>
                </Canvas>
            
            <!-- Solo button -->
                <Canvas>
                  <Button Name="SoloButton" Command="{Binding SoloCommand}" Canvas.Left="10" Canvas.Top="2" Style="{StaticResource SmallButtonStyle}" BorderBrush="Black" BorderThickness="1" ToolTip="Solo">
                    <Button.Background>
                      <SolidColorBrush Color="{Binding Path=MachineLEDOffColor}"/>
                    </Button.Background>
                    <Image Name="ledButtonSkinImage" Visibility="Collapsed"/>
                  </Button>
                </Canvas>
            
            <!-- Bypass button -->
                <Canvas>
                  <Button Name="BypassButton" Command="{Binding BypassCommand}" Canvas.Left="20" Canvas.Top="2" Style="{StaticResource SmallButtonStyle}" BorderBrush="Black" BorderThickness="1" ToolTip="Bypass">
                    <Button.Background>
                      <SolidColorBrush Color="{Binding Path=MachineLEDOffColor}"/>
                    </Button.Background>
                    <Image Name="ledButtonSkinImage" Visibility="Collapsed"/>
                  </Button>
                </Canvas>

[/spoiler]


Top
 Profile  
 
PostPosted: Sun Jan 22, 2017 11:04 am 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
AndersBrontosaurus wrote:
Ok. It wasn't as simple as I had hoped. I thought I'd get away with just renaming and rebinding to other commands but I got several windows full of complaints about object references. Any obvious mistakes?

Try putting all the buttons inside a single canvas element. Just a guess.


Top
 Profile  
 
PostPosted: Sun Jan 22, 2017 11:34 am 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
Just had a quick look and I think the led button is in a canvas because it has to update rapidly in response to th machine audio. The delete button is on its own outside the canvas so I tried duplicating the delete button and making it function as solo. It worked but then there are alignment issues so I wrapped both buttons in a horizontal StackPanel and that looks like the best way to go. Here's the code...
Code:
<StackPanel Orientation="Horizontal" Margin="0,3,3,0" HorizontalAlignment="Right" VerticalAlignment="Top">
   <Button Name="deleteButton" Command="{Binding DeleteCommand}" Style="{StaticResource DeleteButtonStyle}" BorderThickness="0" BorderBrush="#000000" Background="Transparent" ToolTip="Delete"/>
   <Button Name="soloButton" Command="{Binding SoloCommand}" Style="{StaticResource DeleteButtonStyle}" BorderBrush="Black" BorderThickness="0" ToolTip="Solo" />
</StackPanel>

Obviously that's a pretty crappy implementation but it works. You'd just need to sort out a button style and some images to make it look nice. The button styles are defined at the top of the file. You should probably copy the DeleteButtonStyle and tweak it for the behaviour you want.

Code:
  <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource SmallButtonStyle}">
      <Setter Property="Width" Value="9"/>
      <Setter Property="Height" Value="9"/>
      <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Border Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                  <Path Name="path" Data="M0,0 L1,1 M0,1 L1,0" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Stretch="Fill"/>
               </Border>
               <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="path" Property="Stroke" Value="White"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>


Now I'd better go and do something that I'm supposed to be doing...


Top
 Profile  
 
PostPosted: Sun Jan 22, 2017 11:38 am 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
Oh btw, in case you weren't aware, you can edit the files and just reload your theme from the Themes menu to see the changes. No need to restart Buzz.


Top
 Profile  
 
PostPosted: Sun Jan 22, 2017 4:20 pm 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
IXix wrote:
Same with the panning, you just have to bind a control to the correct machine parameter but I don't know how to access that without some digging.

I was wrong about that. I forgot that panning is a property of the machine connections, not the machines, so a pan control on the machine wouldn't make sense.


Top
 Profile  
 
PostPosted: Sun Jan 22, 2017 9:28 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
Eeehh...hhrrmm... A canvas is what you use for painting so I think I made the assumption that canvas was the name used for this particular machinebox. :-). I know better now. A canvas Defines an area within which you can explicitly position child elements by using coordinates that are relative to the Canvas area.
I'll have a little try and see what comes out.

IXix wrote:
Oh btw, in case you weren't aware, you can edit the files and just reload your theme from the Themes menu to see the changes. No need to restart Buzz.

Good thinking. No, I was definitely not aware. :-)

IXix wrote:
IXix wrote:
Same with the panning, you just have to bind a control to the correct machine parameter but I don't know how to access that without some digging.

I was wrong about that. I forgot that panning is a property of the machine connections, not the machines, so a pan control on the machine wouldn't make sense.

Ok. Then, a follow-up question? Since my initial idea was to use a slider as a fader or rather a crossfader on KrossIn/Out, would it be possible to code so that there is a slider on KrossIn/Out and (and not on other machines) which is bound to the "position"parameter


Top
 Profile  
 
PostPosted: Mon Jan 23, 2017 9:32 pm 
User avatar

Joined: Wed Nov 23, 2011 3:24 pm
Posts: 467
AndersBrontosaurus wrote:
would it be possible to code so that there is a slider on KrossIn/Out and (and not on other machines) which is bound to the "position"parameter

I think it's possible but it will take more XAML skills than just rigging up a new button.

You'd have to define your slider as part of the standard machine control then use a data trigger inside the slider style to detect the dll name and set the slider visibility as appropriate. You'd also need to bind the slider value to the appropriate parameter.

Here's a snippet from MachineView.xaml that detects if a machine is a generator and applies the appropriate colour, so you can get an idea of how triggers work...

Code:
<DataTrigger Binding="{Binding Path=Machine.DLL.Info.Type}" Value="Generator">
   <Setter TargetName="Border" Property="Background">
      <Setter.Value>
         <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Generator]}"/>
      </Setter.Value>
   </Setter>
</DataTrigger>

It looks complicated but all it does is read the property "Machine.DLL.Info.Type" and if it's "Generator" it sets the brush colour for the machine rectangle. A similar strategy using "Machine.DLL.Name" or possibly "Machine.DLL.Path" could handle the slider visibility. Other possibilities are "Machine.DLL.Info.Name", "Machine.DLL.Info.ShortName" and "Machine.DLL.Info.Author".

I don't know how you'd go about binding to a machine parameter from XAML but I'd be suprised if you couldn't do it. I could probably figure it out but I can't spare the time right now. I am curious to know whether it would work though so if you can't figure it out yourself, remind me in a couple of weeks and I'll give it a try.

There are a several WPF/XAML tutorials on the web that should get you up to speed with styles and triggers. Good luck and kudos for daring to dive into the code yourself! :ugeek:


Top
 Profile  
 
PostPosted: Sat Jan 28, 2017 11:16 pm 
User avatar

Joined: Mon Feb 25, 2013 9:31 am
Posts: 408
Location: Mörkö / Groke Island
Thank you for educating me!
I will definitely stick my toes back in the water once I've seen this stubborn flu out but I'm not sure I'm going to as deep as to the calves. :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group