title: Playing sound file in C with Allegro5
body: <p>I am trying to play wav file in C with allegro5 and I wrote below code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;allegro5/allegro.h&gt;
  #include &lt;allegro5/allegro_audio.h&gt;
  #include &lt;allegro5/allegro_acodec.h&gt;
  
  int main(int argc, char **argv){
  
      ALLEGRO_DISPLAY *display = NULL;
  
  
      if (!al_init()){
          fprintf(stderr, "failed to initialize allegro!\n");
          return -1;
      }
  
      if (!al_install_audio()){
          fprintf(stderr, "failed to initialize audio!\n");
          return -1;
      }
  
      if (!al_init_acodec_addon()){
          fprintf(stderr, "failed to initialize audio codecs!\n");
          return -1;
      }
  
      if (!al_reserve_samples(1)){
          fprintf(stderr, "failed to reserve samples!\n");
          return -1;
      }
  
  
      al_install_audio();
      al_init_acodec_addon();
  
      ALLEGRO_SAMPLE *sample = al_load_sample("bomb.wav"); //sample always NULL
  
      al_reserve_samples(1);
  
      if (!sample){
          printf("Audio clip sample not loaded!\n");
          return -1;
      }
  
      display = al_create_display(640, 480);
  
      if (!display){
          fprintf(stderr, "failed to create display!\n");
          return -1;
      }
  
      /* Loop the sample until the display closes. */
      al_play_sample(sample, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, 0);
  
      al_rest(10.0);
  
      al_destroy_display(display);
      al_destroy_sample(sample);
      return 0;
  }
  </code></pre>
  
  <p>I debuged this in visual studio 2013 and <strong>sample always NULL</strong>.
  I am tried some variety format.</p>
  
  <p>Ex: <code>ALLEGRO_SAMPLE *sample = al_load_sample("\\bomb.wav");</code></p>
  
  <pre><code>ALLEGRO_SAMPLE *sample = al_load_sample("Resource Files\\bomb.wav");
  
  ALLEGRO_SAMPLE *sample = al_load_sample("\\Resource Files\\bomb.wav");
  
  ALLEGRO_SAMPLE *sample = al_load_sample("C:\\bomb.wav");//after copied in C drive
  
  ALLEGRO_SAMPLE *sample = al_load_sample("C:/bomb.wav");
  </code></pre>
  
  <p>and etc.</p>
  
  <p>I am confused. How can I succeed this problem. Thanks in advance. Sorry language.</p>