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.