#ifndef linux
#undef CONFIG_APPLET_MIXER
#elif CONFIG_APPLET_MIXER

#include "ywindow.h"
#include "ytimer.h"

#include <stdio.h>

#define USE_PIXMAP 1

#define MIXER_WIDTH 20
#define PIX_NUM 4

#define mixerDEV "/dev/mixer"

// http://www.4front-tech.com/pguide/oss.pdf

class YMixer: public YWindow, public YTimerListener {
	public:
		YMixer(YWindow *aParent = 0);
		virtual ~YMixer();

		virtual void paint(Graphics &g, const YRect &r);

		void updateToolTip();
		virtual bool handleTimer(YTimer *t);

		virtual void handleButton(const XButtonEvent &button);

	private:
		YTimer *mixerTimer;

		static YColor *mixerBg;

#if USE_PIXMAP
		int init_pixmaps();
#endif
		
		int bar_height;

		int mixer_fd;
		int mixer_init();
		int mixer_read();
		int mixer_write(int);
		int mixer_mute();
		int mixer_unmute();

		int muted;
		int muted_state;
		ref<YPixmap> PixMix[PIX_NUM+1];
		ref<YPixmap> PixMute;
};
#endif
