Wrapping fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdda-player.c,v 1.46 2006/04/07 02:01:46 rocky Exp $
|
$Id: cdda-player.c,v 1.47 2006/04/07 02:32:03 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ bool b_db = false; /* we have a database at all */
|
|||||||
bool b_record = false; /* we have a record for
|
bool b_record = false; /* we have a record for
|
||||||
the inserted CD */
|
the inserted CD */
|
||||||
bool b_all_tracks = false; /* True if we display all tracks*/
|
bool b_all_tracks = false; /* True if we display all tracks*/
|
||||||
uint8_t i_volume_level = 0; /* Valid range is 1..100 */
|
int8_t i_volume_level = -1; /* Valid range is 0..100 */
|
||||||
|
|
||||||
|
|
||||||
char *psz_device=NULL;
|
char *psz_device=NULL;
|
||||||
@@ -369,24 +369,31 @@ set_volume_level(CdIo_t *p_cdio, uint8_t i_level)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add 1 to volume level. If we are at the max or min value wrap
|
||||||
|
around. If volume level is undefined, then this means we
|
||||||
|
could not get the current value and we'll' set it to 50 the midway
|
||||||
|
point.
|
||||||
|
Return status of setting the volume level.
|
||||||
|
*/
|
||||||
static bool
|
static bool
|
||||||
decrease_volume_level(CdIo_t *p_cdio)
|
decrease_volume_level(CdIo_t *p_cdio)
|
||||||
{
|
{
|
||||||
if (i_volume_level == 0) i_volume_level = 50;
|
if (i_volume_level == -1) i_volume_level = 50;
|
||||||
if (i_volume_level <= 1)
|
if (i_volume_level == 0) i_volume_level = 100;
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return set_volume_level(p_cdio, --i_volume_level);
|
return set_volume_level(p_cdio, --i_volume_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subtract 1 to volume level. If we are at the max or min value wrap
|
||||||
|
around. If volume level is undefined, then this means we
|
||||||
|
could not get the current value and we'll' set it to 50 the midway
|
||||||
|
point.
|
||||||
|
Return status of setting the volume level.
|
||||||
|
*/
|
||||||
static bool
|
static bool
|
||||||
increase_volume_level(CdIo_t *p_cdio)
|
increase_volume_level(CdIo_t *p_cdio)
|
||||||
{
|
{
|
||||||
if (i_volume_level == 0) i_volume_level = 50;
|
if (i_volume_level == -1) i_volume_level = 50;
|
||||||
if (i_volume_level >= 100)
|
if (i_volume_level == 100) i_volume_level = -1;
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return set_volume_level(p_cdio, ++i_volume_level);
|
return set_volume_level(p_cdio, ++i_volume_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: mmc-tool.c,v 1.3 2006/04/04 02:09:19 rocky Exp $
|
$Id: mmc-tool.c,v 1.4 2006/04/07 02:32:03 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -62,6 +62,7 @@ typedef enum {
|
|||||||
/* These are the remaining configuration options */
|
/* These are the remaining configuration options */
|
||||||
OP_BLOCKSIZE,
|
OP_BLOCKSIZE,
|
||||||
OP_EJECT,
|
OP_EJECT,
|
||||||
|
OP_IDLE,
|
||||||
OP_MCN,
|
OP_MCN,
|
||||||
OP_SPEED,
|
OP_SPEED,
|
||||||
OP_VERSION,
|
OP_VERSION,
|
||||||
@@ -85,10 +86,15 @@ parse_options (int argc, char *argv[])
|
|||||||
" -b, --blocksize[=INT] set blocksize. If no block size or a \n"
|
" -b, --blocksize[=INT] set blocksize. If no block size or a \n"
|
||||||
" zero blocksize is given we return the\n"
|
" zero blocksize is given we return the\n"
|
||||||
" current setting.\n"
|
" current setting.\n"
|
||||||
" -e, --eject eject drive\n"
|
" -e, --eject eject drive via ALLOW_MEDIUM_REMOVAL\n"
|
||||||
|
" and a MMC START/STOP command\n"
|
||||||
|
" -I, --idle set CD-ROM to idle or power down\n"
|
||||||
|
" via MMC START/STOP command"
|
||||||
" -m, --mcn get media catalog number (AKA UPC)\n"
|
" -m, --mcn get media catalog number (AKA UPC)\n"
|
||||||
" -s, --speed=INT Set drive speed to SPEED K bytes/sec\n"
|
" -s, --speed-KB=INT Set drive speed to SPEED K bytes/sec\n"
|
||||||
" Note: 1x = 176.4 KB/s \n"
|
" Note: 1x = 176 KB/s \n"
|
||||||
|
" -S, --speed-X=INT Set drive speed to INT X\n"
|
||||||
|
" Note: 1x = 176 KB/s \n"
|
||||||
" -V, --version display version and copyright information\n"
|
" -V, --version display version and copyright information\n"
|
||||||
" and exit\n"
|
" and exit\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -102,13 +108,15 @@ parse_options (int argc, char *argv[])
|
|||||||
" [-V|--version] [-?|--help] [--usage]\n";
|
" [-V|--version] [-?|--help] [--usage]\n";
|
||||||
|
|
||||||
/* Command-line options */
|
/* Command-line options */
|
||||||
const char* optionsString = "b::s:V?";
|
const char* optionsString = "b::Is:V?";
|
||||||
struct option optionsTable[] = {
|
struct option optionsTable[] = {
|
||||||
|
|
||||||
{"blocksize", optional_argument, &opts.i_blocksize, 'b' },
|
{"blocksize", optional_argument, &opts.i_blocksize, 'b' },
|
||||||
{"eject", no_argument, NULL, 'e'},
|
{"eject", no_argument, NULL, 'e'},
|
||||||
|
{"idle", no_argument, NULL, 'I'},
|
||||||
{"mcn", no_argument, NULL, 'm'},
|
{"mcn", no_argument, NULL, 'm'},
|
||||||
{"speed", required_argument, NULL, 's'},
|
{"speed-KB", required_argument, NULL, 's'},
|
||||||
|
{"speed-X", required_argument, NULL, 'S'},
|
||||||
|
|
||||||
{"version", no_argument, NULL, 'V'},
|
{"version", no_argument, NULL, 'V'},
|
||||||
{"help", no_argument, NULL, '?' },
|
{"help", no_argument, NULL, '?' },
|
||||||
@@ -125,6 +133,9 @@ parse_options (int argc, char *argv[])
|
|||||||
case 'e':
|
case 'e':
|
||||||
operation[last_op++] = OP_EJECT;
|
operation[last_op++] = OP_EJECT;
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
operation[last_op++] = OP_IDLE;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
operation[last_op++] = OP_MCN;
|
operation[last_op++] = OP_MCN;
|
||||||
break;
|
break;
|
||||||
@@ -132,6 +143,10 @@ parse_options (int argc, char *argv[])
|
|||||||
opts.i_speed = atoi(optarg);
|
opts.i_speed = atoi(optarg);
|
||||||
operation[last_op++] = OP_SPEED;
|
operation[last_op++] = OP_SPEED;
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
opts.i_speed = 176 * atoi(optarg);
|
||||||
|
operation[last_op++] = OP_SPEED;
|
||||||
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version(program_name, VERSION, 0, true);
|
print_version(program_name, VERSION, 0, true);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
@@ -223,6 +238,11 @@ main(int argc, char *argv[])
|
|||||||
report(stdout, "%s (mmc_eject_media): %s\n", program_name,
|
report(stdout, "%s (mmc_eject_media): %s\n", program_name,
|
||||||
cdio_driver_errmsg(rc));
|
cdio_driver_errmsg(rc));
|
||||||
break;
|
break;
|
||||||
|
case OP_IDLE:
|
||||||
|
rc = mmc_start_stop_media(p_cdio, false, false, true);
|
||||||
|
report(stdout, "%s (mmc_start_stop_media - powerdown): %s\n",
|
||||||
|
program_name, cdio_driver_errmsg(rc));
|
||||||
|
break;
|
||||||
case OP_MCN:
|
case OP_MCN:
|
||||||
{
|
{
|
||||||
char *psz_mcn = mmc_get_mcn(p_cdio);
|
char *psz_mcn = mmc_get_mcn(p_cdio);
|
||||||
|
|||||||
Reference in New Issue
Block a user