So when I added the audio calls it requires a GameTimer update which has a FrameAction function. This wasn't already in my app when i started because I didn't use the XNA game template.
So I'll have to add one, But I already added a Tick update function for updates. I wonder if this will overlap in a bad way...
right now im using:
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(30);
_timer.Tick += new EventHandler(Tick);
_timer.Start();
for updates. so, possibly, i can switch that to being a GameTimer instead? giving that a try...
So, it looks like the dispatchTimer can be replaced with GameTimer and the functions in it do the same thing
_timer = new GameTimer();
_timer.UpdateInterval = TimeSpan.FromMilliseconds(30);
_timer.Update += Tick;
_timer.Start();
This is the new code, GameTimer() replaced DispatcherTimer() and UpdateInterval replaces Interval, and Tick was replaced with Update and rather than a new EventHandler i just add the name of the function thats going to be updated. Then I start the timer.
Does the same thing it seems.
BUT now im getting this crappy error:
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
Additional information: FrameworkDispatcher.Update has not been called. Regular FrameworkDispatcher.Update calls are necessary for fire and forget sound effects and framework events to function correctly. See http://go.microsoft.com/fwlink/?LinkId=193853 for details.
seems like I need to add something... a short bit of reading I find I need to call it manually for some reason...
in my tick I added:
void Tick(object sender, GameTimerEventArgs e)
{
FrameworkDispatcher.Update(); // this was needed?
...
}
And that seems to have fulfilled what i need for calling the framework dispatcher... whatever that is.
so now it looks like i can get a buffer filled with mic stream data bytes. Golly, in the last four days I've only written about 480 lines of code. but every method was something I had to learn about.
hopefully, someone, other than me, found a line of code in this blog useful.
No comments:
Post a Comment