Changeset ea6c838 in mainline
- Timestamp:
- 2012-07-17T08:26:49Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e6bba8f
- Parents:
- 950110ee
- Location:
- uspace
- Files:
-
- 1 added
- 28 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/Makefile ¶
r950110ee rea6c838 206 206 lib/usbhid \ 207 207 lib/usbvirt \ 208 lib/pcm \ 208 209 lib/posix 209 210 -
TabularUnified uspace/Makefile.common ¶
r950110ee rea6c838 124 124 LIBDRV_PREFIX = $(LIB_PREFIX)/drv 125 125 LIBHOUND_PREFIX = $(LIB_PREFIX)/hound 126 LIBPCM_PREFIX = $(LIB_PREFIX)/pcm 126 127 LIBNET_PREFIX = $(LIB_PREFIX)/net 127 128 LIBNIC_PREFIX = $(LIB_PREFIX)/nic -
TabularUnified uspace/app/dplay/Makefile ¶
r950110ee rea6c838 34 34 35 35 EXTRA_CFLAGS = \ 36 -I$(LIBDRV_PREFIX)/include 36 -I$(LIBDRV_PREFIX)/include -I$(LIBPCM_PREFIX)/include 37 37 38 38 SOURCES = \ -
TabularUnified uspace/app/dplay/wave.h ¶
r950110ee rea6c838 37 37 #include <stdint.h> 38 38 #include <bool.h> 39 #include <pcm _sample_format.h>39 #include <pcm/sample_format.h> 40 40 41 41 /** Wave file header format. -
TabularUnified uspace/app/drec/Makefile ¶
r950110ee rea6c838 34 34 35 35 EXTRA_CFLAGS = \ 36 -I$(LIBDRV_PREFIX)/include 36 -I$(LIBDRV_PREFIX)/include -I$(LIBPCM_PREFIX)/include 37 37 38 38 SOURCES = \ -
TabularUnified uspace/app/drec/drec.c ¶
r950110ee rea6c838 47 47 #include <stdio.h> 48 48 #include <macros.h> 49 #include <pcm _sample_format.h>49 #include <pcm/sample_format.h> 50 50 51 51 #include "wave.h" -
TabularUnified uspace/app/drec/wave.h ¶
r950110ee rea6c838 36 36 37 37 #include <stdint.h> 38 #include <bool.h> 39 #include <pcm_sample_format.h> 38 #include <pcm/sample_format.h> 40 39 41 40 /** Wave file header format. -
TabularUnified uspace/app/wavplay/Makefile ¶
r950110ee rea6c838 34 34 35 35 EXTRA_CFLAGS = \ 36 -I $(LIBHOUND_PREFIX)/include36 -I$(LIBHOUND_PREFIX)/include -I$(LIBPCM_PREFIX)/include 37 37 38 38 SOURCES = \ -
TabularUnified uspace/app/wavplay/wave.h ¶
r950110ee rea6c838 36 36 37 37 #include <stdint.h> 38 #include <bool.h> 39 #include <pcm_sample_format.h> 38 #include <pcm/sample_format.h> 40 39 41 40 /** Wave file header format. -
TabularUnified uspace/app/wavplay/wavplay.c ¶
r950110ee rea6c838 39 39 #include <str_error.h> 40 40 #include <stdio.h> 41 42 41 #include <hound/client.h> 43 44 #include <pcm_sample_format.h> 45 46 #include <stdio.h> 42 #include <pcm/sample_format.h> 47 43 48 44 #include "wave.h" -
TabularUnified uspace/drv/audio/sb16/Makefile ¶
r950110ee rea6c838 33 33 34 34 EXTRA_CFLAGS += \ 35 -I$(LIBDRV_PREFIX)/include 35 -I$(LIBDRV_PREFIX)/include -I$(LIBPCM_PREFIX)/include 36 36 37 37 BINARY = sb16 -
TabularUnified uspace/drv/audio/sb16/dsp.h ¶
r950110ee rea6c838 38 38 #include <libarch/ddi.h> 39 39 #include <errno.h> 40 #include <pcm _sample_format.h>40 #include <pcm/sample_format.h> 41 41 42 42 #include "registers.h" -
TabularUnified uspace/drv/audio/sb16/pcm_iface.c ¶
r950110ee rea6c838 36 36 #include <errno.h> 37 37 #include <audio_pcm_iface.h> 38 #include <pcm _sample_format.h>38 #include <pcm/sample_format.h> 39 39 40 40 #include "dsp.h" -
TabularUnified uspace/lib/drv/Makefile ¶
r950110ee rea6c838 29 29 30 30 USPACE_PREFIX = ../.. 31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include 31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include -I$(LIBPCM_PREFIX)/include 32 32 LIBRARY = libdrv 33 33 -
TabularUnified uspace/lib/drv/include/audio_pcm_iface.h ¶
r950110ee rea6c838 40 40 #include <bool.h> 41 41 #include <loc.h> 42 #include <pcm _sample_format.h>42 #include <pcm/sample_format.h> 43 43 44 44 #include "ddf/driver.h" -
TabularUnified uspace/lib/hound/Makefile ¶
r950110ee rea6c838 28 28 29 29 USPACE_PREFIX = ../.. 30 EXTRA_CFLAGS = -Iinclude/hound 30 EXTRA_CFLAGS = -Iinclude/hound -I$(LIBPCM_PREFIX)/include 31 31 LIBRARY = libhound 32 32 -
TabularUnified uspace/lib/hound/include/hound/client.h ¶
r950110ee rea6c838 39 39 #include <async.h> 40 40 #include <bool.h> 41 #include <pcm _sample_format.h>41 #include <pcm/sample_format.h> 42 42 43 43 #define DEFAULT_SINK "default" -
TabularUnified uspace/lib/hound/include/hound/server.h ¶
r950110ee rea6c838 40 40 #include <bool.h> 41 41 #include <loc.h> 42 #include <pcm _sample_format.h>42 #include <pcm/sample_format.h> 43 43 44 44 enum { -
TabularUnified uspace/lib/pcm/include/pcm/format.h ¶
r950110ee rea6c838 34 34 */ 35 35 36 #ifndef AUDIO_FORMAT_H_37 #define AUDIO_FORMAT_H_36 #ifndef PCM_FORMAT_H_ 37 #define PCM_FORMAT_H_ 38 38 39 39 #include <assert.h> 40 40 #include <bool.h> 41 #include <pcm_sample_format.h> 42 41 #include <pcm/sample_format.h> 43 42 44 43 typedef struct { … … 46 45 unsigned sampling_rate; 47 46 pcm_sample_format_t sample_format; 48 } audio_format_t;47 } pcm_format_t; 49 48 50 static const audio_format_t AUDIO_FORMAT_DEFAULT = {49 static const pcm_format_t AUDIO_FORMAT_DEFAULT = { 51 50 .channels = 2, 52 51 .sampling_rate = 44100, … … 54 53 }; 55 54 56 static const audio_format_t AUDIO_FORMAT_ANY = {55 static const pcm_format_t AUDIO_FORMAT_ANY = { 57 56 .channels = 0, 58 57 .sampling_rate = 0, … … 60 59 }; 61 60 62 63 static inline size_t audio_format_frame_size(const audio_format_t *a) 61 static inline size_t pcm_format_frame_size(const pcm_format_t *a) 64 62 { 65 63 return a->channels * pcm_sample_format_size(a->sample_format); 66 64 } 67 65 68 bool audio_format_same(const audio_format_t *a, const audio_format_t* b);69 static inline bool audio_format_is_any(const audio_format_t *f)66 bool pcm_format_same(const pcm_format_t *a, const pcm_format_t* b); 67 static inline bool pcm_format_is_any(const pcm_format_t *f) 70 68 { 71 return audio_format_same(f, &AUDIO_FORMAT_ANY);69 return pcm_format_same(f, &AUDIO_FORMAT_ANY); 72 70 } 73 int audio_format_convert_and_mix(void *dst, size_t dst_size, const void *src,74 size_t src_size, const audio_format_t *sf, const audio_format_t *df);75 int audio_format_mix(void *dst, const void *src, size_t size, const audio_format_t *f);76 int audio_format_convert(audio_format_t a, void* srca, size_t sizea,77 audio_format_t b, void* srcb, size_t *sizeb);71 int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src, 72 size_t src_size, const pcm_format_t *sf, const pcm_format_t *df); 73 int pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f); 74 int pcm_format_convert(pcm_format_t a, void* srca, size_t sizea, 75 pcm_format_t b, void* srcb, size_t *sizeb); 78 76 79 77 #endif -
TabularUnified uspace/lib/pcm/src/format.c ¶
r950110ee rea6c838 40 40 #include <stdio.h> 41 41 42 #include " audio_format.h"42 #include "format.h" 43 43 44 44 #define uint8_t_le2host(x) (x) … … 76 76 77 77 static float get_normalized_sample(const void *buffer, size_t size, 78 unsigned frame, unsigned channel, const audio_format_t *f);79 80 bool audio_format_same(const audio_format_t *a, const audio_format_t* b)78 unsigned frame, unsigned channel, const pcm_format_t *f); 79 80 bool pcm_format_same(const pcm_format_t *a, const pcm_format_t* b) 81 81 { 82 82 assert(a); … … 88 88 } 89 89 90 int audio_format_mix(void *dst, const void *src, size_t size, const audio_format_t *f)91 { 92 return audio_format_convert_and_mix(dst, size, src, size, f, f);93 } 94 int audio_format_convert_and_mix(void *dst, size_t dst_size, const void *src,95 size_t src_size, const audio_format_t *sf, const audio_format_t *df)90 int pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f) 91 { 92 return pcm_format_convert_and_mix(dst, size, src, size, f, f); 93 } 94 int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src, 95 size_t src_size, const pcm_format_t *sf, const pcm_format_t *df) 96 96 { 97 97 if (!dst || !src || !sf || !df) 98 98 return EINVAL; 99 const size_t src_frame_size = audio_format_frame_size(sf);99 const size_t src_frame_size = pcm_format_frame_size(sf); 100 100 if ((src_size % src_frame_size) != 0) 101 101 return EINVAL; 102 102 103 const size_t dst_frame_size = audio_format_frame_size(df);103 const size_t dst_frame_size = pcm_format_frame_size(df); 104 104 if ((src_size % dst_frame_size) != 0) 105 105 return EINVAL; … … 170 170 /** Converts all sample formats to float <-1,1> */ 171 171 static float get_normalized_sample(const void *buffer, size_t size, 172 unsigned frame, unsigned channel, const audio_format_t *f)172 unsigned frame, unsigned channel, const pcm_format_t *f) 173 173 { 174 174 assert(f); -
TabularUnified uspace/srv/audio/hound/Makefile ¶
r950110ee rea6c838 33 33 -DNAME="\"hound\"" \ 34 34 -I$(LIBDRV_PREFIX)/include \ 35 -I$(LIBHOUND_PREFIX)/include 35 -I$(LIBHOUND_PREFIX)/include \ 36 -I$(LIBPCM_PREFIX)/include 36 37 37 38 LIBS = \ 38 39 $(LIBDRV_PREFIX)/libdrv.a \ 39 $(LIBHOUND_PREFIX)/libhound.a 40 $(LIBHOUND_PREFIX)/libhound.a \ 41 $(LIBPCM_PREFIX)/libpcm.a 40 42 41 43 SOURCES = \ 42 44 audio_client.c \ 43 45 audio_device.c \ 44 audio_format.c \45 46 audio_sink.c \ 46 47 audio_source.c \ -
TabularUnified uspace/srv/audio/hound/audio_client.c ¶
r950110ee rea6c838 43 43 44 44 static void init_common(audio_client_t *client, const char *name, 45 const audio_format_t *f, async_sess_t *sess)45 const pcm_format_t *f, async_sess_t *sess) 46 46 { 47 47 link_initialize(&client->link); … … 60 60 61 61 audio_client_t *audio_client_get_playback( 62 const char *name, const audio_format_t *f, async_sess_t *sess)62 const char *name, const pcm_format_t *f, async_sess_t *sess) 63 63 { 64 64 audio_client_t *client = malloc(sizeof(audio_client_t)); … … 73 73 74 74 audio_client_t *audio_client_get_recording( 75 const char *name, const audio_format_t *f, async_sess_t *sess)75 const char *name, const pcm_format_t *f, async_sess_t *sess) 76 76 { 77 77 audio_client_t *client = malloc(sizeof(audio_client_t)); -
TabularUnified uspace/srv/audio/hound/audio_client.h ¶
r950110ee rea6c838 39 39 #include <adt/list.h> 40 40 #include <async.h> 41 #include <pcm/format.h> 41 42 42 #include "audio_format.h"43 43 #include "audio_source.h" 44 44 #include "audio_sink.h" … … 49 49 audio_source_t source; 50 50 audio_sink_t sink; 51 audio_format_t format;51 pcm_format_t format; 52 52 async_sess_t *sess; 53 53 async_exch_t *exch; … … 62 62 63 63 audio_client_t *audio_client_get_playback( 64 const char *name, const audio_format_t *f, async_sess_t *sess);64 const char *name, const pcm_format_t *f, async_sess_t *sess); 65 65 audio_client_t *audio_client_get_recording( 66 const char *name, const audio_format_t *f, async_sess_t *sess);66 const char *name, const pcm_format_t *f, async_sess_t *sess); 67 67 void audio_client_destroy(audio_client_t *client); 68 68 -
TabularUnified uspace/srv/audio/hound/audio_device.c ¶
r950110ee rea6c838 109 109 110 110 const unsigned frames = dev->buffer.size / 111 (BUFFER_PARTS * audio_format_frame_size(&dev->sink.format));111 (BUFFER_PARTS * pcm_format_frame_size(&dev->sink.format)); 112 112 ret = audio_pcm_start_playback(dev->sess, frames, 113 113 dev->sink.format.channels, dev->sink.format.sampling_rate, … … 152 152 } 153 153 const unsigned frames = dev->buffer.size / 154 (BUFFER_PARTS * audio_format_frame_size(&dev->sink.format));154 (BUFFER_PARTS * pcm_format_frame_size(&dev->sink.format)); 155 155 ret = audio_pcm_start_record(dev->sess, frames, 156 156 dev->sink.format.channels, dev->sink.format.sampling_rate, -
TabularUnified uspace/srv/audio/hound/audio_sink.c ¶
r950110ee rea6c838 46 46 int audio_sink_init(audio_sink_t *sink, const char *name, 47 47 void *private_data, int (*connection_change)(audio_sink_t *, bool), 48 int (*check_format)(audio_sink_t *sink), const audio_format_t *f)48 int (*check_format)(audio_sink_t *sink), const pcm_format_t *f) 49 49 { 50 50 assert(sink); … … 79 79 list_append(&source->link, &sink->sources); 80 80 81 const audio_format_t old_format = sink->format;81 const pcm_format_t old_format = sink->format; 82 82 83 83 /* The first source for me */ 84 84 if (list_count(&sink->sources) == 1) { 85 85 /* Set audio format according to the first source */ 86 if ( audio_format_is_any(&sink->format)) {86 if (pcm_format_is_any(&sink->format)) { 87 87 int ret = audio_sink_set_format(sink, &source->format); 88 88 if (ret != EOK) … … 110 110 } 111 111 112 int audio_sink_set_format(audio_sink_t *sink, const audio_format_t *format)112 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format) 113 113 { 114 114 assert(sink); 115 115 assert(format); 116 if (! audio_format_is_any(&sink->format)) {116 if (!pcm_format_is_any(&sink->format)) { 117 117 log_debug("Sink %s already has a format", sink->name); 118 118 return EEXISTS; 119 119 } 120 const audio_format_t old_format;120 const pcm_format_t old_format; 121 121 122 if ( audio_format_is_any(format)) {122 if (pcm_format_is_any(format)) { 123 123 log_verbose("Setting DEFAULT format for sink %s", sink->name); 124 124 sink->format = AUDIO_FORMAT_DEFAULT; -
TabularUnified uspace/srv/audio/hound/audio_sink.h ¶
r950110ee rea6c838 41 41 #include <bool.h> 42 42 #include <fibril.h> 43 #include <pcm/format.h> 43 44 44 45 #include "audio_source.h" 45 #include "audio_format.h"46 46 47 47 typedef struct audio_sink audio_sink_t; … … 51 51 list_t sources; 52 52 const char *name; 53 audio_format_t format;53 pcm_format_t format; 54 54 void *private_data; 55 55 int (*connection_change)(audio_sink_t *, bool); … … 64 64 int audio_sink_init(audio_sink_t *sink, const char *name, 65 65 void *private_data, int (*connection_change)(audio_sink_t *, bool), 66 int (*check_format)(audio_sink_t *), const audio_format_t *f);66 int (*check_format)(audio_sink_t *), const pcm_format_t *f); 67 67 void audio_sink_fini(audio_sink_t *sink); 68 68 69 int audio_sink_set_format(audio_sink_t *sink, const audio_format_t *format);69 int audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format); 70 70 int audio_sink_add_source(audio_sink_t *sink, audio_source_t *source); 71 71 int audio_sink_remove_source(audio_sink_t *sink, audio_source_t *source); -
TabularUnified uspace/srv/audio/hound/audio_source.c ¶
r950110ee rea6c838 49 49 int (*connection_change)(audio_source_t *), 50 50 int (*update_available_data)(audio_source_t *, size_t), 51 const audio_format_t *f)51 const pcm_format_t *f) 52 52 { 53 53 assert(source); … … 82 82 assert(source); 83 83 audio_sink_t *old_sink = source->connected_sink; 84 const audio_format_t old_format = source->format;84 const pcm_format_t old_format = source->format; 85 85 86 86 source->connected_sink = sink; 87 if ( audio_format_is_any(&source->format)) {87 if (pcm_format_is_any(&source->format)) { 88 88 assert(sink); 89 assert(! audio_format_is_any(&sink->format));89 assert(!pcm_format_is_any(&sink->format)); 90 90 source->format = sink->format; 91 91 } … … 102 102 103 103 int audio_source_add_self(audio_source_t *source, void *buffer, size_t size, 104 const audio_format_t *f)104 const pcm_format_t *f) 105 105 { 106 106 assert(source); … … 120 120 return ENOTSUP; 121 121 } 122 const size_t src_frame_size = audio_format_frame_size(&source->format);123 const size_t dst_frames = size / audio_format_frame_size(f);122 const size_t src_frame_size = pcm_format_frame_size(&source->format); 123 const size_t dst_frames = size / pcm_format_frame_size(f); 124 124 125 125 if (source->available_data.position == NULL || … … 135 135 } 136 136 137 const int ret = audio_format_convert_and_mix(buffer, size,137 const int ret = pcm_format_convert_and_mix(buffer, size, 138 138 source->available_data.position, source->available_data.size, 139 139 &source->format, f); -
TabularUnified uspace/srv/audio/hound/audio_source.h ¶
r950110ee rea6c838 39 39 #include <adt/list.h> 40 40 #include <bool.h> 41 #include <pcm_sample_format.h> 42 43 44 #include "audio_format.h" 41 #include <pcm/format.h> 45 42 46 43 struct audio_sink; … … 50 47 link_t link; 51 48 const char *name; 52 audio_format_t format;49 pcm_format_t format; 53 50 void *private_data; 54 51 int (*connection_change)(audio_source_t *source); … … 70 67 int (*connection_change)(audio_source_t *), 71 68 int (*update_available_data)(audio_source_t *, size_t), 72 const audio_format_t *f);69 const pcm_format_t *f); 73 70 void audio_source_fini(audio_source_t *source); 74 71 int audio_source_connected(audio_source_t *source, struct audio_sink *sink); 75 72 int audio_source_add_self(audio_source_t *source, void *buffer, size_t size, 76 const audio_format_t *f);77 static inline const audio_format_t *audio_source_format(const audio_source_t *s)73 const pcm_format_t *f); 74 static inline const pcm_format_t *audio_source_format(const audio_source_t *s) 78 75 { 79 76 assert(s); -
TabularUnified uspace/srv/audio/hound/hound.h ¶
r950110ee rea6c838 42 42 #include <errno.h> 43 43 #include <fibril_synch.h> 44 #include <pcm/format.h> 44 45 45 46 #include "audio_source.h" 46 47 #include "audio_sink.h" 47 #include "audio_format.h"48 48 49 49 -
TabularUnified uspace/srv/audio/hound/main.c ¶
r950110ee rea6c838 71 71 LIST_INITIALIZE(local_playback); 72 72 LIST_INITIALIZE(local_recording); 73 audio_format_t format = {0};73 pcm_format_t format = {0}; 74 74 const char *name = NULL; 75 75 async_sess_t *sess = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.