Click here to Skip to main content
15,894,539 members
Articles / Desktop Programming / WTL

The Psychology of a WTL Project: Lowercase Cause (a typing program)

Rate me:
Please Sign up or sign in to vote.
4.99/5 (32 votes)
20 Apr 200524 min read 64K   2.7K   25  
A psychological journey into a project crafted from start to finish.
#include "StdAfx.h"
#include ".\sound_system.h"

CWaveBox sound_system::_wave_box;
bool sound_system::_muted;

const int SFX_HIT_START = 0;
const int SFX_HIT_END = 15;
const int SFX_MISS_START = 16;
const int SFX_MISS_END = 18;
const int SFX_FATAL_START = 19;
const int SFX_FATAL_END = 23;
const int SFX_INTRO = 24;
const int SFX_START = 25;
const int SFX_END = 26;
const int SFX_HIGH_SCORE = 27;
const int SFX_HIGH_SCORES = 28;
const int SFX_ABOUT = 29;

void sound_system::init()
{
	_wave_box.Load(_T(".\\sfx\\swing 01.wav")); // 0
	_wave_box.Load(_T(".\\sfx\\swing 02.wav"));
	_wave_box.Load(_T(".\\sfx\\swing 03.wav"));
	_wave_box.Load(_T(".\\sfx\\swing 04.wav"));
	_wave_box.Load(_T(".\\sfx\\swing 05.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 01.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 02.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 03.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 04.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 05.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 06.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 07.wav"));
	_wave_box.Load(_T(".\\sfx\\hit 08.wav"));
	_wave_box.Load(_T(".\\sfx\\slice 01.wav"));
	_wave_box.Load(_T(".\\sfx\\slice 01.wav"));
	_wave_box.Load(_T(".\\sfx\\slice 01.wav")); // 15

	_wave_box.Load(_T(".\\sfx\\block 01.wav")); // 16
	_wave_box.Load(_T(".\\sfx\\block 02.wav"));
	_wave_box.Load(_T(".\\sfx\\block 03.wav")); // 18

	_wave_box.Load(_T(".\\sfx\\fatal 01.wav")); // 19
	_wave_box.Load(_T(".\\sfx\\fatal 02.wav"));
	_wave_box.Load(_T(".\\sfx\\fatal 03.wav"));
	_wave_box.Load(_T(".\\sfx\\fatal 04.wav"));
	_wave_box.Load(_T(".\\sfx\\fatal 05.wav")); // 23

	_wave_box.Load(_T(".\\sfx\\intro.wav")); // 24
	_wave_box.Load(_T(".\\sfx\\start.wav")); // 25
	_wave_box.Load(_T(".\\sfx\\end.wav")); // 26
	_wave_box.Load(_T(".\\sfx\\high score.wav")); // 27
	_wave_box.Load(_T(".\\sfx\\high scores.wav")); // 28
	_wave_box.Load(_T(".\\sfx\\about.wav")); // 29

	_muted = false;
}

void sound_system::mute(bool mute)
{
	_muted = mute;
}

void sound_system::play(int sound_index)
{
	if(!_muted)
		_wave_box.Play(sound_index);
}

void sound_system::play_hit()
{
	play(hf::get_random_number(SFX_HIT_START, SFX_HIT_END));
}

void sound_system::play_miss()
{
	play(hf::get_random_number(SFX_MISS_START, SFX_MISS_END));
}

void sound_system::play_fatal()
{
	play(hf::get_random_number(SFX_FATAL_START, SFX_FATAL_END));
}

void sound_system::play_intro()
{
	play(SFX_INTRO);
}

void sound_system::play_start()
{
	play(SFX_START);
}

void sound_system::play_end()
{
	play(SFX_END);
}

void sound_system::play_high_score()
{
	play(SFX_HIGH_SCORE);
}

void sound_system::play_high_scores()
{
	play(SFX_HIGH_SCORES);
}

void sound_system::play_about()
{
	play(SFX_ABOUT);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions