Archive for the .NET Category


Posted in .NET, C#, Melody Mine, Music, Programming, Windows, WPF on 04/07/2020 by imekon8

I’ve started writing a new tool to help generate MIDI output. The song part consists of chunks of patterns that get output to MIDI when play is activated.


Patterns describe the notes to output:


These are notes – but not as you’d know them. The scale and mode (see the top) describe which notes get used (in this case C Major). That way any notes you play are always “musical” as the scale isn’t chromatic (i.e. all the twelve notes) but on a scale.


Working in Guildford

Posted in .NET, C#, Sound on 01/12/2013 by imekon8

As I did tests for our sound tech, I ran a standard one that had flies buzzing about my head. I had this on my 7.1 surround system. A voice called out, “you got a dead body there?” to a few laughs around the office.

Adventures in WPF

Posted in .NET, C#, Programming, WPF on 25/04/2010 by imekon8

First steps in hooking up code to UI in WPF. Here’s the XAML for the main window:

<Window x:Class="test3.MainWindow"
 Title="MainWindow" Height="190" Width="177">
    Source="{Binding Source={x:Static Application.Current}, Path=MainWindow.Platforms}"
 <DataTemplate x:Key="platformTemplate" DataType="{x:Type custom:Platform}">
    <StackPanel Orientation="Horizontal">
       <CheckBox Margin="1" IsChecked="{Binding Path=Selected}"/>
       <TextBlock Margin="1" Text="{Binding Path=Name}"/>
          <RowDefinition />
          <RowDefinition Height="23" />
          <RowDefinition Height="23" />
    <ListBox Grid.Row="0"
       ItemsSource="{Binding Source={StaticResource platforms}}"
       ItemTemplate="{StaticResource platformTemplate}"/>
    <Button Click="OnBuild" Grid.Row="1">Build...</Button>
    <Button Click="OnTogglePC" Grid.Row="2">Toggle PC</Button>

Here’s the code behind the above:

public partial class MainWindow : Window
    ObservableCollection<Platform> m_platforms;

    public MainWindow()
       m_platforms = new ObservableCollection<Platform>();

       m_platforms.Add(new Platform("PC"));
       m_platforms.Add(new Platform("PS3"));
       m_platforms.Add(new Platform("Xbox 360"));


    public ObservableCollection<Platform> Platforms
       get { return m_platforms; }
       set { m_platforms = value; }

    private void OnBuild(object sender, RoutedEventArgs e)
       string text = "";

       foreach (Platform platform in m_platforms)
          if (platform.Selected)
             text += platform.Name + " ";

       if (text == "")
          text = "none";

       MessageBox.Show(text, "WPF TEST");

    private void OnTogglePC(object sender, RoutedEventArgs e)
       m_platforms[0].Selected = !m_platforms[0].Selected;

Here’s the Platform class:

public class Platform : INotifyPropertyChanged
    private string m_name;
    private bool m_selected;

    public Platform(string name)
       m_name = name;
       m_selected = false;

    public string Name
       get { return m_name; }
          m_name = value;


    public bool Selected
       get { return m_selected; }
          m_selected = value;


    private void OnPropertyChanged(string name)
       if (PropertyChanged != null)
          PropertyChanged(this, new PropertyChangedEventArgs(name));

    public event PropertyChangedEventHandler PropertyChanged;

…and here’s what it looks like:

If you change the check boxes by each platform, then click on “Build”, you get a message box indicating which boxes you ticked; if you click on the “Toggle PC”, you’ll see the check box by PC changing.


Posted in .NET, C#, Programming, Windows on 24/04/2010 by imekon8

“…and so it begins”.

Once you’ve accepted C#, I guess there’s no turning back. Now onto WPF…