mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	LibAudio: Expose blocking realtime enqueue to audio clients
This is just a delegate of the same function found in the shared queue itself.
This commit is contained in:
		
							parent
							
								
									836f28392d
								
							
						
					
					
						commit
						cc9192a1e7
					
				
					 2 changed files with 7 additions and 0 deletions
				
			
		|  | @ -11,6 +11,7 @@ | |||
| #include <AK/Time.h> | ||||
| #include <AK/Types.h> | ||||
| #include <LibAudio/ConnectionToServer.h> | ||||
| #include <LibAudio/Queue.h> | ||||
| #include <LibAudio/UserSampleQueue.h> | ||||
| #include <LibCore/Event.h> | ||||
| #include <LibThreading/Mutex.h> | ||||
|  | @ -116,6 +117,11 @@ ErrorOr<void, AudioQueue::QueueStatus> ConnectionToServer::realtime_enqueue(Arra | |||
|     return m_buffer->try_enqueue(samples); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<void> ConnectionToServer::blocking_realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples, Function<void()> wait_function) | ||||
| { | ||||
|     return m_buffer->try_blocking_enqueue(samples, move(wait_function)); | ||||
| } | ||||
| 
 | ||||
| unsigned ConnectionToServer::total_played_samples() const | ||||
| { | ||||
|     return m_buffer->weak_tail() * AUDIO_BUFFER_SIZE; | ||||
|  |  | |||
|  | @ -45,6 +45,7 @@ public: | |||
| 
 | ||||
|     // Returns immediately with the appropriate status if the buffer is full; use in conjunction with remaining_buffers to get low latency.
 | ||||
|     ErrorOr<void, AudioQueue::QueueStatus> realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples); | ||||
|     ErrorOr<void> blocking_realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples, Function<void()> wait_function); | ||||
| 
 | ||||
|     // This information can be deducted from the shared audio buffer.
 | ||||
|     unsigned total_played_samples() const; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kleines Filmröllchen
						kleines Filmröllchen