当前位置: 首页>>代码示例>>C++>>正文


C++ AudioStream类代码示例

本文整理汇总了C++中AudioStream的典型用法代码示例。如果您正苦于以下问题:C++ AudioStream类的具体用法?C++ AudioStream怎么用?C++ AudioStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AudioStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: blocksignals

/***************************************
* startSendingAudio
*	Helper function
***************************************/
void * AudioStream::startSendingAudio(void *par)
{
    AudioStream *conf = (AudioStream *)par;
    blocksignals();
    Log("SendAudioThread [%d]\n",getpid());
    pthread_exit((void *)conf->SendAudio());
}
开发者ID:flybird119,项目名称:mcumediaserver,代码行数:11,代码来源:audiostream.cpp

示例2: AAudioStream_write

AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream,
                               const void *buffer,
                               int32_t numFrames,
                               int64_t timeoutNanoseconds)
{
    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    if (buffer == nullptr) {
        return AAUDIO_ERROR_NULL;
    }

    // Don't allow writes when playing with a callback.
    if (audioStream->getDataCallbackProc() != nullptr && audioStream->isActive()) {
        ALOGE("Cannot write to a callback stream when running.");
        return AAUDIO_ERROR_INVALID_STATE;
    }

    if (numFrames < 0) {
        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
    } else if (numFrames == 0) {
        return 0;
    }

    aaudio_result_t result = audioStream->write(buffer, numFrames, timeoutNanoseconds);

    return result;
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:26,代码来源:AAudioAudio.cpp

示例3: TimerCallback

// Timer callback for Timer object created by ::Play method.
BOOL AudioStream::TimerCallback (DWORD dwUser)
{
    // dwUser contains ptr to AudioStream object
    AudioStream * pas = (AudioStream *) dwUser;

    return (pas->ServiceBuffer ());
}
开发者ID:NonCreature0714,项目名称:freespace2,代码行数:8,代码来源:AudioStr.cpp

示例4: pushMIDISysex

bool SynthRoute::pushMIDISysex(const Bit8u *sysexData, unsigned int sysexLen, MasterClockNanos refNanos) {
	recorder.recordSysex(sysexData, sysexLen, refNanos);
	AudioStream *stream = audioStream;
	if (stream == NULL) return false;
	quint64 timestamp = stream->estimateMIDITimestamp(refNanos);
	return qSynth.playMIDISysex(sysexData, sysexLen, timestamp);
}
开发者ID:Wyvan,项目名称:munt,代码行数:7,代码来源:SynthRoute.cpp

示例5: flow

	virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) {
		assert(input.isStereo() == stereo);

#ifdef DEBUG_RATECONV
		debug("Copy st=%d rev=%d", stereo, reverseStereo);
#endif
		st_size_t len;
                st_sample_t *ostart = obuf;

		if (stereo)
			osamp *= 2;

		// Reallocate temp buffer, if necessary
		if (osamp > _bufferSize) {
			free(_buffer);
			_buffer = (st_sample_t *)malloc(osamp * 2);
			_bufferSize = osamp;
		}

		// Read up to 'osamp' samples into our temporary buffer
		len = input.readBuffer(_buffer, osamp);
		if (len <= 0)
			return 0;

		// Mix the data into the output buffer
		if (stereo && reverseStereo)
			obuf = ARM_CopyRate_R(len, obuf, vol_l, vol_r, _buffer);
		else if (stereo)
			obuf = ARM_CopyRate_S(len, obuf, vol_l, vol_r, _buffer);
		else
			obuf = ARM_CopyRate_M(len, obuf, vol_l, vol_r, _buffer);

		return (obuf-ostart)/2;
	}
开发者ID:nuvie,项目名称:nuvie,代码行数:34,代码来源:rate_arm.cpp

示例6: createAudioStream

size_t ASFStream::readBuffer(int16 *buffer, const size_t numSamples) {
	size_t samplesDecoded = 0;

	for (;;) {
		if (_curAudioStream) {
			const size_t n = _curAudioStream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
			if (n == kSizeInvalid)
				return kSizeInvalid;

			samplesDecoded += n;

			if (_curAudioStream->endOfData()) {
				delete _curAudioStream;
				_curAudioStream = 0;
			}
		}

		if (samplesDecoded == numSamples || endOfData())
			break;

		if (!_curAudioStream) {
			_curAudioStream = createAudioStream();
		}

	}

	return samplesDecoded;
}
开发者ID:TC01,项目名称:xoreos,代码行数:28,代码来源:asf.cpp

示例7: AAudioStream_requestStart

