473,657 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with DirectX.AudioVi deoPlayback.Aud io

If I have an audio file playing using DirectX.AudioVi deoPlayback.Aud io and I
click the stop button, using the following code:

Private Sub btnStop_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnStop.Click
Try
Player.StopWhen Ready()
Catch
End Try
End Sub

Private Sub PlayerStopped(B yVal sender As Object, ByVal e As
System.EventArg s) Handles Player.Stopping
While Player.Stopped = False
'do nothing here. we're waiting for it to stop.
End While
Timer1.Stop()
Try
Player.Dispose( )
Player = Nothing
Catch ex As Exception
End Try
trkPosition.Val ue = 0
lblPosition.Tex t = "0:00"
MsgBox("Made it thru this sub")
End Sub

I get the following exception:

System.AccessVi olationExceptio n was unhandled
Message="Attemp ted to read or write protected memory. This is often an
indication that other memory is corrupt."
Source="Microso ft.DirectX.Audi oVideoPlayback"
StackTrace:
at AudioWndProc(HW ND__* hWnd, UInt32 uMsg, UInt32 wParam, Int32
lParam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G&
msg)
at
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[]
commandLine)
at eDeeJay.My.MyAp plication.Main( String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[]
args)
at System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
at Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()

Line 81 referred to in the StackTrace happens to be the "Handles
Player.Stopping " line.

I was using:

Try
Player.Dispose( )
Player = Nothing
Catch ex As Exception
End Try

in the btnPlay_Click event to unload the player and reload and it worked
fine. But I need to unload the player when I click the Stop button. If I
move the Try block back up so it is in the Play button event code, it works
fine again. The MsgBox in the Player.Stopping event fires so I know it's
making it all the way through the code there. But as soon as I click the OK
button in the MsgBox, I get the error above. What gives?
Jan 15 '07 #1
0 2027

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
13000
by: Kieran Benton | last post by:
Hi everyone, Sorry this is more than a little off topic but Im having a terrible time trying to get anyone at the managed directX groups to reply so I'm going to try with everyone here as they are far more helpful! Im having problems with sound quality using the Audio class from this namespace and I was wondering if anyone else had similar issues or knows of any links to info about problems. Failing that anyone who has any information...
2
2921
by: Michael Mayer | last post by:
First of all, sorry for the cross-post. Seems like there should be a managed directx newsgroup. I'm trying to open the following sample application that comes with the DirectX SDK. C:\DXSDK\Samples\C#\AudioVideo\Bin\csAVPlayer.exe It will not play some of the samples shipped with the SDK. It either completey hangs the application (and I have to use Windows Task Manager to kill it) or sometimes it displays an error message. Below...
2
2505
by: Ian | last post by:
Does anyone know of a way where you can bind one of the Audio objects from DirectX.AudioVidoPlayback to a DirectX.DirectSound object? I need to do this because I need to be able to play several video clips at a time *and* send the audio of each video clip to differeing sound devices that have been enumerated previously. So far I've only found DirectSound to be effective at enumerating sound devices and so if I could create a DirectSound object...
0
917
by: | last post by:
I created a little app to play videos in a panel and its eating memory. no matter what i do it takes more memory with each clip. i tried everything even closing the form everything is declared in, and played with, but it wont let go of the memory its used. No matter how i load the new clips. Imports Microsoft.DirectX Imports Microsoft.DirectX.AudioVideoPlayback Private theVideo As Video theVideo = New Video(File) theVideo.Owner = Panel1...
0
1411
by: Jovo Mirkovic | last post by:
Hi, Any Windows action which minimizes all windows (win + D, ctrl + alt + del) is causing program error I have two forms: Form1 is shown on primary monitor on dual head graphics display
4
3315
by: mariusz | last post by:
Hi All, I have a problem with component DirectX.AudioVideoPlayback.Video. Following part of code works good but I have one problem. The movie is allways on the top left corner of the display. Size of the movie has change according to size of the PictureBox but position of the movie is allways the same: top left corner. How can I change position of the movie? Protected Overrides Sub OnResize(ByVal e As System.EventArgs)...
2
2308
by: Z.K. | last post by:
I was wondering if someone could tell me why I get this message and how to prevent it. If I hit continue, it runs fine, but want to know what I am doing wrong so I won't get this error in the future. also what is the file Clock.vshost.exe; my application is Clock.exe. Z.K. 'Clock.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\Super_Wizard\My Documents\Visual Studio
11
3454
by: raylopez99 | last post by:
I just downloaded the apparently free SDK for DirectX 9, all 200+ MB of it, but as I read about WPF I wonder: is DirectX obsolete? Should I even bother learning how to use it? After all, the end user must have the DirectX library installed on their PC before they can use any video playing program you write. Does WPF even use DirectX? Or are the functions of DirectX (mostly video and graphics stuff, possibly accelerated via software...
1
2055
by: not_a_commie | last post by:
The DirectX installer won't install the managed DLLs unless the .NET runtime is installed first.
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.