song.h

00001 /*
00002 
00003   song.h
00004   
00005   Nicolas Williamson - July 2009
00006   
00007 */
00008 
00009 #ifndef __H_SONG__
00010 #define __H_SONG__
00011 
00015 typedef struct song_note{
00016   unsigned int length; 
00017   unsigned int duration; 
00018   unsigned int frequency; 
00019 } SONG_NOTE;
00020 
00024 typedef enum song_states{
00025   SONG_PLAY = 0, 
00026   SONG_STOP, 
00027   SONG_PAUSE, 
00028   SONG_FAST_FORWARD 
00029 } SONG_STATE;
00030 
00031 #define NOTE_A4 440
00032 #define NOTE_As4 466
00033 #define NOTE_Bb4 466
00034 #define NOTE_B4 494
00035 #define NOTE_C4 523
00036 #define NOTE_Cs4 554
00037 #define NOTE_Db4 554
00038 #define NOTE_D4 587
00039 #define NOTE_Ds4 622
00040 #define NOTE_Eb4 622
00041 #define NOTE_E4 659
00042 #define NOTE_F4 698
00043 #define NOTE_Fs4 740
00044 #define NOTE_Gb4 740
00045 #define NOTE_G4 784
00046 #define NOTE_Gs4 830
00047 #define NOTE_Ab5 830
00048 #define NOTE_A5 880
00049 #define NOTE_As5 932
00050 #define NOTE_Bb5 932
00051 #define NOTE_B5 988
00052 #define NOTE_C5 1046
00053 #define NOTE_Cs5 1108
00054 #define NOTE_Db5 1108
00055 #define NOTE_D5 1175
00056 #define NOTE_Ds5 1244
00057 #define NOTE_Eb5 1244
00058 #define NOTE_E5 1318
00059 #define NOTE_F5 1397
00060 #define NOTE_Fs5 1480
00061 #define NOTE_Gb5 1480
00062 #define NOTE_G5 1568
00063 #define NOTE_Gs5 1661
00064 #define NOTE_Ab6 1661
00065 #define NOTE_A6 1760
00066 #define NOTE_C6 2093
00067 
00068 #define NOTE_WHOLE (1600) //length of whole note, ms
00069 #define NOTE_EIGHTH (NOTE_WHOLE/8)
00070 #define NOTE_QUARTER (NOTE_WHOLE/4)
00071 #define NOTE_HALF (NOTE_WHOLE/2)
00072 #define NOTE_THIRD (NOTE_WHOLE/3)
00073 #define NOTE_SIXTH (NOTE_WHOLE/6)
00074 #define NOTE_DOTTED (3*NOTE_EIGHTH)
00075 
00076 //functions
00077 void song_set(SONG_NOTE* song, unsigned int length);
00078 void song_play(void);
00079 void song_stop(void);
00080 void song_pause(void);
00081 void song_update(void);
00082 void song_fast_forward(void);
00083 
00084 #endif
Generated on Tue Jun 29 16:36:14 2010 by  doxygen 1.6.3