@@ -32,27 +32,14 @@ namespace love
3232 };
3333 // clang-format on
3434
35- OSEvent s_Event;
3635 volatile bool s_Init = false ;
3736
38- static void audioCallback ()
39- {
40- if (!s_Init)
41- return ;
42-
43- OSSignalEvent (&s_Event);
44- }
45-
4637 // # region Device
4738
4839 bool Device::open ()
4940 {
5041 AXInitWithParams (&AX_INIT_PARAMS );
5142 s_Init = AXIsInit ();
52-
53- // OSInitEvent(&s_Event, false, OS_EVENT_MODE_AUTO);
54- // AXRegisterAppFrameCallback(audioCallback);
55-
5643 return s_Init;
5744 }
5845
@@ -122,7 +109,7 @@ namespace love
122109
123110 void update ()
124111 {
125- if (this -> currentBuffer && !this ->currentBuffer -> isFinished () )
112+ if (!this ->currentBuffer )
126113 return ;
127114
128115 if (this ->buffers .empty ())
@@ -148,10 +135,10 @@ namespace love
148135
149136 void addBuffer (Buffer* buffer)
150137 {
151- this ->buffers .push (buffer);
152-
153138 buffer->setSampleRate (this ->samplerate );
154139 buffer->setVolume (this ->volume );
140+
141+ this ->buffers .push (buffer);
155142 }
156143
157144 bool isPaused () const
@@ -192,9 +179,6 @@ namespace love
192179
193180 void Device::update ()
194181 {
195- if (!s_Init)
196- return ;
197-
198182 for (auto & channel : s_Channels)
199183 channel.update ();
200184
@@ -206,7 +190,6 @@ namespace love
206190 if (!s_Init)
207191 return ;
208192
209- // AXDeregisterAppFrameCallback(audioCallback);
210193 s_Init = false ;
211194 AXQuit ();
212195 }
@@ -263,6 +246,8 @@ namespace love
263246 for (int channel = 0 ; channel < channels; channel++)
264247 {
265248 this ->buffer .voices [channel] = AXAcquireVoice (0x1F , nullptr , nullptr );
249+ if (!this ->buffer .voices [channel])
250+ throw love::Exception (" Failed to acquire AXVoice!" );
266251
267252 UniqueVoiceScope scope (this ->buffer .voices [channel]);
268253 AXSetVoiceType (this ->buffer .voices [channel], AX_VOICE_TYPE_UNKNOWN );
@@ -290,7 +275,7 @@ namespace love
290275 AXGetVoiceOffsets (this ->buffer .voices [0 ], &offsets);
291276 const auto running = AXIsVoiceRunning (this ->buffer .voices [0 ]);
292277
293- return offsets.currentOffset == offsets.endOffset || (!running && offsets.currentOffset == 0 );
278+ return ( offsets.currentOffset == offsets.endOffset ) || (!running && offsets.currentOffset == 0 );
294279 }
295280
296281 void Buffer::prepare (const void * data, size_t size, int samples, bool own)
0 commit comments