Locked Home » Forums » Legacy & Archived » Archived Content » Star Wars Galaxies » SWG Premium Discussions

Was bored... : SWG Premium Discussions

Posted: August 31st, 2011
User avatar
Total Posts:261 Joined:2008
So i made the star wars theme song via computer beeps :)

Code: Register to unlock hidden link

// Star Wars Intro For Trainers
// (Requires Internal System Speaker)
//
// File: C_SWIntro.c
// Author: Evilfigment

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.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[])
{
	printf("Attempting to play the Star Wars theme song..\n");
	printf("(Make sure you have an internal system speaker)\n");

	PlaySequence( swintro, len_swintro );

	printf("\n\nFinished..\nPRESS..ENTER..TO EXIT");
	getchar();

	return 0;
}



Attachments:
C_SWIntro.zip Register to unlock hidden link
(12.88 KiB) Downloaded 7 times
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 6 guests