diff options
author | Matthew Gregan <[email protected]> | 2014-09-16 15:14:52 +1200 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2014-09-16 15:14:52 +1200 |
commit | 06c689c2ad37347bfb20061d2bcb0e5ea037e561 (patch) | |
tree | 71ae3d2bad97bf2a387c4abf1b27e9cc6698ff6f /src/cubeb_audiotrack.c | |
parent | c97c59fbb94a265ee6c57c065ba8d02543789546 (diff) | |
download | cubeb-06c689c2ad37347bfb20061d2bcb0e5ea037e561.tar.gz cubeb-06c689c2ad37347bfb20061d2bcb0e5ea037e561.zip |
Sync changes with mozilla-central copy. Includes BMO 1062293, 1057199,
848954, 1054176, 1052923, 1046592, 1049478, 1046470, 1045018, 1023947,
1027713, 1015932, 1032266, 1034140, 1033192, 1020227, 1017438, 1026854,
1008079, 1007552.
Diffstat (limited to 'src/cubeb_audiotrack.c')
-rw-r--r-- | src/cubeb_audiotrack.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/cubeb_audiotrack.c b/src/cubeb_audiotrack.c index ac6f221..e2c65d7 100644 --- a/src/cubeb_audiotrack.c +++ b/src/cubeb_audiotrack.c @@ -71,7 +71,7 @@ struct AudioTrack { /* static */ int (*get_output_latency)(uint32_t* latency, int stream); /* static */ int (*get_output_samplingrate)(int* samplerate, int stream); status_t (*set_marker_position)(void* instance, unsigned int); - + status_t (*set_volume)(void* instance, float left, float right); }; struct cubeb { @@ -251,6 +251,7 @@ audiotrack_init(cubeb ** context, char const * context_name) DLSYM_DLERROR("_ZN7android10AudioTrack5pauseEv", ctx->klass.pause, ctx->library); DLSYM_DLERROR("_ZN7android10AudioTrack11getPositionEPj", ctx->klass.get_position, ctx->library); DLSYM_DLERROR("_ZN7android10AudioTrack17setMarkerPositionEj", ctx->klass.set_marker_position, ctx->library); + DLSYM_DLERROR("_ZN7android10AudioTrack9setVolumeEff", ctx->klass.set_volume, ctx->library); /* check that we have a combination of symbol that makes sense */ c = &ctx->klass; @@ -468,6 +469,27 @@ audiotrack_stream_get_latency(cubeb_stream * stream, uint32_t * latency) return 0; } +int +audiotrack_stream_set_volume(cubeb_stream * stream, float volume) +{ + status_t status; + + status = stream->context->klass.set_volume(stream->instance, volume, volume); + + if (status) { + return CUBEB_ERROR; + } + + return CUBEB_OK; +} + +int +audiotrack_stream_set_panning(cubeb_stream * stream, float panning) +{ + assert(false && "not implemented."); + return CUBEB_OK; +} + static struct cubeb_ops const audiotrack_ops = { .init = audiotrack_init, .get_backend_id = audiotrack_get_backend_id, @@ -480,5 +502,10 @@ static struct cubeb_ops const audiotrack_ops = { .stream_start = audiotrack_stream_start, .stream_stop = audiotrack_stream_stop, .stream_get_position = audiotrack_stream_get_position, - .stream_get_latency = audiotrack_stream_get_latency + .stream_get_latency = audiotrack_stream_get_latency, + .stream_set_volume = audiotrack_stream_set_volume, + .stream_set_panning = audiotrack_stream_set_panning, + .stream_get_current_device = NULL, + .stream_device_destroy = NULL, + .stream_register_device_changed_callback = NULL }; |