/***************************************************************************
 *  Columbia University Introduction to Computer Programming in C COMS 1003
 *  Simple Struct Example for a Song
 *
 *  Copyright (C) 2005 Michael E. Locasto
 *
 *  All rights reserved.
 *
 * $Id: song.c,v 1.1 2005/10/14 19:44:31 locasto Exp $
 **************************************************************************/

#include <stdio.h>

/* define an enumerated constant type for the bitrate */
enum rate {LOW = 128, MED = 144, HIGH = 160};

/* Define a template for representing a song. */
struct song
{
   char file_name[256];
   char* song_name;
   int length;
   int bit_rate;
   char data[1000000];
};

/* Create a type alias for 'struct song' as 'song_t' */
typedef struct song song_t;

/* Declare an instance of 'struct song' and set aside storage for it. */
song_t my_song;

/**
 * Demonstrate our class example of using a struct to represent a song
 *
 * 
 */
int main(int argc, char* argv[])
{
   my_song.bit_rate = LOW;
   my_song.song_name = "Hit Me Baby 2 More Xs";

   printf("Title: %s\n", my_song.song_name);
   switch(my_song.bit_rate)
   {
   case LOW:
      printf("Low quality\n");
      break;
   case MED:
      printf("Medium quality\n");
      break;
   case HIGH:
      printf("High quality\n");
      break;
   default:
      printf("Incorrect bitrate setting\n");
      break;
   }

   return 0;
}
