All pastes #261202 Raw Edit

Anonymous

public text v1 · immutable
#261202 ·published 2006-11-29 00:40 UTC
rendered paste body
/* ========================================================================== */
/*                                                                            */
/*   main.cpp                                                                 */
/*   wildinc (c) 2006 Author                                                  */
/*                                                                            */
/*   Description                                                              */
/* simple media cente                                                         */
/* ========================================================================== */
#include <iostream>
#include <conio.h>
#include "audiere.h"
using namespace audiere;
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Wildinc's music player"<<endl;
cout<<"----------------------";
cout<<endl<<endl<<endl;
cout<<endl<<"This Music Player is Wriiten in C++ and "<<endl;
cout<<"uses the Aduiere API and classes.This Music  "<<endl;
cout<<"Player is capable of playing a lot of file formats";
cout<<endl<<"including .MP3 , .WAV ."<<endl<<endl;
cout<<"If you have any questions of suggestions"<<endl;
cout<<"Email me at wildrj@inbox.com"<<endl<<endl;
cout<<"For help press 'h'"<<endl;
cout<<"-----------------------------------------------------"<<endl;
char musicfilename[100];
cout<<endl<<"Enter the filename to play (with path)"<<endl;
cin.getline(musicfilename,100);

AudioDevicePtr device(OpenDevice());
OutputStreamPtr sound(OpenSound(device,musicfilename, false));

    float volume = 0.1;
    while(volume<=1.0)
 {
    sound->setVolume(volume);
    sound->play();
    sound->setRepeat(true);
    char input=getch();
    if(input=='i')
        volume=volume+0.1;
          if(input=='d')
            volume=volume-0.1;
               if(input=='m')
                 volume=0.0;
                   if(input=='r')
                     sound->reset();
                         if (volume > 1.0)
                                 volume=1.0;
                             if (volume < 0.0)
                                        volume=0.0;
                               if(input == 'c')
                               {
                               sound->stop();
                               cout<<"Enter new file path"<<endl;
                           cin.getline(musicfilename,100);
                               OutputStreamPtr sound(OpenSound(device,musicfilename, false ));
                          sound->setVolume(volume);
                          sound->reset();
                          sound->play();
                          sound->setRepeat(true);
    
                               
                               if(input == 'h')
                               {
                                        cout<<"To increase volume press 'i'"<<endl;
                                        cout<<"To decrease voulme press 'd'"<<endl;
                                        cout<<"To restart the song press 'r'"<<endl;
                                        cout<<"To change the song press 'c'"<<endl;
                                        }
} 
}
    return 0;
}