diff --git a/_audio_stream_8h_source.html b/_audio_stream_8h_source.html index b31c3519c..6220bc81b 100644 --- a/_audio_stream_8h_source.html +++ b/_audio_stream_8h_source.html @@ -166,252 +166,252 @@
186 StreamState *nextState,
187 int64_t timeoutNanoseconds) = 0;
188
-
-
201 virtual ResultWithValue<int32_t> setBufferSizeInFrames(int32_t /* requestedFrames */) {
-
202 return Result::ErrorUnimplemented;
-
203 }
+
+
208 virtual ResultWithValue<int32_t> setBufferSizeInFrames(int32_t /* requestedFrames */) {
+
209 return Result::ErrorUnimplemented;
+
210 }
-
204
-
- -
218 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
-
219 }
+
211
+
+ +
225 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
+
226 }
-
220
-
224 virtual bool isXRunCountSupported() const = 0;
-
225
-
- -
232 return mFramesPerBurst;
-
233 }
+
227
+
231 virtual bool isXRunCountSupported() const = 0;
+
232
+
+ +
239 return mFramesPerBurst;
+
240 }
-
234
- -
243
- -
251
- -
259
- -
267
-
- -
296 return ResultWithValue<double>(Result::ErrorUnimplemented);
-
297 }
+
241
+ +
250
+ +
258
+ +
266
+ +
274
+
+ +
303 return ResultWithValue<double>(Result::ErrorUnimplemented);
+
304 }
-
298
-
-
320 virtual Result getTimestamp(clockid_t /* clockId */,
-
321 int64_t* /* framePosition */,
-
322 int64_t* /* timeNanoseconds */) {
-
323 return Result::ErrorUnimplemented;
-
324 }
+
305
+
+
327 virtual Result getTimestamp(clockid_t /* clockId */,
+
328 int64_t* /* framePosition */,
+
329 int64_t* /* timeNanoseconds */) {
+
330 return Result::ErrorUnimplemented;
+
331 }
-
325
- -
347
-
348 // ============== I/O ===========================
-
-
361 virtual ResultWithValue<int32_t> write(const void* /* buffer */,
-
362 int32_t /* numFrames */,
-
363 int64_t /* timeoutNanoseconds */ ) {
-
364 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
-
365 }
+
332
+ +
354
+
355 // ============== I/O ===========================
+
+
368 virtual ResultWithValue<int32_t> write(const void* /* buffer */,
+
369 int32_t /* numFrames */,
+
370 int64_t /* timeoutNanoseconds */ ) {
+
371 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
+
372 }
-
366
-
-
379 virtual ResultWithValue<int32_t> read(void* /* buffer */,
-
380 int32_t /* numFrames */,
-
381 int64_t /* timeoutNanoseconds */) {
-
382 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
-
383 }
+
373
+
+
386 virtual ResultWithValue<int32_t> read(void* /* buffer */,
+
387 int32_t /* numFrames */,
+
388 int64_t /* timeoutNanoseconds */) {
+
389 return ResultWithValue<int32_t>(Result::ErrorUnimplemented);
+
390 }
-
384
-
390 virtual AudioApi getAudioApi() const = 0;
391
-
-
397 bool usesAAudio() const {
-
398 return getAudioApi() == AudioApi::AAudio;
-
399 }
+
397 virtual AudioApi getAudioApi() const = 0;
+
398
+
+
404 bool usesAAudio() const {
+
405 return getAudioApi() == AudioApi::AAudio;
+
406 }
-
400
-
-
409 virtual void *getUnderlyingStream() const {
-
410 return nullptr;
-
411 }
-
-
412
-
417 virtual void updateFramesWritten() = 0;
-
418
-
423 virtual void updateFramesRead() = 0;
-
424
-
425 /*
-
426 * Swap old callback for new callback.
-
427 * This not atomic.
-
428 * This should only be used internally.
-
429 * @param dataCallback
-
430 * @return previous dataCallback
-
431 */
- - - -
435 return previousCallback;
-
436 }
-
437
-
438 /*
-
439 * Swap old callback for new callback.
-
440 * This not atomic.
-
441 * This should only be used internally.
-
442 * @param errorCallback
-
443 * @return previous errorCallback
-
444 */
- - - -
448 return previousCallback;
-
449 }
-
450
- -
455
- - -
472
-
- -
477 return mErrorCallbackResult;
-
478 }
+
407
+
+
416 virtual void *getUnderlyingStream() const {
+
417 return nullptr;
+
418 }
+
419
+
424 virtual void updateFramesWritten() = 0;
+
425
+
430 virtual void updateFramesRead() = 0;
+
431
+
432 /*
+
433 * Swap old callback for new callback.
+
434 * This not atomic.
+
435 * This should only be used internally.
+
436 * @param dataCallback
+
437 * @return previous dataCallback
+
438 */
+ + + +
442 return previousCallback;
+
443 }
+
444
+
445 /*
+
446 * Swap old callback for new callback.
+
447 * This not atomic.
+
448 * This should only be used internally.
+
449 * @param errorCallback
+
450 * @return previous errorCallback
+
451 */
+ + + +
455 return previousCallback;
+
456 }
+
457
+ +
462
+ +
479
-
480
-
481 int32_t getDelayBeforeCloseMillis() const {
-
482 return mDelayBeforeCloseMillis;
-
483 }
-
484
-
- -
500 mDelayBeforeCloseMillis = delayBeforeCloseMillis;
-
501 }
+
+ +
484 return mErrorCallbackResult;
+
485 }
-
502
-
- -
527 mPerformanceHintEnabled = enabled;
-
528 }
+
486
+
487
+
488 int32_t getDelayBeforeCloseMillis() const {
+
489 return mDelayBeforeCloseMillis;
+
490 }
+
491
+
+ +
507 mDelayBeforeCloseMillis = delayBeforeCloseMillis;
+
508 }
-
529
-
- -
537 return mPerformanceHintEnabled;
-
538 }
+
509
+
+ +
534 mPerformanceHintEnabled = enabled;
+
535 }
-
539
-
540protected:
-
541
-
- -
552 return mErrorCallbackCalled.exchange(true);
-
553 }
+
536
+
+ +
544 return mPerformanceHintEnabled;
+
545 }
-
554
- - - -
564
-
-
572 virtual DataCallbackResult onDefaultCallback(void* /* audioData */, int /* numFrames */) {
-
573 return DataCallbackResult::Stop;
-
574 }
+
546
+
547protected:
+
548
+
+ +
559 return mErrorCallbackCalled.exchange(true);
+
560 }
-
575
- -
585
-
- -
590 return mDataCallbackEnabled;
-
591 }
+
561
+ + + +
571
+
+
579 virtual DataCallbackResult onDefaultCallback(void* /* audioData */, int /* numFrames */) {
+
580 return DataCallbackResult::Stop;
+
581 }
+
582
+
592
-
- -
598 mDataCallbackEnabled = enabled;
-
599 }
+
+ +
597 return mDataCallbackEnabled;
+
598 }
+
+
599
+
+ +
605 mDataCallbackEnabled = enabled;
+
606 }
-
600
- -
606
-
- -
611 if (mDelayBeforeCloseMillis > 0) {
-
612 usleep(mDelayBeforeCloseMillis * 1000);
-
613 }
-
614 }
+
607
+ +
613
+
+ +
618 if (mDelayBeforeCloseMillis > 0) {
+
619 usleep(mDelayBeforeCloseMillis * 1000);
+
620 }
+
621 }
-
615
- -
620
- -
626
-
630 virtual void closePerformanceHint() {}
-
631
-
632 /*
-
633 * Set a weak_ptr to this stream from the shared_ptr so that we can
-
634 * later use a shared_ptr in the error callback.
-
635 */
-
636 void setWeakThis(std::shared_ptr<oboe::AudioStream> &sharedStream) {
-
637 mWeakThis = sharedStream;
-
638 }
-
639
-
640 /*
-
641 * Make a shared_ptr that will prevent this stream from being deleted.
+
622
+ +
627
+ +
633
+
637 virtual void closePerformanceHint() {}
+
638
+
639 /*
+
640 * Set a weak_ptr to this stream from the shared_ptr so that we can
+
641 * later use a shared_ptr in the error callback.
642 */
-
643 std::shared_ptr<oboe::AudioStream> lockWeakThis() {
-
644 return mWeakThis.lock();
+
643 void setWeakThis(std::shared_ptr<oboe::AudioStream> &sharedStream) {
+
644 mWeakThis = sharedStream;
645 }
646
-
647 std::weak_ptr<AudioStream> mWeakThis; // weak pointer to this object
-
648
-
655 std::atomic<int64_t> mFramesWritten{};
-
656
-
663 std::atomic<int64_t> mFramesRead{};
-
664
-
665 std::mutex mLock; // for synchronizing start/stop/close
-
666
-
667 oboe::Result mErrorCallbackResult = oboe::Result::OK;
-
668
- -
674
-
675 // Time to sleep in order to prevent a race condition with a callback after a close().
-
676 // Two milliseconds may be enough but 10 msec is even safer.
-
677 static constexpr int kMinDelayBeforeCloseMillis = 10;
-
678 int32_t mDelayBeforeCloseMillis = kMinDelayBeforeCloseMillis;
-
679
-
680private:
+
647 /*
+
648 * Make a shared_ptr that will prevent this stream from being deleted.
+
649 */
+
650 std::shared_ptr<oboe::AudioStream> lockWeakThis() {
+
651 return mWeakThis.lock();
+
652 }
+
653
+
654 std::weak_ptr<AudioStream> mWeakThis; // weak pointer to this object
+
655
+
662 std::atomic<int64_t> mFramesWritten{};
+
663
+
670 std::atomic<int64_t> mFramesRead{};
+
671
+
672 std::mutex mLock; // for synchronizing start/stop/close
+
673
+
674 oboe::Result mErrorCallbackResult = oboe::Result::OK;
+
675
+
681
-
682 // Log the scheduler if it changes.
-
683 void checkScheduler();
-
684 int mPreviousScheduler = -1;
-
685
-
686 std::atomic<bool> mDataCallbackEnabled{false};
-
687 std::atomic<bool> mErrorCallbackCalled{false};
+
682 // Time to sleep in order to prevent a race condition with a callback after a close().
+
683 // Two milliseconds may be enough but 10 msec is even safer.
+
684 static constexpr int kMinDelayBeforeCloseMillis = 10;
+
685 int32_t mDelayBeforeCloseMillis = kMinDelayBeforeCloseMillis;
+
686
+
687private:
688
-
689 std::atomic<bool> mPerformanceHintEnabled{false}; // set only by app
-
690};
+
689 // Log the scheduler if it changes.
+
690 void checkScheduler();
+
691 int mPreviousScheduler = -1;
+
692
+
693 std::atomic<bool> mDataCallbackEnabled{false};
+
694 std::atomic<bool> mErrorCallbackCalled{false};
+
695
+
696 std::atomic<bool> mPerformanceHintEnabled{false}; // set only by app
+
697};
-
691
-
- -
697 void operator()(AudioStream *audioStream) {
-
698 if (audioStream) {
-
699 audioStream->close();
-
700 }
-
701 delete audioStream;
-
702 }
-
703 };
+
698
+
+ +
704 void operator()(AudioStream *audioStream) {
+
705 if (audioStream) {
+
706 audioStream->close();
+
707 }
+
708 delete audioStream;
+
709 }
+
710 };
-
704} // namespace oboe
+
711} // namespace oboe
-
705
-
706#endif /* OBOE_STREAM_H_ */
+
712
+
713#endif /* OBOE_STREAM_H_ */
Definition AudioStreamBase.h:30
int32_t mChannelCount
Definition AudioStreamBase.h:250
AudioStreamDataCallback * mDataCallback
Definition AudioStreamBase.h:240
@@ -420,57 +420,57 @@
Definition AudioStreamCallback.h:34
Definition AudioStreamCallback.h:101
Definition AudioStream.h:44
-
int32_t mFramesPerBurst
Definition AudioStream.h:673
+
int32_t mFramesPerBurst
Definition AudioStream.h:680
virtual Result pause(int64_t timeoutNanoseconds=kDefaultTimeoutNanos)
-
std::atomic< int64_t > mFramesRead
Definition AudioStream.h:663
+
std::atomic< int64_t > mFramesRead
Definition AudioStream.h:670
virtual Result waitForStateChange(StreamState inputState, StreamState *nextState, int64_t timeoutNanoseconds)=0
-
virtual DataCallbackResult onDefaultCallback(void *, int)
Definition AudioStream.h:572
-
void setDataCallbackEnabled(bool enabled)
Definition AudioStream.h:597
-
bool usesAAudio() const
Definition AudioStream.h:397
+
virtual DataCallbackResult onDefaultCallback(void *, int)
Definition AudioStream.h:579
+
void setDataCallbackEnabled(bool enabled)
Definition AudioStream.h:604
+
bool usesAAudio() const
Definition AudioStream.h:404
virtual AudioApi getAudioApi() const =0
-
int32_t getFramesPerBurst() const
Definition AudioStream.h:231
+
int32_t getFramesPerBurst() const
Definition AudioStream.h:238
virtual Result flush(int64_t timeoutNanoseconds=kDefaultTimeoutNanos)
virtual Result requestStart()=0
-
virtual ResultWithValue< double > calculateLatencyMillis()
Definition AudioStream.h:295
-
virtual ResultWithValue< int32_t > read(void *, int32_t, int64_t)
Definition AudioStream.h:379
+
virtual ResultWithValue< double > calculateLatencyMillis()
Definition AudioStream.h:302
+
virtual ResultWithValue< int32_t > read(void *, int32_t, int64_t)
Definition AudioStream.h:386
virtual bool isXRunCountSupported() const =0
int32_t getBytesPerSample() const
-
virtual ResultWithValue< int32_t > getXRunCount()
Definition AudioStream.h:217
+
virtual ResultWithValue< int32_t > getXRunCount()
Definition AudioStream.h:224
virtual void updateFramesRead()=0
virtual StreamState getState()=0
virtual Result release()
Definition AudioStream.h:90
-
virtual void closePerformanceHint()
Definition AudioStream.h:630
-
int32_t getBytesPerFrame() const
Definition AudioStream.h:242
-
void sleepBeforeClose()
Definition AudioStream.h:610
+
virtual void closePerformanceHint()
Definition AudioStream.h:637
+
int32_t getBytesPerFrame() const
Definition AudioStream.h:249
+
void sleepBeforeClose()
Definition AudioStream.h:617
virtual void updateFramesWritten()=0
virtual Result open()
Definition AudioStream.h:67
-
virtual void beginPerformanceHintInCallback()
Definition AudioStream.h:619
+
virtual void beginPerformanceHintInCallback()
Definition AudioStream.h:626
virtual Result requestFlush()=0
virtual Result requestPause()=0
virtual Result requestStop()=0
-
std::atomic< int64_t > mFramesWritten
Definition AudioStream.h:655
+
std::atomic< int64_t > mFramesWritten
Definition AudioStream.h:662
virtual Result waitForStateTransition(StreamState startingState, StreamState endingState, int64_t timeoutNanoseconds)
-
virtual void * getUnderlyingStream() const
Definition AudioStream.h:409
+
virtual void * getUnderlyingStream() const
Definition AudioStream.h:416
AudioStream(const AudioStreamBuilder &builder)
-
virtual oboe::Result getLastErrorCallbackResult() const
Definition AudioStream.h:476
+
virtual oboe::Result getLastErrorCallbackResult() const
Definition AudioStream.h:483
virtual Result close()
-
bool isPerformanceHintEnabled()
Definition AudioStream.h:536
-
bool wasErrorCallbackCalled()
Definition AudioStream.h:551
+
bool isPerformanceHintEnabled()
Definition AudioStream.h:543
+
bool wasErrorCallbackCalled()
Definition AudioStream.h:558
ResultWithValue< int32_t > getAvailableFrames()
-
virtual ResultWithValue< int32_t > setBufferSizeInFrames(int32_t)
Definition AudioStream.h:201
+
virtual ResultWithValue< int32_t > setBufferSizeInFrames(int32_t)
Definition AudioStream.h:208
virtual int64_t getFramesWritten()
DataCallbackResult fireDataCallback(void *audioData, int numFrames)
ResultWithValue< int32_t > waitForAvailableFrames(int32_t numFrames, int64_t timeoutNanoseconds)
-
virtual Result getTimestamp(clockid_t, int64_t *, int64_t *)
Definition AudioStream.h:320
-
virtual ResultWithValue< int32_t > write(const void *, int32_t, int64_t)
Definition AudioStream.h:361
-
void setPerformanceHintEnabled(bool enabled)
Definition AudioStream.h:526
-
bool isDataCallbackEnabled()
Definition AudioStream.h:589
+
virtual Result getTimestamp(clockid_t, int64_t *, int64_t *)
Definition AudioStream.h:327
+
virtual ResultWithValue< int32_t > write(const void *, int32_t, int64_t)
Definition AudioStream.h:368
+
void setPerformanceHintEnabled(bool enabled)
Definition AudioStream.h:533
+
bool isDataCallbackEnabled()
Definition AudioStream.h:596
virtual Result stop(int64_t timeoutNanoseconds=kDefaultTimeoutNanos)
virtual int64_t getFramesRead()
void calculateDefaultDelayBeforeCloseMillis()
virtual Result start(int64_t timeoutNanoseconds=kDefaultTimeoutNanos)
-
void setDelayBeforeCloseMillis(int32_t delayBeforeCloseMillis)
Definition AudioStream.h:499
-
virtual void endPerformanceHintInCallback(int32_t numFrames)
Definition AudioStream.h:625
+
void setDelayBeforeCloseMillis(int32_t delayBeforeCloseMillis)
Definition AudioStream.h:506
+
virtual void endPerformanceHintInCallback(int32_t numFrames)
Definition AudioStream.h:632
virtual ResultWithValue< FrameTimestamp > getTimestamp(clockid_t)
Definition ResultWithValue.h:47
Definition AudioStream.h:31
@@ -482,7 +482,7 @@
constexpr int64_t kDefaultTimeoutNanos
Definition AudioStream.h:39
constexpr int32_t kUnspecified
Definition Definitions.h:31
DataCallbackResult
Definition Definitions.h:160
-
Definition AudioStream.h:696
+
Definition AudioStream.h:703