diff --git a/Servers/AudioServer/ASMixer.cpp b/Servers/AudioServer/ASMixer.cpp index 799fedc7d5a..1b5219d171f 100644 --- a/Servers/AudioServer/ASMixer.cpp +++ b/Servers/AudioServer/ASMixer.cpp @@ -1,23 +1,21 @@ #include #include #include -#include #include ASMixer::ASMixer() : m_device("/dev/audio", this) + , m_sound_thread([this] { + mix(); + return 0; + }) { if (!m_device.open(CIODevice::WriteOnly)) { dbgprintf("Can't open audio device: %s\n", m_device.error_string()); return; } - CThread sound_thread([](void* context) -> int { - ASMixer* mixer = (ASMixer*)context; - mixer->mix(); - return 0; - }, - this); + m_sound_thread.start(); } ASMixer::~ASMixer() diff --git a/Servers/AudioServer/ASMixer.h b/Servers/AudioServer/ASMixer.h index bcbd32bb5ee..401ee455c3f 100644 --- a/Servers/AudioServer/ASMixer.h +++ b/Servers/AudioServer/ASMixer.h @@ -8,6 +8,7 @@ #include #include #include +#include class ASClientConnection; @@ -65,6 +66,8 @@ private: CFile m_device; CLock m_lock; + LibThread::Thread m_sound_thread; + int m_main_volume { 100 }; void mix(); diff --git a/Servers/AudioServer/Makefile b/Servers/AudioServer/Makefile index 59a66fa302f..53e6ee811e9 100644 --- a/Servers/AudioServer/Makefile +++ b/Servers/AudioServer/Makefile @@ -19,7 +19,7 @@ AudioServerEndpoint.h: AudioServer.ipc @echo "IPC $<"; $(IPCCOMPILER) $< > $@ $(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore -lipc + $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore -lipc -lthread .cpp.o: @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<