Advertisement
rakoczyn

WAVE Player

Jun 7th, 2011
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <Windows.h>
  4. #include <mmsystem.h>
  5. #pragma comment( lib, "winmm.lib" )
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. class Player
  11. {
  12.  
  13. private:
  14.         string PLIK;
  15.  
  16. public:
  17.  
  18.     void ladujPlik(string sciezka)
  19.     {
  20.         this->PLIK = sciezka;
  21.     }
  22.  
  23.     void Play()
  24.     {
  25.         sndPlaySound(PLIK.c_str(),SND_SYNC);
  26.     }
  27.  
  28.     void Stop()
  29.     {
  30.         sndPlaySound(NULL,SND_SYNC);
  31.     }
  32. };
  33.  
  34. int main()
  35. {
  36.     bool dalej = true;
  37.     char x = 'n';
  38.     Player cPlayer;
  39.  
  40.     string sciezka;
  41.  
  42.     while (dalej)
  43.     {
  44.         cout << endl << "Podaj sciezke do pliku: >";
  45.         cin >> sciezka;
  46.  
  47.         cPlayer.ladujPlik(sciezka);
  48.  
  49.  
  50.         cPlayer.Play();
  51.    
  52.         cout << "Odtwarzanie zakonczone. Jeszcze raz? (t/n)";
  53.    
  54.        
  55.         getchar();
  56.         x = getchar();
  57.  
  58.         if (toupper(x) == 'N') dalej = false;
  59.         else dalej = true;
  60.     }
  61.  
  62.     cout << "Koniec pracy programu. Nacisnij dowolny klawisz...";
  63.    
  64.     getchar();
  65.     getchar();
  66.    
  67.  
  68.  
  69.  
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement