コード例 #1
0
ファイル: xm.c プロジェクト: markkings/reversi
void _abort(void)
{
#ifdef AMIGA
  Enable_Abort = 0;
#endif

  FreeInter();

  // kill player

  if (pipes) {

    // if (!PipeSyncSendEXIT(TO_1)) { SLEEP(10); SyncSendEXIT(TO_1); }
    // if (!PipeSyncSendEXIT(TO_2)) { SLEEP(10); SyncSendEXIT(TO_2); }
    
  } else {

    if (!SyncSendEXIT(TO_1)) { SLEEP(10); SyncSendEXIT(TO_1); }
    if (!SyncSendEXIT(TO_2)) { SLEEP(10); SyncSendEXIT(TO_2); }

    SLEEP(10);
    
    KillChannel(TO_1);   KillChannel(TO_2);
    KillChannel(FROM_1); KillChannel(FROM_2);
  }

  exit(1);
}
コード例 #2
0
void CChannelHandlerVRC6::PlayChannelNote(stChanNote *pNoteData, int EffColumns)
{
	CInstrumentVRC6 *pInstrument;
	int PostEffect = 0, PostEffectParam;

	int LastInstrument = m_iInstrument;

	if (!CChannelHandler::CheckNote(pNoteData, INST_VRC6))
		return;

	unsigned int Note, Octave;
	unsigned int Volume;

	Note	= pNoteData->Note;
	Octave	= pNoteData->Octave;
	Volume	= pNoteData->Vol;

	if (Note != 0)
	{
		m_bRelease = false;
	}
	else
	{
		if (pNoteData->Instrument != MAX_INSTRUMENTS)
			m_iInstrument = pNoteData->Instrument;
	}

	if (Note == RELEASE)
	{
		m_bRelease = true;
		m_iInstrument = LastInstrument;
	}
	else if (Note == HALT)
	{
		m_iInstrument	= LastInstrument;
	}

	// Evaluate effects
	for (int n = 0; n < EffColumns; n++) {
		int EffCmd	 = pNoteData->EffNumber[n];
		int EffParam = pNoteData->EffParam[n];

		if (!CheckCommonEffects(EffCmd, EffParam)) {
			switch (EffCmd) {
				case EF_DUTY_CYCLE:
					m_iDefaultDuty = m_iDutyPeriod = EffParam;
					break;
				case EF_SLIDE_UP:
				case EF_SLIDE_DOWN:
					PostEffect = EffCmd;
					PostEffectParam = EffParam;
					SetupSlide(EffCmd, EffParam);
					break;
			}
		}
	}

	pInstrument = (CInstrumentVRC6*)m_pDocument->GetInstrument(m_iInstrument);

	if (!pInstrument)
		return;

	if ((LastInstrument != m_iInstrument) || (Note > 0 && Note != HALT && Note != RELEASE))
	{
		// Setup instrument
		for (int i = 0; i < CInstrumentVRC6::SEQUENCE_COUNT; i++)
		{
			m_iSeqEnabled[i] = pInstrument->GetSeqEnable(i);
			m_iSeqIndex[i]	 = pInstrument->GetSeqIndex(i);
			m_iSeqPointer[i] = 0;
		}
	}

	// Get volume
	if (Volume < 0x10)
		m_iVolume = Volume << VOL_SHIFT;

	if (Note == HALT)
	{
		KillChannel();
		return;
	}

	// No note
	if (!Note)
		return;

	if (!m_bRelease)
	{
		// Get the note
		m_iNote				= RunNote(Octave, Note);
		m_iSeqVolume		= 0xF;
		m_iDutyPeriod		= m_iDefaultDuty;
		m_bEnabled			= true;
		m_iLastInstrument	= m_iInstrument;
	}
	else
	{
		ReleaseNote();
		ReleaseSequences(SNDCHIP_VRC6);
	}

	if (PostEffect && (m_iEffect == EF_SLIDE_UP || m_iEffect == EF_SLIDE_DOWN))
		SetupSlide(PostEffect, PostEffectParam);
	else if (m_iEffect == EF_SLIDE_DOWN || m_iEffect == EF_SLIDE_UP)
		m_iEffect = EF_NONE;
}