Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

The Number of the Beast

Sign in to follow this  


Well it's 6/6/6 so go play DooM or I'll have to hurt you. I know where you live, Rav told me.

Also in case you missed it, DOOM.Net is the IOTD.

I've added a header to the journal(like anyone could miss it). I figure this is a better way to show screenshots, mabye the 56k slowpokes won't be afraid to visit although I have always tried to keep image sizes low.

On to actual development news I finally figured out how to load sound effects. DOOM sounds are just 8-bit mono 11Khz PCM, but loading them into DirectSound directly has proved to be a complete pain in the ass. I tried FMODEx, but that was an even bigger pain and the C# API was nauseating. My solution is rather simple, just add a minimal WAV header onto the PCM data.

namespace Doom

public class Sound

private DirectSound.SecondaryBuffer Buffer = null;

private static DirectSound.Device Device = null;

private static byte[] WaveHeader = new byte[]{ 0x52, 0x49, 0x46, 0x46, 0xE8, 0x4F, 0x04, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20, 0x64, 0x61, 0x74, 0x61 };

public Sound( Lump SoundLump )
SoundLump.Position = 0;
int ID = SoundLump.ReadUInt16();
int Frequency = SoundLump.ReadUInt16();
int Samples = SoundLump.ReadUInt16();
IO.MemoryStream MemoryStream = new IO.MemoryStream();
IO.BinaryWriter BinaryWriter = new IO.BinaryWriter( MemoryStream );
BinaryWriter.Write( WaveHeader, 0, 16 );
BinaryWriter.Write( (int)16 ); // Chunk Size
BinaryWriter.Write( (short)1 ); // Format Tag
BinaryWriter.Write( (ushort)1 ); // Channels
BinaryWriter.Write( (uint)Frequency ); // Samples Per Second
BinaryWriter.Write( (uint)Frequency ); // Bytes Per Second
BinaryWriter.Write( (ushort)1 ); // Block Align
BinaryWriter.Write( (ushort)8 ); // Bits Per Sample
BinaryWriter.Write( WaveHeader, 16, 4 );
BinaryWriter.Write( (int)Samples ); // Samples
BinaryWriter.Write( SoundLump.ReadBytes( Samples ) ); // Data
MemoryStream.Position = 0;
Buffer = new DirectSound.SecondaryBuffer( MemoryStream, Device );
Buffer = null;

static Sound()
Device = new DirectSound.Device();
Device.SetCooperativeLevel( Video.Form, DirectSound.CooperativeLevel.Normal );


public void Play()
if( Buffer != null )
Buffer.Play( 0, DirectSound.BufferPlayFlags.Default );



There are two sounds that cause an exception because they're too small, but since I've never heard them I'm not really worried about it.

I'm going to work on wall collision now since I have some segment-segment collision code lying around from the subsector stuff. After that's in I can start added things like switches, doors and teleporters.

Oh and who rigged the "Featured Book"? [grin].

Sign in to follow this  


Recommended Comments

I no longer control MacMan. He says that he loves the Santa hat and that those against the hat will suffer.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!