mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Sound: tidy
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "fastfetch.h"
|
||||
#include "detection/media/media.h"
|
||||
#include "common/thread.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -11,7 +10,6 @@
|
||||
#ifdef FF_HAVE_DBUS
|
||||
#include "common/dbus.h"
|
||||
#include "common/library.h"
|
||||
#include "common/parsing.h"
|
||||
|
||||
static bool getBusProperties(FFDBusData* data, const char* busName, FFMediaResult* result)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ const char* ffDetectSound(FFlist* devices)
|
||||
uint32_t devmask = 0;
|
||||
if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask) < 0)
|
||||
continue;
|
||||
if (!((1 << SOUND_MIXER_VOLUME) & devmask))
|
||||
if (!(devmask & SOUND_MASK_VOLUME))
|
||||
continue;
|
||||
|
||||
uint32_t mutemask = 0;
|
||||
@@ -31,13 +31,13 @@ const char* ffDetectSound(FFlist* devices)
|
||||
continue;
|
||||
|
||||
uint32_t volume;
|
||||
if (ioctl(fd, MIXER_READ(SOUND_MIXER_VOLUME), &volume) < 0)
|
||||
if (ioctl(fd, SOUND_MIXER_READ_VOLUME, &volume) < 0)
|
||||
continue;
|
||||
|
||||
FFSoundDevice* device = ffListAdd(devices);
|
||||
ffStrbufInitS(&device->identifier, path);
|
||||
ffStrbufInitF(&device->name, "%s %s", ci.longname, ci.hw_info);
|
||||
device->volume = (1 << SOUND_MIXER_VOLUME) & mutemask
|
||||
device->volume = mutemask & SOUND_MASK_VOLUME
|
||||
? 0
|
||||
: ((uint8_t) volume /*left*/ + (uint8_t) (volume >> 8) /*right*/) / 2;
|
||||
device->active = true;
|
||||
|
||||
Reference in New Issue
Block a user