本文整理汇总了C++中AUD_Reference::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ AUD_Reference::stop方法的具体用法?C++ AUD_Reference::stop怎么用?C++ AUD_Reference::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AUD_Reference
的用法示例。
在下文中一共展示了AUD_Reference::stop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mix
void AUD_SoftwareDevice::mix(data_t* buffer, int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
lock();
{
AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound;
int len;
int pos;
bool eos;
std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > stopSounds;
std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> > pauseSounds;
sample_t* buf = m_buffer.getBuffer();
m_mixer->clear(length);
// for all sounds
AUD_HandleIterator it = m_playingSounds.begin();
while(it != m_playingSounds.end())
{
sound = *it;
// increment the iterator to make sure it's valid,
// in case the sound gets deleted after stopping
++it;
// get the buffer from the source
pos = 0;
len = length;
// update 3D Info
sound->update();
sound->m_reader->read(len, eos, buf);
// in case of looping
while(pos + len < length && sound->m_loopcount && eos)
{
m_mixer->mix(buf, pos, len, sound->m_volume);
pos += len;
if(sound->m_loopcount > 0)
sound->m_loopcount--;
sound->m_reader->seek(0);
len = length - pos;
sound->m_reader->read(len, eos, buf);
// prevent endless loop
if(!len)
break;
}
m_mixer->mix(buf, pos, len, sound->m_volume);
// in case the end of the sound is reached
if(eos && !sound->m_loopcount)
{
if(sound->m_stop)
sound->m_stop(sound->m_stop_data);
if(sound->m_keep)
pauseSounds.push_back(sound);
else
stopSounds.push_back(sound);
}
}
// superpose
m_mixer->read(buffer, m_volume);
// cleanup
while(!stopSounds.empty())
{
sound = stopSounds.front();
stopSounds.pop_front();
sound->stop();
}
while(!pauseSounds.empty())
{
sound = pauseSounds.front();
pauseSounds.pop_front();
sound->pause();
}
}
unlock();
}
示例2: read
void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
{
m_factory->lock();
if(m_factory->m_status != m_status)
{
m_device.changeSpecs(m_factory->m_specs);
m_device.setSpeedOfSound(m_factory->m_speed_of_sound);
m_device.setDistanceModel(m_factory->m_distance_model);
m_device.setDopplerFactor(m_factory->m_doppler_factor);
m_status = m_factory->m_status;
}
if(m_factory->m_entry_status != m_entry_status)
{
std::list<AUD_Reference<AUD_SequencerHandle> > handles;
AUD_HandleIterator hit = m_handles.begin();
AUD_EntryIterator eit = m_factory->m_entries.begin();
int result;
AUD_Reference<AUD_SequencerHandle> handle;
while(hit != m_handles.end() && eit != m_factory->m_entries.end())
{
handle = *hit;
AUD_Reference<AUD_SequencerEntry> entry = *eit;
result = handle->compare(entry);
if(result < 0)
{
handle = new AUD_SequencerHandle(entry, m_device);
handles.push_front(handle);
eit++;
}
else if(result == 0)
{
handles.push_back(handle);
hit++;
eit++;
}
else
{
handle->stop();
hit++;
}
}
while(hit != m_handles.end())
{
(*hit)->stop();
hit++;
}
while(eit != m_factory->m_entries.end())
{
handle = new AUD_SequencerHandle(*eit, m_device);
handles.push_front(handle);
eit++;
}
m_handles = handles;
m_entry_status = m_factory->m_entry_status;
}
AUD_Specs specs = m_factory->m_specs;
int pos = 0;
float time = float(m_position) / float(specs.rate);
float volume, frame;
int len, cfra;
AUD_Vector3 v, v2;
AUD_Quaternion q;
while(pos < length)
{
frame = time * m_factory->m_fps;
cfra = int(floor(frame));
len = int(ceil((cfra + 1) / m_factory->m_fps * specs.rate)) - m_position;
len = AUD_MIN(length - pos, len);
len = AUD_MAX(len, 1);
for(AUD_HandleIterator it = m_handles.begin(); it != m_handles.end(); it++)
{
(*it)->update(time, frame);
}
m_factory->m_volume.read(frame, &volume);
m_device.setVolume(volume);
m_factory->m_orientation.read(frame, q.get());
m_device.setListenerOrientation(q);
m_factory->m_location.read(frame, v.get());
m_device.setListenerLocation(v);
m_factory->m_location.read(frame + 1, v2.get());
v2 -= v;
//.........这里部分代码省略.........