Media in C#.Net
I need some tips on how to add sounds in a game of mine. And i really need them fast. If there's anyone of the members who know, please feel free to contact me on my address: [email protected]
I asked my teacher, he asked me to do it with DirectX. But how? I have directX, but i dont know where it gets installed everytime i install it. Its all over the computer, it seems. Please help, fast.
asicPosted Jul 23, 2005, 5:45 PM
hi
this is an example of class i made to deal with sound ,i use it with the wave sound files
i donnot know if it will support other media formats
----------------------------------------------------------------------
using System;
using Microsoft.DirectX;
using Microsoft.DirectX.DirectSound;
using System.Windows.Forms;
namespace Sample
{
///
///
public class SSound
{
private Device device = null;
private SecondaryBuffer sound = null;
public SSound(string location,Control x)
{
//
// TODO: Add constructor logic here
//
device = new Device();
device.SetCooperativeLevel( x, CooperativeLevel.Normal);
sound = new SecondaryBuffer(location, device);
}
public void SoundStart()
{
sound.Play(0, BufferPlayFlags.Looping);
}
public void SoundStop()
{
sound.Stop();
}
}
}
----------------------------------------------------------------
best wishes
asicPosted Jul 23, 2005, 5:23 PM
any version of the directx sdk will be suitable for u to be used for sound
u will find the samples after installing the directx for example in this path:
C:\Program Files\Microsoft DirectX 9.0 SDK (February 2005)\Samples\Managed\DirectSound
best wishes
jeea_4_oopPosted Jul 23, 2005, 2:17 PM
jeea_4_oopPosted Jul 23, 2005, 2:17 PM
asicPosted Jul 22, 2005, 6:44 PM
first go to the microsoft.com and download from there the directx sdk not the directx u use in playing games
in it u will find some samples in using sound in directx it will be very easy
u will use the library DirectSound of the directx