Exemple #1
0
 void OnTerminate(int pid, int status)
 {
     while (HasInput()) {}
     m_data->Running = false;
     m_data->ExitCode = status;
     wxProcess::OnTerminate(pid, status);
 }
Exemple #2
0
void MarkdownProcess::OnTerminate(int pid, int status)
{
    // show the rest of the output
    while ( HasInput() )
        ;
	//wxMemoryFSHandler::AddFile("temp.html", m_file);

	m_parent->DoIt();

    delete this;
}
Exemple #3
0
void PipedProcess::OnTerminate(int pid, int status)
{
    // show the rest of the output
    while ( HasInput() )
        ;

	CodeBlocksEvent event(cbEVT_PIPEDPROCESS_TERMINATED, m_Id);
    event.SetInt(status);
//   	m_Parent->ProcessEvent(event);
	wxPostEvent(m_Parent, event);

	if (m_pvThis)
		*m_pvThis = 0L;
    delete this;
}
bool
Tokenizer::Next(Token& aToken)
{
  if (!HasInput()) {
    mHasFailed = true;
    return false;
  }

  mRollback = mCursor;
  mCursor = Parse(aToken);

  aToken.AssignFragment(mRollback, mCursor);

  mPastEof = aToken.Type() == TOKEN_EOF;
  mHasFailed = false;
  return true;
}
ComponentResult	AUInlineEffectBase::RenderBus(AudioUnitRenderActionFlags & flags, 
												const AudioTimeStamp & timestamp, UInt32 bus, UInt32 frames)
{
	if ((bus != 0) || (! HasInput(0))) {
		return kAudioUnitErr_NoConnection;
	}

	ComponentResult	result;
	AUInputElement *theInput = GetInput(0);
	result = theInput->PullInput(flags, timestamp, 0, frames);
	if (result == noErr) {
		AudioBufferList &	inputbuffers = theInput->GetBufferList();
		if (! IsBypassEffect()) {
			result = ProcessBufferLists(flags, inputbuffers, inputbuffers, frames);
		}
		GetOutput(0)->SetBufferList(inputbuffers);
	}
	
	return result;
}
bool
Tokenizer::Check(const Token& aToken)
{
  if (!HasInput()) {
    mHasFailed = true;
    return false;
  }

  Token parsed;
  nsACString::const_char_iterator next = Parse(parsed);
  if (!aToken.Equals(parsed)) {
    mHasFailed = true;
    return false;
  }

  mRollback = mCursor;
  mCursor = next;
  mPastEof = parsed.Type() == TOKEN_EOF;
  mHasFailed = false;
  return true;
}
bool
Tokenizer::Check(const TokenType aTokenType, Token& aResult)
{
  if (!HasInput()) {
    mHasFailed = true;
    return false;
  }

  nsACString::const_char_iterator next = Parse(aResult);
  if (aTokenType != aResult.Type()) {
    mHasFailed = true;
    return false;
  }

  mRollback = mCursor;
  mCursor = next;

  aResult.AssignFragment(mRollback, mCursor);

  mPastEof = aResult.Type() == TOKEN_EOF;
  mHasFailed = false;
  return true;
}
bool
Tokenizer::CheckChar(bool (*aClassifier)(const char aChar))
{
  if (!aClassifier) {
    MOZ_ASSERT(false);
    return false;
  }

  if (!HasInput() || mCursor == mEnd) {
    mHasFailed = true;
    return false;
  }

  if (!aClassifier(*mCursor)) {
    mHasFailed = true;
    return false;
  }

  mRollback = mCursor;
  ++mCursor;
  mHasFailed = false;
  return true;
}
Exemple #9
0
void PipedProcess::OnIdle(wxIdleEvent& event)
{
    while (HasInput())
		;
}
Exemple #10
0
OSStatus 	AUEffectBase::Render(	AudioUnitRenderActionFlags &ioActionFlags,
											const AudioTimeStamp &		inTimeStamp,
											UInt32						nFrames)
{
	if (!HasInput(0))
		return kAudioUnitErr_NoConnection;

	OSStatus result = noErr;

	result = mMainInput->PullInput(ioActionFlags, inTimeStamp, 0 /* element */, nFrames);

	if (result == noErr)
	{
		if(ProcessesInPlace() && mMainOutput->WillAllocateBuffer())
		{
			mMainOutput->SetBufferList(mMainInput->GetBufferList() );
		}

		if (ShouldBypassEffect())
		{
			// leave silence bit alone

			if(!ProcessesInPlace() )
			{
				mMainInput->CopyBufferContentsTo (mMainOutput->GetBufferList());
			}
		}
		else
		{
			if(mParamList.size() == 0 )
			{
				// this will read/write silence bit
				result = ProcessBufferLists(ioActionFlags, mMainInput->GetBufferList(), mMainOutput->GetBufferList(), nFrames);
			}
			else
			{
				// deal with scheduled parameters...

				AudioBufferList &inputBufferList = mMainInput->GetBufferList();
				AudioBufferList &outputBufferList = mMainOutput->GetBufferList();

				ScheduledProcessParams processParams;
				processParams.actionFlags = &ioActionFlags;
				processParams.inputBufferList = &inputBufferList;
				processParams.outputBufferList = &outputBufferList;

				// divide up the buffer into slices according to scheduled params then
				// do the DSP for each slice (ProcessScheduledSlice() called for each slice)
				result = ProcessForScheduledParams(	mParamList,
													nFrames,
													&processParams );


				// fixup the buffer pointers to how they were before we started
				UInt32 channelSize = nFrames * mBytesPerFrame;
				for(unsigned int i = 0; i < inputBufferList.mNumberBuffers; i++ ) {
					UInt32 size = inputBufferList.mBuffers[i].mNumberChannels * channelSize;
					inputBufferList.mBuffers[i].mData = (char *)inputBufferList.mBuffers[i].mData - size;
					inputBufferList.mBuffers[i].mDataByteSize = size;
				}

				for(unsigned int i = 0; i < outputBufferList.mNumberBuffers; i++ ) {
					UInt32 size = outputBufferList.mBuffers[i].mNumberChannels * channelSize;
					outputBufferList.mBuffers[i].mData = (char *)outputBufferList.mBuffers[i].mData - size;
					outputBufferList.mBuffers[i].mDataByteSize = size;
				}
			}
		}

		if ( (ioActionFlags & kAudioUnitRenderAction_OutputIsSilence) && !ProcessesInPlace() )
		{
			AUBufferList::ZeroBuffer(mMainOutput->GetBufferList() );
		}
	}

	return result;
}
OSStatus Talkbox::Render(AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inFramesToProcess)
{
	if (! HasInput(0) )
{
//fprintf(stderr, "no input bus 0 connection\n");
		return kAudioUnitErr_NoConnection;
}

	OSStatus status = noErr;
	AUOutputElement * theOutput = GetOutput(0);	// throws if error

	AUInputElement * theInput = GetInput(0);
	status = theInput->PullInput(ioActionFlags, inTimeStamp, 0 /* element */, inFramesToProcess);
	if (status != noErr)
		return status;
	
	if (status == noErr)
	{
		if ( ProcessesInPlace() )
		{
			theOutput->SetBufferList( theInput->GetBufferList() );
		}

		AUInputElement * theInput2 = NULL;
		try
		{
			if ( HasInput(1) )
				theInput2 = GetInput(1);
		}
		catch (...) { theInput2 = NULL; }
		if (theInput2 != NULL)
		{
			bool mainInputSilentFlag = (ioActionFlags & kAudioUnitRenderAction_OutputIsSilence) ? true : false;
			status = theInput2->PullInput(ioActionFlags, inTimeStamp, 1 /* element */, inFramesToProcess);
//if (result != noErr) fprintf(stderr, "PullInput(bus 1) error %ld\n", result);
			if ( !mainInputSilentFlag && (ioActionFlags & kAudioUnitRenderAction_OutputIsSilence) )
				ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;
		}
		else
{
			status = kAudioUnitErr_NoConnection;
//fprintf(stderr, "could not access input bus 1 connection\n");
}

		if ( ShouldBypassEffect() || (status != noErr) )
		{
			status = noErr;
			// leave silence bit alone
			if (! ProcessesInPlace() )
			{
				theInput->CopyBufferContentsTo( theOutput->GetBufferList() );
			}
		}
		else
		{
			for (UInt32 i=0; i < numAllocatedChannels; i++)
			{
				dspKernels[i]->Process(theInput->GetChannelData(i), 
										theInput2->GetChannelData(i), 
										theOutput->GetChannelData(i), 
										inFramesToProcess);
			}
		}
	}

	return status;
}