Programming - Games - 2D - using DX9 and visual basic

This toturial was written for me by Imran Khan (imranahmedkhan82@hotmail.com, iak1982@yahoo.com).
Copyright (c) 2004 is owned by Martin Baker

Adding Sound/Video:

Sound:

First add a reference of AudioVideoPlayback as we added directx and directdraw in the first tutorial.

Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectDraw
Imports Microsoft.DirectX.AudioVideoPlayback

To play sound in Directx is very simple.

First Declare a instance to the Audio Class.

Private titlesound As Audio

Private titlesound As Audio

 

Simply we add this line to Init( ).

titlesound = New Audio("titlesound.wav", True)

Now simply add this line where you want to play the sound.

titlesound.Play( )

when you want to stop call

titlesound.Stop( )

For Pause

titlesound.Pause( )

If you want to open a file and play it when its declared then write:

titlesound.Openl("titlesound.wav", True)

If you want to open from any URL, then write:

titlesound.OpenUrl("http://www.somename.com/titlesound.wav", True)

If you want to jump to certain position in the sound you can use the CurrentPosition property.

titlesound.CurrentPostition = 100

This is all about Sound.You can add sound simply to your Game.

Video:

It is same as the Audio Class .

First declare a instance to video class,

Private titlevideo As Video

Then in whereever you want to start the move declare a new instance of the Video class

titlevideo = New Video("titlevideo.mgp", True)

to play,stop and pause use the Same method as mentioned in the Audio class.

 


metadata block
see also:
Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.