File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
#include < AK/BufferStream.h>
2
2
#include < AudioServer/ASClientConnection.h>
3
3
#include < AudioServer/ASMixer.h>
4
- #include < LibCore/CThread.h>
5
4
#include < limits>
6
5
7
6
ASMixer::ASMixer ()
8
7
: m_device(" /dev/audio" , this )
8
+ , m_sound_thread([this ] {
9
+ mix ();
10
+ return 0 ;
11
+ })
9
12
{
10
13
if (!m_device.open (CIODevice::WriteOnly)) {
11
14
dbgprintf (" Can't open audio device: %s\n " , m_device.error_string ());
12
15
return ;
13
16
}
14
17
15
- CThread sound_thread ([](void * context) -> int {
16
- ASMixer* mixer = (ASMixer*)context;
17
- mixer->mix ();
18
- return 0 ;
19
- },
20
- this );
18
+ m_sound_thread.start ();
21
19
}
22
20
23
21
ASMixer::~ASMixer ()
Original file line number Diff line number Diff line change 8
8
#include < LibAudio/ABuffer.h>
9
9
#include < LibCore/CFile.h>
10
10
#include < LibCore/CLock.h>
11
+ #include < LibThread/Thread.h>
11
12
12
13
class ASClientConnection ;
13
14
@@ -65,6 +66,8 @@ class ASMixer : public CObject {
65
66
CFile m_device;
66
67
CLock m_lock;
67
68
69
+ LibThread::Thread m_sound_thread;
70
+
68
71
int m_main_volume { 100 };
69
72
70
73
void mix ();
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ AudioServerEndpoint.h: AudioServer.ipc
19
19
@echo " IPC $<" ; $(IPCCOMPILER ) $< > $@
20
20
21
21
$(APP ) : $(OBJS )
22
- $(LD ) -o $(APP ) $(LDFLAGS ) $(OBJS ) -lc -lcore -lipc
22
+ $(LD ) -o $(APP ) $(LDFLAGS ) $(OBJS ) -lc -lcore -lipc -lthread
23
23
24
24
.cpp.o :
25
25
@echo " CXX $<" ; $(CXX ) $(CXXFLAGS ) -o $@ -c $<
You can’t perform that action at this time.
0 commit comments