Skip to content

Commit d8eeb1f

Browse files
committed
Added end-of-level chime
1 parent a5508a7 commit d8eeb1f

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

GameState.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ gamestate_t GameState::update( uint32_t p_time )
706706
/* then it's time to move onto the next one! */
707707
if ( level->get_brick_count() == 0 )
708708
{
709+
output.play_effect_level_complete();
709710
load_level( level->get_level() + 1 );
710711
}
711712

OutputManager.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ OutputManager::OutputManager( void )
4040
}
4141

4242
/* Set up the sound channels. */
43+
blit::channels[CHANNEL_LEVEL].waveforms = blit::Waveform::TRIANGLE | blit::Waveform::SINE | blit::Waveform::SQUARE;
44+
blit::channels[CHANNEL_LEVEL].frequency = 3500;
45+
blit::channels[CHANNEL_LEVEL].volume = 0xffff;
46+
blit::channels[CHANNEL_LEVEL].attack_ms = 32;
47+
blit::channels[CHANNEL_LEVEL].decay_ms = 512;
48+
blit::channels[CHANNEL_LEVEL].sustain = 256;
49+
blit::channels[CHANNEL_LEVEL].release_ms = 128;
50+
4351
blit::channels[CHANNEL_FALLING].waveforms = blit::Waveform::SINE;
4452
blit::channels[CHANNEL_FALLING].frequency = 1000;
4553
blit::channels[CHANNEL_FALLING].volume = 0x3fff;
@@ -239,6 +247,23 @@ void OutputManager::play_effect_falling( uint8_t p_height )
239247
}
240248

241249

250+
/*
251+
* play_effect_level_complete - plays a beep when you clear the level.
252+
*/
253+
254+
void OutputManager::play_effect_level_complete( void )
255+
{
256+
/* Only do this if sound effects are enabled. */
257+
if ( flags.sound_enabled )
258+
{
259+
blit::channels[CHANNEL_LEVEL].trigger_attack();
260+
}
261+
262+
/* All done. */
263+
return;
264+
}
265+
266+
242267
/*
243268
* play_music / stop_music - runs the compiled-in WAV file. These functions
244269
* are pretty much lifted from the ever-talented DaftFreak.

OutputManager.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef struct
2121
} output_flags_t;
2222

2323
#define CHANNEL_MUSIC 0
24+
#define CHANNEL_LEVEL 4
2425
#define CHANNEL_FALLING 5
2526
#define CHANNEL_PICKUP 6
2627
#define CHANNEL_BOUNCE 7
@@ -47,6 +48,7 @@ class OutputManager
4748
void play_effect_bounce( uint16_t );
4849
void play_effect_pickup( void );
4950
void play_effect_falling( uint8_t );
51+
void play_effect_level_complete( void );
5052
};
5153

5254

0 commit comments

Comments
 (0)