Attempt getting audio port volume levels.

This commit is contained in:
rocky
2005-06-11 18:59:47 +00:00
parent 317de33b70
commit c0310e8674
3 changed files with 60 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: win32.c,v 1.30 2005/03/09 11:04:34 rocky Exp $
$Id: win32.c,v 1.31 2005/06/11 18:59:47 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32.c,v 1.30 2005/03/09 11:04:34 rocky Exp $";
static const char _rcsid[] = "$Id: win32.c,v 1.31 2005/06/11 18:59:47 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -84,6 +84,23 @@ static const char _rcsid[] = "$Id: win32.c,v 1.30 2005/03/09 11:04:34 rocky Exp
#define WIN_NT ( GetVersion() < 0x80000000 )
#endif
/*!
Set the volume of an audio CD.
@param p_cdio the CD object to be acted upon.
*/
static driver_return_code_t
audio_get_volume_win32 ( void *p_user_data,
/*out*/ cdio_audio_volume_t *p_volume)
{
if ( WIN_NT ) {
return audio_get_volume_win32ioctl (p_user_data, p_volume);
} else {
return DRIVER_OP_UNSUPPORTED; /* not yet, but soon I hope */
}
}
/*!
Pause playing CD through analog output
@@ -874,6 +891,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
memset( &_funcs, 0, sizeof(_funcs) );
_funcs.audio_get_volume = audio_get_volume_win32;
_funcs.audio_pause = audio_pause_win32;
_funcs.audio_play_msf = audio_play_msf_win32;
#if 0

View File

@@ -1,5 +1,5 @@
/*
$Id: win32.h,v 1.8 2005/03/08 03:11:19 rocky Exp $
$Id: win32.h,v 1.9 2005/06/11 18:59:47 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -85,6 +85,16 @@ driver_return_code_t audio_resume_win32ioctl (void *p_user_data);
*/
discmode_t get_discmode_win32ioctl (_img_private_t *p_env);
/*!
Get the volume settings of an audio CD.
@param p_cdio the CD object to be acted upon.
*/
driver_return_code_t
audio_get_volume_win32ioctl ( void *p_user_data,
/*out*/ cdio_audio_volume_t *p_volume);
/*!
Read Audio Subchannel information

View File

@@ -1,5 +1,5 @@
/*
$Id: win32_ioctl.c,v 1.27 2005/03/21 08:33:36 rocky Exp $
$Id: win32_ioctl.c,v 1.28 2005/06/11 18:59:47 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.27 2005/03/21 08:33:36 rocky Exp $";
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.28 2005/06/11 18:59:47 rocky Exp $";
#ifdef HAVE_WIN32_CDROM
@@ -294,6 +294,33 @@ audio_set_volume_win32ioctl (void *p_user_data,
return DRIVER_OP_SUCCESS;
}
driver_return_code_t
audio_get_volume_win32ioctl (void *p_user_data,
/*out*/ cdio_audio_volume_t *p_volume)
{
const _img_private_t *p_env = p_user_data;
DWORD dw_bytes_returned;
bool b_success =
DeviceIoControl(p_env->h_device_handle, IOCTL_CDROM_GET_VOLUME,
NULL, 0,
p_volume, (DWORD) sizeof(cdio_audio_volume_t),
&dw_bytes_returned, NULL);
if ( ! b_success ) {
char *psz_msg = NULL;
long int i_err = GetLastError();
FORMAT_ERROR(i_err, psz_msg);
if (psz_msg)
cdio_info("Error: %s", psz_msg);
else
cdio_info("Error: %ld", i_err);
LocalFree(psz_msg);
return DRIVER_OP_ERROR;
}
return DRIVER_OP_SUCCESS;
}
/*!
Stop playing an audio CD.