c1b4301a3c1da4e15e20448078db10c6f9f2a4df
[mancala] / src / sounds.c
1 /*  
2  *  Sounds Routines -- sounds.c
3  *
4  *  Copyright (C) 2009 Reto Zingg
5   *
6  *  This program is free software; you can redistribute it and/or modify it
7  *  under the terms of the GNU General Public License as published by the
8  *  Free Software Foundation; either version 2, or (at your option) any
9  *  later version.
10  *
11  *  This program is distributed in the hope that it will be useful, but
12  *  WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  General Public License for more details, a copy of which may be found in
15  *  the file COPYING provided in the main directory of this release.
16  *
17  */
18
19 #include <stdio.h>
20 #include "SDL.h"
21 #include "SDL_mixer.h"
22
23 int play_sound(Mix_Chunk *chunk){
24         //Play the scratch effect
25         if( Mix_PlayChannel( -1, chunk, 0 ) == -1 )
26         {
27                 fprintf(stderr, "Unable to load sound: %s\n", 
28                          SDL_GetError());
29                 exit(1);
30         }
31         else{
32                 return 0;
33         }
34 }