Feel free to ignore this post. I’m toying around with changing the code on my blog to use the syntax highlighting made possible via:
Rather than the rather bloated (and unfriendly to RSS readers) paste from Visual Studio, I thought I’d try this. The “paste from VS” method retained all the colors and formatting from VS, but just made for bloated posts and left RSS readers (most anyway) with a jumbled mess without any line breaks. I need to actually post this live to see if this approach also gets munged in RSS readers.
XAML (using the XML formatting style)
<UserControl x:Class="PeteBrown.SilverlightSoundTest.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:PeteBrown.SilverlightSoundTest.UI">
<Grid x:Name="LayoutRoot" Background="{StaticResource MainBackgroundBrush}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="320" />
<ColumnDefinition Width="320" />
<ColumnDefinition Width="320" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ui:OscillatorEditor x:Name="Oscillator1Editor"
Margin="5 5 0 5"
Grid.Column="0"
Grid.Row="0" />
<ui:OscillatorEditor x:Name="Oscillator2Editor"
Margin="0 5 0 5"
Grid.Column="1"
Grid.Row="0" />
<ui:OscillatorEditor x:Name="Oscillator3Editor"
Margin="0 5 5 5"
Grid.Column="2"
Grid.Row="0" />
<ui:MixerEditor x:Name="MixerEditor"
Margin="5 5 5 5"
Grid.Row="1"
Grid.ColumnSpan="2" />
<MediaElement x:Name="AudioPlayer"
AutoPlay="True" />
</Grid>
C# code (using the C# formatting style)
for (int i = 0; i < MaxWaveforms; i++)
{
double phase = CalculatePhaseWithOffset(state.PhaseOffset, state.Phase[i]);
double sample = (state.MaxAmplitude.Value - (state.MaxAmplitude.Value / Math.PI) * phase) * (int)state.Polarity;
//if (i % 2 != 0)
// sample *= -1;
accumulatedAmplitude += sample;
state.Phase[i] = CheckPhase(state.Phase[i] + ((MathUtility.TwoPI * detune[i]) / _sampleRate.SamplesPerSecond));
//accumulatedAmplitude *= .75; // warning, magic number at work
}