Sunday, February 26, 2012

Audio Player Class

I am currently implementing the audio class i have created my own test project the i will add the necessary sound component to the mainline when i am done to avoid mainline chocking.


this is what i got so-far:

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using System.Text;

namespace Tetris
{
public enum Sound
{
SND_ROTATE,
SND_HARD_DROP,
SND_START_GAME,
SND_GAME_OVER,
}

public class AudioPlayer
{
//
// Other data structures needed to be decided by implementation team
//

static AudioPlayer instance;
public static AudioPlayer Instance
{
get
{
if (instance == null)
{
instance = new AudioPlayer();
}
return instance;
}
}

private AudioPlayer()
{
this.audioEngine = null;
this.soundBank = null;
this.waveBank = null;

//
this.hard_drop_sound = null;
this.rotate_sound = null;
this.start_game_sound = null;
this.game_over_sound = null;
}

~AudioPlayer()
{
}

public void Initialize()
{
audioEngine = new AudioEngine("Content\\TetrisSound.xgs");
soundBank = new SoundBank(audioEngine, "Content\\Tetris Sound Bank.xsb");
waveBank = new WaveBank(audioEngine, "Content\\Tetris Wave Bank.xwb");

hard_drop_sound = soundBank.GetCue("hard_drop");
rotate_sound = soundBank.GetCue("rotate");
start_game_sound = soundBank.GetCue("soundTrackMain");
game_over_sound = soundBank.GetCue("soundTrackMain");

}

public void playSound(Sound sound)
{
switch (sound)
{
case Sound.SND_START_GAME:
start_game_sound.Play();
break;
case Sound.SND_GAME_OVER:
game_over_sound.Play();
break;
case Sound.SND_HARD_DROP:
hard_drop_sound.Play();
break;
case Sound.SND_ROTATE:
rotate_sound.Play();
break;
}
}

public void startMusic() { }

public void stopMusic() { }

public Cue hard_drop_sound;
public Cue rotate_sound;
public Cue start_game_sound;
public Cue game_over_sound;

public AudioEngine audioEngine;
public SoundBank soundBank;
public WaveBank waveBank;
}
}

So long and stay thirst my friends.

Thursday, February 23, 2012

Bucket design

For this assignment we decided as a team that each one of us design our bucket data structure
then choose the one we thought was the most easy one to implement. Then after choosing the
design we all worked on improving it, once this was all finalized we devided the tasks
accordingly. I was assigned to do documentation requirements, for the implemetation team,
meaning how we wanted the implementation to be commented. Yet again we came through as a
team and completed the assignment on time.

So long and stay thirst my friends.

Project 2

For this project i was assigned to implement three methods for the Spin design. These methods
are: removeNode(), removeNodeAt(), and addToEnd(). Based on my previous experience with the doubbly linkedList this was not to difficult at all. The removeNode method take a Node parameter to be removed and the removeNodeAt takes an index of number for the node to be removed. For the addToEnd method just need to add the node at the end of the list, by getting the tail of the list then the added Node becomes the tail.. Working with the team was not a problem everyone did their fair share.


So long and stay thirst my friends.