1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <sys/ioctl.h>
28 #include <linux/soundcard.h>
35 extern void pthread_yield(void);
36 extern void FCEUI_FrameSkip(int x);
41 // always have this call
42 INLINE void gp2x_sound_frame(void *blah, void *buff, int samples)
50 //static int sexy_in_function=0;
51 #define NumSexyBufferBuffers 2
52 struct timespec gp2x_sleep_ts;
55 struct timeval sleeptimer;
59 pthread_t gp2x_sexy_sound_thread=0;
60 int** SexyBufferBuffers=NULL;
61 int SexyBufferBufferCounts[NumSexyBufferBuffers];
62 int gp2x_sound_inited=0;
63 int gp2x_in_sound_thread=0;
64 extern unsigned long gp2x_dev[8];
66 pthread_cond_t gp2x_sound_cond=PTHREAD_COND_INITIALIZER;
67 pthread_mutex_t gp2x_sound_mutex = PTHREAD_MUTEX_INITIALIZER;
68 int zzdebug01_entry=0;
71 extern unsigned long fps;
72 extern unsigned long avg_fps;
73 extern unsigned long ticks;
77 void WriteSound(int32 *Buffer, int Count)
79 write(gp2x_dev[3], Buffer, Count<<1);
84 void* gp2x_write_sound(void* blah)
86 gp2x_in_sound_thread=1;
97 gp2x_in_sound_thread=0;
101 void SilenceSound(int n)
106 int InitSound(FCEUGI *gi)
108 Settings.sound=22050;
109 FCEUI_Sound(Settings.sound);
110 gp2x_sound_volume(soundvol, soundvol);
111 printf("InitSound() sound_rate: %d\n", Settings.sound);
120 uint32 GetMaxSound(void)
125 uint32 GetWriteSound(void)