22f08d95 |
1 | /* FCE Ultra - NES/Famicom Emulator |
2 | * |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 | */ |
17 | |
18 | #include <stdio.h> |
19 | #include <string.h> |
20 | #include <stdlib.h> |
21 | #include <sys/time.h> |
22 | #include <unistd.h> |
23 | #include <sys/ioctl.h> |
24 | #include <linux/soundcard.h> |
25 | |
26 | #include "gp2x.h" |
27 | #include "minimal.h" |
28 | #include "throttle.h" |
29 | |
30 | |
31 | extern int soundvol; |
32 | extern unsigned long gp2x_dev[8]; |
33 | |
34 | // always have this call |
35 | INLINE void gp2x_sound_frame(void *blah, void *buff, int samples) |
36 | { |
37 | } |
38 | |
39 | void WriteSound(int16 *Buffer, int Count) |
40 | { |
41 | write(gp2x_dev[3], Buffer, Count<<1); |
42 | SpeedThrottle(); |
43 | } |
44 | |
45 | void* gp2x_write_sound(void* blah) |
46 | { |
47 | return NULL; |
48 | } |
49 | |
50 | void SilenceSound(int n) |
51 | { |
52 | soundvol=0; |
53 | } |
54 | |
55 | int InitSound(FCEUGI *gi) |
56 | { |
57 | Settings.sound=22050; |
58 | FCEUI_Sound(Settings.sound); |
59 | gp2x_sound_volume(soundvol, soundvol); |
60 | printf("InitSound() sound_rate: %d\n", Settings.sound); |
61 | return 1; |
62 | } |
63 | |
64 | uint32 GetMaxSound(void) |
65 | { |
66 | return(4096); |
67 | } |
68 | |
69 | uint32 GetWriteSound(void) |
70 | { |
71 | return 1024; |
72 | } |
73 | |
74 | int KillSound(void) |
75 | { |
76 | FCEUI_Sound(0); |
77 | |
78 | return 1; |
79 | } |
80 | |