filename | src/drivers/audio_esd.c |
changeset | 73:0bb57e51ac9e |
prev | 66:2ec5b6eb75e5 |
next | 74:771ee2b1e4f8 |
author | nkeynes |
date | Thu Jan 12 11:30:19 2006 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Render multiple samples per shot, should be mildly faster Move timer logic down into armcore Minor tweaks |
view | annotate | diff | log | raw |
1 /**
2 * $Id: audio_esd.c,v 1.2 2006-01-12 11:30:19 nkeynes Exp $
3 *
4 * The esd (esound) audio driver
5 *
6 * Copyright (c) 2005 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18 #include <esd.h>
19 #include "aica/audio.h"
20 #include "dream.h"
22 int esd_handle = -1;
23 int esd_sample_size = 1;
25 gboolean esd_audio_set_format( uint32_t rate, uint32_t format )
26 {
27 if( esd_handle != -1 ) {
28 esd_close(esd_handle);
29 }
30 esd_format_t esd_format = 0;
31 esd_sample_size = 1;
32 if( format & AUDIO_FMT_16BIT ) {
33 esd_format |= ESD_BITS16;
34 } else esd_format |= ESD_BITS8;
35 if( format & AUDIO_FMT_STEREO ) {
36 esd_format |= ESD_STEREO;
37 }
38 else esd_format |= ESD_MONO;
40 esd_handle = esd_play_stream( esd_format, rate, "localhost", "dreamon" );
41 return TRUE;
42 }
44 gboolean esd_audio_process_buffer( audio_buffer_t buffer )
45 {
46 if( esd_handle != -1 ) {
47 write( esd_handle, buffer->data, buffer->length );
48 DEBUG("Wrote buffer" );
49 } else {
50 ERROR( "ESD not initialized" );
51 }
52 return TRUE;
53 }
55 struct audio_driver esd_audio_driver = { esd_audio_set_format, esd_audio_process_buffer };
.