| 692 | //----------------------------------------------------------------------------- |
| 693 | |
| 694 | SFXBuffer* SFXSystem::_createBuffer( const ThreadSafeRef< SFXStream >& stream, SFXDescription* description ) |
| 695 | { |
| 696 | // The buffers are created by the active |
| 697 | // device... without one we cannot do anything. |
| 698 | if ( !mDevice ) |
| 699 | { |
| 700 | Con::errorf( "SFXSystem::_createBuffer - No sound device initialized!!" ); |
| 701 | return NULL; |
| 702 | } |
| 703 | |
| 704 | // Some sanity checking for streaming. If the stream isn't at least three packets |
| 705 | // in size given the current settings in "description", then turn off streaming. |
| 706 | // The device code *will* mess up if the stream input fails to match certain metrics. |
| 707 | // Just disabling streaming when it doesn't make sense is easier than complicating the |
| 708 | // device logic to account for bad metrics. |
| 709 | |
| 710 | bool streamFlag = description->mIsStreaming; |
| 711 | if( description->mIsStreaming |
| 712 | && stream->getDuration() < description->mStreamPacketSize * 1000 * SFXInternal::SFXAsyncQueue::DEFAULT_STREAM_QUEUE_LENGTH ) |
| 713 | description->mIsStreaming = false; |
| 714 | |
| 715 | SFXBuffer* buffer = mDevice->createBuffer( stream, description ); |
| 716 | |
| 717 | description->mIsStreaming = streamFlag; // restore in case we stomped it |
| 718 | return buffer; |
| 719 | } |
| 720 | |
| 721 | //----------------------------------------------------------------------------- |
| 722 |
no test coverage detected