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>
|
||||
|
||||
@@ -117,7 +117,7 @@ bool b_db = false; /* we have a database at all */
|
||||
bool b_record = false; /* we have a record for
|
||||
the inserted CD */
|
||||
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;
|
||||
@@ -369,25 +369,32 @@ 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
|
||||
decrease_volume_level(CdIo_t *p_cdio)
|
||||
{
|
||||
if (i_volume_level == 0) i_volume_level = 50;
|
||||
if (i_volume_level <= 1)
|
||||
return false;
|
||||
else
|
||||
return set_volume_level(p_cdio, --i_volume_level);
|
||||
if (i_volume_level == -1) i_volume_level = 50;
|
||||
if (i_volume_level == 0) i_volume_level = 100;
|
||||
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
|
||||
increase_volume_level(CdIo_t *p_cdio)
|
||||
{
|
||||
if (i_volume_level == 0) i_volume_level = 50;
|
||||
if (i_volume_level >= 100)
|
||||
return false;
|
||||
else
|
||||
return set_volume_level(p_cdio, ++i_volume_level);
|
||||
if (i_volume_level == -1) i_volume_level = 50;
|
||||
if (i_volume_level == 100) i_volume_level = -1;
|
||||
return set_volume_level(p_cdio, ++i_volume_level);
|
||||
}
|
||||
|
||||
/** Stop playing audio CD */
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -62,6 +62,7 @@ typedef enum {
|
||||
/* These are the remaining configuration options */
|
||||
OP_BLOCKSIZE,
|
||||
OP_EJECT,
|
||||
OP_IDLE,
|
||||
OP_MCN,
|
||||
OP_SPEED,
|
||||
OP_VERSION,
|
||||
@@ -85,10 +86,15 @@ parse_options (int argc, char *argv[])
|
||||
" -b, --blocksize[=INT] set blocksize. If no block size or a \n"
|
||||
" zero blocksize is given we return the\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"
|
||||
" -s, --speed=INT Set drive speed to SPEED K bytes/sec\n"
|
||||
" Note: 1x = 176.4 KB/s \n"
|
||||
" -s, --speed-KB=INT Set drive speed to SPEED K bytes/sec\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"
|
||||
" and exit\n"
|
||||
"\n"
|
||||
@@ -102,13 +108,15 @@ parse_options (int argc, char *argv[])
|
||||
" [-V|--version] [-?|--help] [--usage]\n";
|
||||
|
||||
/* Command-line options */
|
||||
const char* optionsString = "b::s:V?";
|
||||
const char* optionsString = "b::Is:V?";
|
||||
struct option optionsTable[] = {
|
||||
|
||||
{"blocksize", optional_argument, &opts.i_blocksize, 'b' },
|
||||
{"eject", no_argument, NULL, 'e'},
|
||||
{"idle", no_argument, NULL, 'I'},
|
||||
{"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'},
|
||||
{"help", no_argument, NULL, '?' },
|
||||
@@ -125,6 +133,9 @@ parse_options (int argc, char *argv[])
|
||||
case 'e':
|
||||
operation[last_op++] = OP_EJECT;
|
||||
break;
|
||||
case 'I':
|
||||
operation[last_op++] = OP_IDLE;
|
||||
break;
|
||||
case 'm':
|
||||
operation[last_op++] = OP_MCN;
|
||||
break;
|
||||
@@ -132,6 +143,10 @@ parse_options (int argc, char *argv[])
|
||||
opts.i_speed = atoi(optarg);
|
||||
operation[last_op++] = OP_SPEED;
|
||||
break;
|
||||
case 'S':
|
||||
opts.i_speed = 176 * atoi(optarg);
|
||||
operation[last_op++] = OP_SPEED;
|
||||
break;
|
||||
case 'V':
|
||||
print_version(program_name, VERSION, 0, true);
|
||||
free(program_name);
|
||||
@@ -223,6 +238,11 @@ main(int argc, char *argv[])
|
||||
report(stdout, "%s (mmc_eject_media): %s\n", program_name,
|
||||
cdio_driver_errmsg(rc));
|
||||
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:
|
||||
{
|
||||
char *psz_mcn = mmc_get_mcn(p_cdio);
|
||||
|
||||
Reference in New Issue
Block a user