Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 485a496 in mainline


Ignore:
Timestamp:
2011-11-25T23:25:13Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
80b9ab3
Parents:
deff6b4
Message:

sb16: Don't set master level to max on startup.

Now we have an app to control volume levels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/mixer.c

    rdeff6b4 r485a496  
    138138            sizeof(volume_ct1745) / sizeof(volume_item_t), volume_ct1745 },
    139139};
    140 
    141 static void sb_mixer_max_master_levels(sb_mixer_t *mixer)
    142 {
    143         assert(mixer);
    144         /* Set Master to maximum */
    145         if (!sb_mixer_get_control_item_count(mixer))
    146                 return;
    147         const unsigned item = 0; /* 0 is Master. */
    148         unsigned  channels = 0;
    149         const char *name = NULL;
    150 
    151         sb_mixer_get_control_item_info(mixer, item, &name, &channels);
    152         for (unsigned channel = 0; channel < channels; ++channel) {
    153                 unsigned levels = 0;
    154                 const int ret = sb_mixer_get_channel_info(mixer, item, channel,
    155                     NULL, &levels);
    156                 if (ret != EOK)
    157                         continue;
    158 
    159                 unsigned level =
    160                     sb_mixer_get_volume_level(mixer, item, channel);
    161                 ddf_log_note("Setting %s channel %d to %d (%d).\n",
    162                     name, channel, levels - 1, level);
    163 
    164                 sb_mixer_set_volume_level(mixer, item, channel, levels - 1);
    165 
    166                 level = sb_mixer_get_volume_level(mixer, item, channel);
    167                 ddf_log_note("%s channel %d set to %d.\n",
    168                     name, channel, level);
    169         }
    170 }
    171140/*----------------------------------------------------------------------------*/
    172141const char * sb_mixer_type_str(sb_mixer_type_t type)
     
    192161                pio_write_8(&regs->mixer_address, MIXER_RESET_ADDRESS);
    193162                pio_write_8(&regs->mixer_data, 1);
    194                 sb_mixer_max_master_levels(mixer);
    195163        }
    196164        pio_write_8(&regs->mixer_address, MIXER_PNP_IRQ_ADDRESS);
     
    268236        value |= level << chan->shift;
    269237        pio_write_8(&mixer->regs->mixer_data, value);
     238        ddf_log_note("Channel %s %s volume set to: %u.\n",
     239            volume_table[mixer->type].table[index].description,
     240            chan->name, level);
    270241        return EOK;
    271242}
Note: See TracChangeset for help on using the changeset viewer.