diff options
author | Dan Everton <dan@iocaine.org> | 2006-08-12 10:28:30 +0000 |
---|---|---|
committer | Dan Everton <dan@iocaine.org> | 2006-08-12 10:28:30 +0000 |
commit | 9d2929b79b22765701e9db240d967877d7f7bab8 (patch) | |
tree | 0829913b3e58ce5d1886358395d42c5cee80ce6c /uisimulator/x11/oss_sound.c | |
parent | 509ee3d42cfe0660a107ae169a11cef9c0604b1f (diff) | |
download | rockbox-9d2929b79b22765701e9db240d967877d7f7bab8.tar.gz rockbox-9d2929b79b22765701e9db240d967877d7f7bab8.zip |
Remove Win32 and X11 simulator sources. They've been deprecated for a while in favour of the SDL sim. Time to go.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10543 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11/oss_sound.c')
-rw-r--r-- | uisimulator/x11/oss_sound.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/uisimulator/x11/oss_sound.c b/uisimulator/x11/oss_sound.c deleted file mode 100644 index 51d85470e7..0000000000 --- a/uisimulator/x11/oss_sound.c +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2002 Dave Chapman | ||
10 | * | ||
11 | * oss_sound - a sound driver for Linux (and others?) OSS audio | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include <fcntl.h> | ||
23 | |||
24 | #include <sys/soundcard.h> | ||
25 | #include "../common/sound.h" | ||
26 | |||
27 | /* We want to use the "real" open in this file */ | ||
28 | #undef open | ||
29 | |||
30 | int init_sound(sound_t* sound) { | ||
31 | sound->fd=open("/dev/dsp", O_WRONLY); | ||
32 | sound->freq=-1; | ||
33 | sound->channels=-1; | ||
34 | |||
35 | if (sound->fd <= 0) { | ||
36 | fprintf(stderr,"Can not open /dev/dsp - simulating sound output\n"); | ||
37 | sound->fd=0; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | int config_sound(sound_t* sound, int sound_freq, int channels) { | ||
42 | int format=AFMT_S16_NE; | ||
43 | int setting=0x000C000D; // 12 fragments size 8kb ? WHAT IS THIS? | ||
44 | |||
45 | sound->freq=sound_freq; | ||
46 | sound->channels=channels; | ||
47 | |||
48 | if (sound->fd) { | ||
49 | if (ioctl(sound->fd,SNDCTL_DSP_SETFRAGMENT,&setting)==-1) { | ||
50 | perror("SNDCTL_DSP_SETFRAGMENT"); | ||
51 | } | ||
52 | |||
53 | if (ioctl(sound->fd,SNDCTL_DSP_CHANNELS,&channels)==-1) { | ||
54 | perror("SNDCTL_DSP_STEREO"); | ||
55 | } | ||
56 | if (channels==0) { fprintf(stderr,"Warning, only mono supported\n"); } | ||
57 | |||
58 | if (ioctl(sound->fd,SNDCTL_DSP_SETFMT,&format)==-1) { | ||
59 | perror("SNDCTL_DSP_SETFMT"); | ||
60 | } | ||
61 | |||
62 | if (ioctl(sound->fd,SNDCTL_DSP_SPEED,&sound_freq)==-1) { | ||
63 | perror("SNDCTL_DSP_SPEED"); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | int output_sound(sound_t* sound,const void* buf, int count) { | ||
69 | unsigned long long t; | ||
70 | |||
71 | if (sound->fd) { | ||
72 | return(write(sound->fd,buf,count)); | ||
73 | } else { | ||
74 | t=(unsigned int)(((unsigned int)(1000000/sound->channels)*count)/sound->freq); | ||
75 | // fprintf(stderr,"writing %d bytes at %d frequency - sleeping for %u microseconds\n",count,sound->freq,t); | ||
76 | usleep(t); | ||
77 | return(count); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | void close_sound(sound_t* sound) { | ||
82 | if (sound->fd) close(sound->fd); | ||
83 | sound->fd=-1; | ||
84 | } | ||