AAUDIO_API aaudio_result_t  AAudioStream_requestStart(AAudioStream* stream)
{
    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    ALOGD("AAudioStream_requestStart(%p) called --------------", stream);
    aaudio_result_t result = audioStream->systemStart();
    ALOGD("AAudioStream_requestStart(%p) returned %d ---------", stream, result);
    return result;
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:8,代码来源:AAudioAudio.cpp

示例8: AAudioStream_waitForStateChange

AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream,
                                            aaudio_stream_state_t inputState,
                                            aaudio_stream_state_t *nextState,
                                            int64_t timeoutNanoseconds)
{

    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    return audioStream->waitForStateChange(inputState, nextState, timeoutNanoseconds);
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:9,代码来源:AAudioAudio.cpp

示例9: get_audio_stream

void AudioManager::stop_stream(int stream_idx)
{
	if (stream_idx < 0)
		return;

	AudioStream *strm = get_audio_stream(stream_idx);
	if (strm && strm->is_playing())
		strm->stop();

}
开发者ID:Gordath,项目名称:mars2030,代码行数:10,代码来源:audio_manager.cpp

示例10: AAudioStream_close

AAUDIO_API aaudio_result_t  AAudioStream_close(AAudioStream* stream)
{
    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    ALOGD("AAudioStream_close(%p)", stream);
    if (audioStream != nullptr) {
        audioStream->close();
        audioStream->unregisterPlayerBase();
        delete audioStream;
        return AAUDIO_OK;
    }
    return AAUDIO_ERROR_NULL;
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:12,代码来源:AAudioAudio.cpp

示例11: AAudioStream_getTimestamp

AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream,
                                      clockid_t clockid,
                                      int64_t *framePosition,
                                      int64_t *timeNanoseconds)
{
    AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
    if (framePosition == nullptr) {
        return AAUDIO_ERROR_NULL;
    } else if (timeNanoseconds == nullptr) {
        return AAUDIO_ERROR_NULL;
    } else if (clockid != CLOCK_MONOTONIC && clockid != CLOCK_BOOTTIME) {
        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
    }

    return audioStream->getTimestamp(clockid, framePosition, timeNanoseconds);
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:16,代码来源:AAudioAudio.cpp

示例12: checkAndSave

void Laboratory::checkAndSave(TrialsSet& trialsSet, AudioStream& audioStream, InputAudioParameters& str, CheckMethodType checkMethod, std::string folderForAudioResults ) {
    //Check - write result to file
    if(str.data_source == AudioStream::AUDIO_FILE_AS_SOURCE) {
        audioStream.close       (resultsPath_  + folderForAudioResults + std::string("/")  + str.outFileName, true);
        audioStream.cutAndClose (resultsPath_  + folderForAudioResults + std::string("/")  + std::string("cutted__") +str.outFileName, trialsSet, false );
    }
    if(str.data_source == AudioStream::RANDOM_DATA_AS_SOURCE)
        if(checkMethod == CheckMethodType::ifOutSilence)
            if(audioStream.checkIfOutSilence())
                throw UnkownInternalProcessingError_Exception();
    
    if(checkMethod == CheckMethodType::ifTheInTheSameAsOut)
        if(!audioStream.checkIfOutTheSameAsIn())
            throw UnkownInternalProcessingError_Exception();
    //.
}
开发者ID:felidadae,项目名称:dsp_opencl_gpu,代码行数:16,代码来源:Laboratory.cpp

示例13: lock

int QueuingAudioStreamImpl::readBuffer(int16 *buffer, const int numSamples) {
	Common::StackLock lock(_mutex);
	int samplesDecoded = 0;

	while (samplesDecoded < numSamples && !_queue.empty()) {
		AudioStream *stream = _queue.front()._stream;
		samplesDecoded += stream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);

		if (stream->endOfData()) {
			StreamHolder tmp = _queue.pop();
			if (tmp._disposeAfterUse == DisposeAfterUse::YES)
				delete stream;
		}
	}

	return samplesDecoded;
}
开发者ID:Termimad,项目名称:scummvm,代码行数:17,代码来源:audiostream.cpp

示例14: pushMIDIShortMessage

bool SynthRoute::pushMIDIShortMessage(Bit32u msg, MasterClockNanos refNanos) {
	recorder.recordShortMessage(msg, refNanos);
	AudioStream *stream = audioStream;
	if (stream == NULL) return false;
	quint64 timestamp = stream->estimateMIDITimestamp(refNanos);
	if (msg == 0) {
		// This is a special event sent by the test driver
		qint64 delta = qint64(timestamp - debugLastEventTimestamp);
		MasterClockNanos debugEventNanoOffset = (refNanos == 0) ? 0 : MasterClock::getClockNanos() - refNanos;
		if ((delta < debugDeltaLowerLimit) || (debugDeltaUpperLimit < delta) || ((15 * MasterClock::NANOS_PER_MILLISECOND) < debugEventNanoOffset)) {
			qDebug() << "M" << delta << timestamp << 1e-6 * debugEventNanoOffset;
		}
		debugLastEventTimestamp = timestamp;
		return false;
	}
	return qSynth.playMIDIShortMessage(msg, timestamp);
}
开发者ID:Wyvan,项目名称:munt,代码行数:17,代码来源:SynthRoute.cpp

示例15: AAudioStreamBuilder_openStream

AAUDIO_API aaudio_result_t  AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder,
                                                     AAudioStream** streamPtr)
{
    AudioStream *audioStream = nullptr;
    // Please leave these logs because they are very helpful when debugging.
    ALOGD("AAudioStreamBuilder_openStream() called ----------------------------------------");
    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(streamPtr);
    aaudio_result_t result = streamBuilder->build(&audioStream);
    ALOGD("AAudioStreamBuilder_openStream() returns %d = %s for (%p) ----------------",
          result, AAudio_convertResultToText(result), audioStream);
    if (result == AAUDIO_OK) {
        audioStream->registerPlayerBase();
        *streamPtr = (AAudioStream*) audioStream;
    } else {
        *streamPtr = nullptr;
    }
    return result;
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:18,代码来源:AAudioAudio.cpp


注:本文中的AudioStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。