Guest User

Untitled

a guest
Oct 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. sf::Buffer Buffer;
  2. Buffer.loadFromFile("sound.wav");
  3. const sf::Int16 *raw = Buffer.getSamples();
  4.  
  5. byte *load()
  6. {
  7. FILE *fp;
  8. if((fp=fopen("sound.wav", "rb"))==NULL) {
  9. printf("Ошибка при открытии файла.n");
  10. }
  11. fseek(fp, 0, SEEK_END);
  12. long N = ftell(fp);
  13. fseek(fp, 0, SEEK_SET);
  14. byte *A = new byte[N];
  15. for(i=0; i<N; i++)
  16. if(fread(A[i],
  17. sizeof(A), 1, fp)!=1) {
  18. if(feof(fp)) break;
  19. printf("Ошибка при чтении файла.n");
  20. }
  21.  
  22. fclose(fp);
  23. return A;
  24. }
  25.  
  26. byte *input = load();
Add Comment
Please, Sign In to add comment