title: Streaming audio using libspotifydotnet (Spotify - libspotify)
body: <p>After checking out <a href="https://stackoverflow.com/questions/11452236/how-to-play-a-spotify-music-stream">this</a>, <a href="https://stackoverflow.com/questions/6732465/playing-streamed-audio-data-c?rq=1">this</a>, and <a href="https://stackoverflow.com/questions/13223372/libspotify-playing-problems">this</a> post, I understand that I have to <code>stream</code> audio using something like <code>NAudio</code> and also that playing a song is done by:</p>
  
  <pre><code>libspotify.sp_session_player_load(_sessionPtr, trackPtr);
  libspotify.sp_session_player_play(_sessionPtr, true);
  </code></pre>
  
  <p>Now, if I understood correctly, I am receiving the <code>stream</code> as raw PCM data. How can I access that data? </p>
  
  <p>According to the documentation, I see that that I have to populate <code>libspotify.sp_audioformat</code></p>
  
  <p>How do I do this exactly? and from where? </p>
  
  <p>I was checking out <a href="https://spotifyforjamcast.codeplex.com/" rel="nofollow noreferrer">this</a> project (Jamcast), and they do something like:</p>
  
  <pre><code>libspotify.sp_audioformat format = (libspotify.sp_audioformat)Marshal.PtrToStructure(formatPtr, typeof(libspotify.sp_audioformat));
  </code></pre>
  
  <p>Could someone point me in the right direction?
  I am completely lost on how to retrieve the <code>stream</code></p>