本文整理汇总了C++中Mixer::Play方法的典型用法代码示例。如果您正苦于以下问题:C++ Mixer::Play方法的具体用法?C++ Mixer::Play怎么用?C++ Mixer::Play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mixer
的用法示例。
在下文中一共展示了Mixer::Play方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Mixer_Play_Music
void* Mixer_Play_Music(int pathId, int loop, int streaming)
{
if (gOpenRCT2Headless) return 0;
if (streaming) {
const utf8 *filename = get_file_path(pathId);
SDL_RWops* rw = SDL_RWFromFile(filename, "rb");
if (rw == NULL) {
return 0;
}
Source_SampleStream* source_samplestream = new Source_SampleStream;
if (source_samplestream->LoadWAV(rw)) {
Channel* channel = gMixer.Play(*source_samplestream, loop, false, true);
if (!channel) {
delete source_samplestream;
} else {
channel->SetGroup(MIXER_GROUP_RIDE_MUSIC);
}
return channel;
} else {
delete source_samplestream;
return 0;
}
} else {
if (gMixer.LoadMusic(pathId)) {
Channel* channel = gMixer.Play(*gMixer.musicsources[pathId], MIXER_LOOP_INFINITE, false, false);
if (channel) {
channel->SetGroup(MIXER_GROUP_RIDE_MUSIC);
}
return channel;
}
}
return 0;
}
示例2: Mixer_Play_Music
void* Mixer_Play_Music(int pathid)
{
if (gMixer.LoadMusic(pathid)) {
return gMixer.Play(gMixer.musicstreams[pathid], MIXER_LOOP_INFINITE, false);
}
return 0;
}
示例3: Mixer_Play_Effect
void* Mixer_Play_Effect(int id, int loop, int volume, float pan, double rate, int deleteondone)
{
if (id >= SOUND_MAXID) {
return 0;
}
gMixer.Lock();
Channel* channel = gMixer.Play(gMixer.css1streams[id], loop, deleteondone != 0);
if (channel) {
channel->SetVolume(volume);
channel->SetPan(pan);
channel->SetRate(rate);
}
gMixer.Unlock();
return channel;
}
示例4: Mixer_Play_Effect
void* Mixer_Play_Effect(int id, int loop, int volume, float pan, double rate, int deleteondone)
{
if (gOpenRCT2Headless) return 0;
if (!gConfigSound.sound) {
return 0;
}
if (id >= countof(gMixer.css1sources)) {
return 0;
}
gMixer.Lock();
Channel* channel = gMixer.Play(*gMixer.css1sources[id], loop, deleteondone != 0, false);
if (channel) {
channel->SetVolume(volume);
channel->SetPan(pan);
channel->SetRate(rate);
}
gMixer.Unlock();
return channel;
}
示例5: Mixer_Play_Effect
void* Mixer_Play_Effect(size_t id, int loop, int volume, float pan, double rate, int deleteondone)
{
if (gOpenRCT2Headless) return 0;
if (!gConfigSound.sound_enabled) {
return 0;
}
if (id >= Util::CountOf(gMixer.css1sources)) {
log_error("Tried to play an invalid sound id. %i", id);
return 0;
}
gMixer.Lock();
Channel* channel = gMixer.Play(*gMixer.css1sources[id], loop, deleteondone != 0, false);
if (channel) {
channel->SetVolume(volume);
channel->SetPan(pan);
channel->SetRate(rate);
}
gMixer.Unlock();
return channel;
}