All pastes #1837938 Raw Edit

Star Wars Intro Song

public text v1 · immutable
#1837938 ·published 2010-03-13 21:48 UTC
rendered paste body
// Star Wars Intro 

#define WIN32_LEAN_AND_MEAN
#include <windows.h>



typedef struct {
	const int frequency;
	const int duration;
} snds_t;


snds_t swintro[] = 
{
	{ 293,  139 },
	{ 293,  139 },
	{ 293,  139 },
	{ 391,  834 },
	{ 587,  834 },
	{ 523,  139 },
	{ 493,  139 },
	{ 440,  139 },
	{ 783,  834 },
	{ 587,  417 },
	{ 523,  139 },
	{ 493,  139 },
	{ 440,  139 },
	{ 783,  834 },
	{ 587,  417 },
	{ 523,  139 },
	{ 493,  139 },
	{ 523,  139 },
	{ 440,  834 },
	{ 293,  139 },
}; 

const static int len_swintro = 
	sizeof( swintro ) / sizeof( swintro[0] );


void PlaySequence( snds_t *seqtbl, int numofsnds )
{
	int i;
	snds_t *p = &seqtbl[0];
	for( i = 0; i < numofsnds; p = &seqtbl[++i] )
		Beep( p->frequency, p->duration );
}


int main(int argc, char* argv[])
{
	PlaySequence( swintro, len_swintro );
	return 0;
}