Changeset ea6c838 in mainline for uspace/srv/audio
- 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/srv/audio/hound
- Files:
-
- 10 edited
-
Makefile (modified) (1 diff)
-
audio_client.c (modified) (3 diffs)
-
audio_client.h (modified) (3 diffs)
-
audio_device.c (modified) (2 diffs)
-
audio_sink.c (modified) (3 diffs)
-
audio_sink.h (modified) (3 diffs)
-
audio_source.c (modified) (5 diffs)
-
audio_source.h (modified) (3 diffs)
-
hound.h (modified) (1 diff)
-
main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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 \ -
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)); -
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 -
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, -
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; -
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); -
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); -
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); -
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 -
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.
