Commit 1a2482be authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move set_volumes to the unixlib.

parent 4b469fe1
......@@ -18,22 +18,7 @@
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <math.h>
#include <sys/soundcard.h>
#include <pthread.h>
#include "windef.h"
#include "winbase.h"
......@@ -277,16 +262,6 @@ static DWORD WINAPI timer_thread(void *user)
return 0;
}
static void oss_lock(struct oss_stream *stream)
{
pthread_mutex_lock(&stream->lock);
}
static void oss_unlock(struct oss_stream *stream)
{
pthread_mutex_unlock(&stream->lock);
}
static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name,
GUID *guid)
{
......@@ -361,11 +336,13 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid)
static void set_stream_volumes(ACImpl *This)
{
struct oss_stream *stream = This->stream;
struct set_volumes_params params;
oss_lock(stream);
stream->mute = This->session->mute;
oss_unlock(stream);
params.stream = This->stream;
params.master_volume = (This->session->mute ? 0.0f : This->session->master_vol);
params.volumes = This->vols;
params.session_volumes = This->session->channel_vols;
OSS_CALL(set_volumes, &params);
}
static const OSSDevice *get_ossdevice_from_guid(const GUID *guid)
......
......@@ -44,6 +44,28 @@
#include "unixlib.h"
struct oss_stream
{
WAVEFORMATEX *fmt;
EDataFlow flow;
UINT flags;
AUDCLNT_SHAREMODE share;
HANDLE event;
int fd;
BOOL playing, mute, please_quit;
UINT64 written_frames, last_pos_frames;
UINT32 period_frames, bufsize_frames, held_frames, tmp_buffer_frames, in_oss_frames;
UINT32 oss_bufsize_bytes, lcl_offs_frames; /* offs into local_buffer where valid data starts */
REFERENCE_TIME period;
BYTE *local_buffer, *tmp_buffer;
INT32 getbuf_last; /* <0 when using tmp_buffer */
pthread_mutex_t lock;
};
WINE_DEFAULT_DEBUG_CHANNEL(oss);
/* copied from kernelbase */
......@@ -1316,6 +1338,18 @@ static NTSTATUS get_position(void *args)
return oss_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS set_volumes(void *args)
{
struct set_volumes_params *params = args;
struct oss_stream *stream = params->stream;
oss_lock(stream);
stream->mute = !params->master_volume;
oss_unlock(stream);
return STATUS_SUCCESS;
}
static NTSTATUS set_event_handle(void *args)
{
struct set_event_handle_params *params = args;
......@@ -1368,6 +1402,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_next_packet_size,
get_frequency,
get_position,
set_volumes,
set_event_handle,
is_started,
};
......@@ -18,27 +18,7 @@
#include "mmdeviceapi.h"
struct oss_stream
{
WAVEFORMATEX *fmt;
EDataFlow flow;
UINT flags;
AUDCLNT_SHAREMODE share;
HANDLE event;
int fd;
BOOL playing, mute, please_quit;
UINT64 written_frames, last_pos_frames;
UINT32 period_frames, bufsize_frames, held_frames, tmp_buffer_frames, in_oss_frames;
UINT32 oss_bufsize_bytes, lcl_offs_frames; /* offs into local_buffer where valid data starts */
REFERENCE_TIME period;
BYTE *local_buffer, *tmp_buffer;
INT32 getbuf_last; /* <0 when using tmp_buffer */
pthread_mutex_t lock;
};
struct stream_oss;
/* From <dlls/mmdevapi/mmdevapi.h> */
enum DriverPriority
......@@ -208,6 +188,14 @@ struct get_position_params
UINT64 *qpctime;
};
struct set_volumes_params
{
struct oss_stream *stream;
float master_volume;
const float *volumes;
const float *session_volumes;
};
struct set_event_handle_params
{
struct oss_stream *stream;
......@@ -243,6 +231,7 @@ enum oss_funcs
oss_get_next_packet_size,
oss_get_frequency,
oss_get_position,
oss_set_volumes,
oss_set_event_handle,
oss_is_started,
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment