Home > Posts > Fix: compile CSpeex audio codec at Silverlight 4 RC+ and Silverlight 5

Fix: compile CSpeex audio codec at Silverlight 4 RC+ and Silverlight 5

Just added an issue to CSpeex project – http://cspeex.codeplex.com/workitem/18209 – with some fixes to make it compile for Silverlight 4 RC and higher (was for Silverlight 4 Beta).

1) at "MainPage.xaml.cs", replace with this method implementation:

private void TakeSnapshot_Click(object sender, RoutedEventArgs e)
{
  if (_captureSource != null)
  {
    // capture the current frame and add it to our observable collection
    _captureSource.CaptureImageCompleted += (source, eventargs) =>
    {
        _images.Add(eventargs.Result);
    };

  //”ImageCaptureAsync" method replaced by "CaptureImageAsync" at Silverlight 4 RC
    _captureSource.CaptureImageAsync();
  }
}

 

2) at "StreamAudioSync.cs" do this small change:

protected override void OnFormatChange(AudioFormat audioFormat)
{
  if (audioFormat.WaveFormat == WaveFormatType.Pcm)

  //”PCM" renamed to "Pcm" at Silverlight 4 RC (after SL4beta)

{

 

Note that the CSpeex-SL project won’t load if you don’t have Silverlight 3 SDK installed. After loading you can open up properties of that project and of SLAudioDemo one and set the target to Silverlight 5 from Silverlight 3, then save those two projects and rebuild the solution.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: