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


C++ CChannel::SetLoop方法代码示例

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


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

示例1: Play

int CALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, float frequency, bool loop)
{
    if (!m_enabled)
    {
        return -1;
    }
    if (m_sounds.find(sound) == m_sounds.end())
    {
        GetLogger()->Debug("Sound %d was not loaded!\n", sound);
        return -1;
    }

    int channel;
    bool alreadyLoaded = false;
    if (!SearchFreeBuffer(sound, channel, alreadyLoaded))
    {
        return -1;
    }

    if (!alreadyLoaded)
    {
        if (!m_channels[channel]->SetBuffer(m_sounds[sound].get()))
        {
            m_channels[channel]->SetBuffer(nullptr);
            return -1;
        }
    }

    CChannel* chn = m_channels[channel].get();

    chn->SetPosition(pos);
    chn->SetVolumeAtrib(1.0f);

    // setting initial values
    chn->SetStartAmplitude(amplitude);
    chn->SetStartFrequency(frequency);
    chn->SetChangeFrequency(1.0f);
    chn->ResetOper();
    chn->SetFrequency(frequency);
    chn->SetVolume(powf(amplitude * chn->GetVolumeAtrib(), 0.2f) * m_audioVolume);
    chn->SetLoop(loop);
    chn->Mute(false);

    if (!chn->Play())
    {
        m_channelsLimit = m_channels.size() - 1;
        GetLogger()->Debug("Changing channel limit to %u.\n", m_channelsLimit);
        m_channels.erase(channel);

        return -1;
    }

    return channel | ((chn->GetId() & 0xffff) << 16);
}
开发者ID:CyborgMaster,项目名称:colobot,代码行数:54,代码来源:alsound.cpp

示例2: RestoreUndoState

void CMixereView::RestoreUndoState(const CUndoState& State)
{
	if (State.GetCode() < START_UCODE) {	// if base class undo code
		CFormListView::RestoreUndoState(State);	// defer to base class
		return;
	}
	if (State.GetCode() > END_UCODE) {		// if snapshot undo code
		m_Snapshot->RestoreUndoState(State);	// defer to snapshot class
		return;
	}
	CWaitCursor	wc;
	switch (State.GetCode()) {
	case UCODE_TRANSPORT:
		{
			TRANSPORT_UNDO_STATE	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++, uap++) {
				CChannel	*Chan = GetChan(uap->m_ChanIdx);
				Chan->SetTransportAndPos(uap->m_Transport, uap->m_Pos);
			}
		}
		break;
	case UCODE_GO:
		{
			GO_UNDO_STATE	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++, uap++) {
				CChannel	*Chan = GetChan(uap->m_ChanIdx);
				for (int j = 0; j < CChanInfo::AUTOS; j++) {
					Chan->GetAuto(j)->SetTransport(uap->m_Auto[j].m_Transport);
					Chan->GetAuto(j)->SetNormPos(uap->m_Auto[j].m_Pos);
				}
				Chan->SetTransportAndPos(uap->m_Transport, uap->m_Pos);
			}
		}
		break;
	case UCODE_LOOP:
		{
			bool	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++)
				GetChan(i)->SetLoop(uap[i]);
		}
		break;
	case UCODE_MUTE:
		{
			bool	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++)
				GetChan(i)->SetMute(uap[i]);
		}
		break;
	case UCODE_SOLO:
	case UCODE_END_SOLO:
		{
			bool	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++)
				GetChan(i)->SetSolo(uap[i]);
		}
		break;
	case UCODE_KEEP_SOLO:
		{
			BYTE	*uap;
			GetUndoArray(uap, State);
			for (int i = 0; i < UValItems(State); i++) {
				GetChan(i)->SetMute((uap[i] & 0x1) != 0);
				GetChan(i)->SetSolo((uap[i] & 0x2) != 0);
			}
		}
		break;
	case UCODE_LOAD_AUDIO:
		{
			CChanInfo	*uap;
			GetUndoArray(uap, State);
			if ((UValFlags(State) & UFLAG_DIR) == UFLAG_INS) {
				GetChan(uap->m_Index)->OpenItem(uap);
				GetChan(uap->m_Index)->SetInfo(uap);
			} else
				GetChan(uap->m_Index)->Reset();
		}
		break;
	case UCODE_INSERT_AUDIO:
		RestoreUndoItems(State);
		break;
	case UCODE_SHOW_VOLUME:
	case UCODE_SHOW_SNAPSHOT:
	case UCODE_SHOW_MS_FADE:
	case UCODE_SHOW_TEMPO:
		ShowDlgBar(UValBarNum(State) - 1, UValShowBar(State) != 0);
		break;
	case UCODE_SET_DEFAULTS:
		{
			CChanInfo	*uap;
			GetUndoArray(uap, State);
			m_ChanDefaults = *uap;
		}
		break;
	case UCODE_EDIT_AUTO:
		{
//.........这里部分代码省略.........
开发者ID:victimofleisure,项目名称:Mixere,代码行数:101,代码来源:MixereView.cpp


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