title: SDL_LoadWAV not loading file
body: <p>I want to load a wav file and play it with the following code:</p>
  
  <pre><code>if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) &lt; 0) {
      std::cerr &lt;&lt; "Could not init SDL:" &lt;&lt; SDL_GetError() &lt;&lt; '\n';
  }
  SDL_AudioSpec wavSpec;
  Uint32 wavLength;
  Uint8 *wavBuffer;
  
  if(SDL_LoadWAV("sound.wav", &amp;wavSpec, &amp;wavBuffer, &amp;wavLength) == NULL) {
      std::cerr &lt;&lt; "Could not load wave:" &lt;&lt; SDL_GetError() &lt;&lt; '\n';
      return;
  }
  
  SDL_AudioDeviceID deviceId = SDL_OpenAudioDevice(NULL, 0, &amp;wavSpec, NULL, 0);
  
  int success = SDL_QueueAudio(deviceId, wavBuffer, wavLength);
  SDL_PauseAudioDevice(deviceId, 0);
  
  SDL_CloseAudioDevice(deviceId);
  SDL_FreeWAV(wavBuffer);
  SDL_Quit();
  </code></pre>
  
  <p>However <code>SDL_LoadWav</code> returns <code>NULL</code>.
  <code>SDL_GetError</code> just returns:</p>
  
  <pre><code>Couldn't open sounds.wav
  </code></pre>
  
  <p>I already checked that the file exists but still no luck. Is there anything wrong with the code?</p>
  
  <p>For debug purpose i also tryed to open the wav with <code>ifstream</code> like this:</p>
  
  <pre><code>std::ifstream ifs{"hitBrick.wav"};
  if(!ifs) {
      std::cerr &lt;&lt; "cannot open plattform fstream \n";
  }
  </code></pre>
  
  <p>and here it works no error.</p>
  
  <p>What could be the issue?</p>
  
  <p>EDIT:</p>
  
  <p>I could find the reason for the wav not getting loaded by <code>SDL_LoadWAV</code>.</p>
  
  <p>According to the docu of SDL_LoadWav only supported wave formats are
  <code>MS-ADPCM</code> and <code>IMA-ADPCM</code>.</p>
  
  <p>But my file is PCM format. So I converted the files under linux with the tool SOX: <a href="https://wiki.ubuntuusers.de/SoX/" rel="nofollow noreferrer">https://wiki.ubuntuusers.de/SoX/</a></p>
  
  <p>Now I don't get any errors but also I don't hear any sounds. What could be that issue?</p>