Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem 1) prepare a simple music player with playlist capabilities. You will require to be able to load in “music library” (a song list) of songs on the computer, and then permit the user to create playlist of those songs to play. A playlist is the list of songs which must be played. The order of list determines the order in which the songs must be played. One song file can be on given playlist multiple times.

To implement this functionality you should first create song class to extend the mediaItem class which is included in the supplied source. The mediaItem class has the ability to get and set the location of a .wav (audio) file and then play, pause, and stop that file. Your new class must be a child class (derived class) of mediaItem which extends its functionality to being able to store the artist name and song title with the song.

Ensure to implement your artist name and song title variables as private members of the class with get( ) and set ( ) functions to manipulate them. Add any more functions to your derived class that you see fit. Make it your own. You inherited it.
Next you must create an array or a vector of the new class you have created of length MAX_SONGS.

You will need to read in the text file that describes all the songs we are using (as describeed in the loadSongList function below) into this array. This will be your array representing your music library. You will also need to make the array of integers to store a playlist for the user. The playlist array must be the array of pointers (integers which are the array index of songs) of length MAX_PLAYLIST. These pointers must point to a song in your music library (a song list). This indirection will allow you manipulate the array pointers, while leaving your master music library array as a static structure.

You must implement the following functions in your file to make the program work:

i) bool loadSongList(string filename)

INPUTS: a string containing a path to a file to open. This value is returned from the user's selection in the open file dialog.
OUTPUTS: a boolean indicating whether or not the file could be opened correctly. This function should open a file containing a formatted list of song data. This data should be in the following format:

An integer indicating the total number of songs
An Artist
A song Title
The file's location on disk
(repeat these three the number of times indicated)
So for ex:
2 Beastie Boys
Brass Monkey
./songs/Brass_Monkey.wav Paul Simon
You Can Call Me Al
./songs/Call_Me_Al.wav

Note that each field is delimited by a newline character (\n) there CAN BE WHITESPACE in the fields! You should read all of this data into an array or a vector of song objects you create as described above.

ii) int getNumberOfSongsInSongList( )

INPUTS: NONE
OUTPUTS: An integer indicating the number of songs that are currently loaded into your song object array or vector.

iii) string getSongNameFromSongList(int songNum)

INPUTS: Integer indicating which song object (via its index in your song object array or vector)
OUTPUTS: NONE

This function must return a string in the format of: "Artist - Song Title" which corresponds to the specified song in your song list.

iv) string getSongNameFromPlaylist(int playlistSpot)

INPUTS: An integer indicating which song to return (via its spot in the playlist)
OUTPUTS: NONE

This function must return a string in the format of: "Artist - Song Title" that corresponds to the specified song in your playlist. Note that this is NOT the same thing as getSongNameFromSongList. This function is returning the song data that corresponds to the passed in spot in your playlist. As the playlist is a list of indexes in the array or vector, you will need to follow the index in the designated spot to the actual song requested.

v) void addSongToPlaylist(int songNum)

INPUTS: Integer indicating which song from the song list to add to the playlist
OUTPUTS: NONE

You must add the index to the song from your song list indicated in the argument, to your playlist array or vector.

vi) int getNumberOfSongsInPlaylist()

INPUTS: NONE
OUTPUTS: Return an integer indicating the number of songs currently in the playlist.

vii) void removeSongFromPlaylist(int playlistSpot)

INPUTS: An integer corresponding to which spot in the playlist has a song which requires to be removed
OUTPUTS: NONE

You must remove the song indicated from your playlist. Note: This doesn’t mean delete it from the song list/media library as well. Just the playlist. Again, indirection.

viii) void clearPlaylist()

INPUTS: NONE
OUTPUTS: NONE

You must reset the playlist to empty, i.e., it must be reset to contain no songs.

ix) void moveSongUpInPlaylist(int playlistSpot)

INPUTS: Integer indicating that spot in the playlist has a song which requires to be moved up.
OUTPUTS: NONE

You must swap the song indicated with the spot in the playlist above it (if there is a song above it to swap with).

x) void moveSongDownInPlaylist(int playlistSpot)

INPUTS: Integer indicating that spot in the playlist has a song which requires to be moved down.
OUTPUTS: NONE

You must swap the song indicated with the spot in the playlist below it (if there is a song below it to swap with).

xi) void playSongFromPlaylist(int playlistSpot)

INPUTS: An integer indicating which spot in the playlist has a song which requires to be played.
OUTPUTS: NONE

You must call the playMedia() function that the song specified, inherited from the mediaItem class.

xii) void pauseSongFromPlaylist(int playlistSpot)

INPUTS: An integer indicating which spot in the playlist has a song which requires to be paused.
OUTPUTS: NONE
You must call the pauseMedia() function that the song specified, inherited from mediaItem class.

xiii) void stopSongFromPlaylist(int playlistSpot)

INPUTS: An integer indicating which spot in the playlist has a song that needs to be stopped.
OUTPUTS: NONE

You must call the stopMedia() function that the song specified, inherited from the mediaItem class.

Take note of the globals.h file. You will also notice the variable SHOW_DEBUG_CONSOLE. It may be useful to see output from cout or any other standard I/O function. If you set this variable to true, you will see a console started in addition to the program GUI. You can output things here if you find it helpful.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M95666

Have any Question? 


Related Questions in C/C++

Cs492 programming assignment-the program must be written in

CS492 Programming Assignment- The program must be written in C or C++, and run on a linux machine. ALL source code you submit must be well documented (documentation is an indicator of understanding!) Programs that cannot ...

Computer programming assignment-q1 using for loop write a c

Computer Programming Assignment- Q1. Using for loop, write a C++ program that prints out the multiples of 3 up through 75, separated by a blank space.  3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...

Assignment simple 5-card poker gamein this assignment you

Assignment: Simple 5-Card Poker Game In this assignment, you will develop a simple poker game, complete with basic AI, using the object oriented programming principles discussed in class. Flow of Play Your poker game's p ...

Problem 1overview for problem 1a of this assignment you

Problem #1 Overview: For problem 1(a) of this assignment, you will need a C++ compiler. In order to receive credit, your program must compile and run; and you must provide the actual source code file so that I can compil ...

Only one programwrite a c program to find fibonacci numbers

Only one program Write a C++ Program to Find Fibonacci Numbers using Dynamic Programming.

1 requirementsin this assignment you can unleash your

1. REQUIREMENTS In this assignment, you can unleash your imaginations and use OpenGL with C/C++ programming to produce a scene(s) that represents what you envision could possibly be seen under the sea. Please note that a ...

Write an application that allows the user to enter two

Write an application that allows the user to enter two variables: number (real) and code (character). Calculate the value indicated by the table below: If code is Result A symbol the whole part of the number everything e ...

Objectives- gain experience with if if else and switch

Objectives - Gain experience with if, if else, and switch statements in C programs. - Experience using % operator and true false logic. Hints This program will be MUCH easier if you design how to do the logic in your own ...

1 learner objectivesat the conclusion of this programming

1. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: * Apply repetition structures within an algorithm * Construct while (), for (), or do-while () loops in C * Compose ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate