Reputation: 1330
Edit: I solved my problem.
I seem to have the same problem as this one and this one. Except that I can use XNA3.0 or 3.1, but neither of them have Microsoft.Xna.Framework.Xact.dll Instead there are Microsoft.Xna.Framework and Microsoft.Xna.Framework.Game .
I am programming on a Microsoft surface table, and I copied code from an example that uses XNA 2.0. I can run the example code fine, but I can't find the reference that it is using.
I have a reference to both Microsoft.Xna.Framework and Microsoft.Xna.Framework.Game, and in the code I have
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework;
My code breaks when it tries to create a new AudioEngine: (because if I comment it out the program runs)
string filename = System.Windows.Forms.Application.ExecutablePath;
string path = System.IO.Path.GetDirectoryName(filename) + "\\Audio\\";
try
{
audioEngine = new AudioEngine(path + "PianoSounds.xgs");
waveBank = new WaveBank(audioEngine, path + "PianoSounds.xwb");
soundBank = new SoundBank(audioEngine, path + "PianoSounds.xsb");
}
The error I get isn't very helpfull:
Cannot create instance of 'SurfaceWindow1' defined in assembly 'CoffeeTable1, Version=1.0.4652.32991, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'CoffeeTable1;component/SurfaceWindow1.xaml' Line 1 Position 18.
This is the xaml file SurfaceWindow1.xaml that tries to initialise:
<s:SurfaceWindow x:Class="CoffeeTable1.SurfaceWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Title="CoffeeTable1"
>
<s:SurfaceWindow.Resources>
<ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
</s:SurfaceWindow.Resources>
<Grid Background="{StaticResource WindowBackground}" >
<s:SurfaceButton Content="A" ContactEnter="StartSound" Margin="50,50,0,0" Height="100" Width="100" HorizontalAlignment="Left" VerticalAlignment="Top" Name="A6" ClickMode="Hover" />
</Grid>
</s:SurfaceWindow>
Upvotes: 2
Views: 361