本文整理汇总了C++中Mixer类的典型用法代码示例。如果您正苦于以下问题:C++ Mixer类的具体用法?C++ Mixer怎么用?C++ Mixer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mixer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mh_loadPatch_DEPR_
void mh_loadPatch_DEPR_(bool isProject, const char *projPath)
{
G_Mixer.init();
G_Mixer.ready = false; // put it in wait mode
int numChans = G_Patch_DEPR_.getNumChans();
for (int i=0; i<numChans; i++) {
Channel *ch = glue_addChannel(G_Patch_DEPR_.getColumn(i), G_Patch_DEPR_.getType(i));
string projectPath = projPath; // safe
string samplePath = isProject ? projectPath + G_SLASH + G_Patch_DEPR_.getSamplePath(i) : "";
ch->readPatch_DEPR_(samplePath.c_str(), i, &G_Patch_DEPR_, G_Conf.samplerate,
G_Conf.rsmpQuality);
}
G_Mixer.outVol = G_Patch_DEPR_.getOutVol();
G_Mixer.inVol = G_Patch_DEPR_.getInVol();
G_Mixer.bpm = G_Patch_DEPR_.getBpm();
G_Mixer.bars = G_Patch_DEPR_.getBars();
G_Mixer.beats = G_Patch_DEPR_.getBeats();
G_Mixer.quantize = G_Patch_DEPR_.getQuantize();
G_Mixer.metronome = G_Patch_DEPR_.getMetronome();
G_Patch_DEPR_.lastTakeId = G_Patch_DEPR_.getLastTakeId();
G_Patch_DEPR_.samplerate = G_Patch_DEPR_.getSamplerate();
/* rewind and update frames in Mixer (it's vital) */
G_Mixer.rewind();
G_Mixer.updateFrameBars();
G_Mixer.ready = true;
}
示例2: getWidth
void Channels::resized()
{
channelsLabel->setBounds (4, 4, getWidth() - 8, 12);
addButton->setBounds (getWidth() - 15, 0, 15, 16);
expandButton->setBounds (getWidth() - 15, 0, 15, 16);
ignoreButton->setBounds (getWidth() - 15, 16, 15, 16);
//[UserResized] Add your own custom resize handling here..
// position add/config/expand buttons
int btn_x = getWidth() - GUI::HOVER_BTN_W ;
int btn_y = 0 ;
int btn_w = GUI::HOVER_BTN_W ;
int btn_h = GUI::HOVER_BTN_H ;
this->addButton ->setBounds(btn_x , btn_y , btn_w , btn_h) ;
this->expandButton->setBounds(btn_x , btn_y , btn_w , btn_h) ;
this->ignoreButton->setBounds(btn_x , btn_y , btn_w , btn_h) ;
// resize this container
int n_channels = getNumChannels() ;
int channels_w = GUI::MIXERGROUP_W((n_channels)? n_channels : 1) ;
int channels_h = GUI::MIXERGROUP_H ;
setSize(channels_w , channels_h) ;
// shift child channels
for (int channel_n = 0 ; channel_n < n_channels ; ++channel_n)
{
int channel_x = GUI::MIXERGROUP_W(channel_n) ;
getChildComponent(channel_n)->setTopLeftPosition(channel_x , GUI::CHANNEL_Y) ;
}
// update mixer layout
Mixer* mixer = (Mixer*)getParentComponent() ; if (mixer) mixer->resized() ;
//[/UserResized]
}
示例3: new_voice
void Prog::initial_config()
{
Voice *voice = new_voice();
if (!voice) {
abort_example("Could not create initial voice.\n");
}
voice->set_pos(300, 50);
Mixer *mixer = new_mixer();
mixer->set_pos(300, 150);
voice->attach(mixer);
SampleInstance *splinst = new_sample_instance();
splinst->set_pos(220, 300);
mixer->attach(splinst);
splinst->toggle_playing();
SampleInstance *splinst2 = new_sample_instance();
splinst2->set_pos(120, 240);
mixer->attach(splinst2);
splinst2->toggle_playing();
Mixer *mixer2 = new_mixer();
mixer2->set_pos(500, 250);
mixer->attach(mixer2);
Audiostream *stream;
if ((stream = new_audiostream())) {
stream->set_pos(450, 350);
mixer2->attach(stream);
}
}
示例4: main
int main(int argc, const char * argv[])
{
Oscilator* o1 = new Oscilator(BUFFER_SIZE, 440.0, 1.0);
o1->setWaveform(SQUARE);
Oscilator* o2 = new Oscilator(BUFFER_SIZE, 440.0, 1.0);
o2->setWaveform(SINE);
Envelope* e1 = new Envelope(0.01, 0.2, 0.6, 0.5);
o1->setAmplitude(e1);
Envelope* e2 = new Envelope(0.1, 0.5, 1.0, 0.2);
o2->setAmplitude(e2);
TriggerMixer *tmix = new TriggerMixer(2);
tmix->addInput(e1, 0);
tmix->addInput(e2, 1);
Controller* c = new MonoController(tmix, 0.0, new FrequencyTable());
o1->setFrequency(c);
Multiplier* octaver = new Multiplier(c, 0.5);
o2->setFrequency(octaver);
Mixer* mix = new Mixer(BUFFER_SIZE, 2);
mix->addInput(o1, 0, 0.3);
mix->addInput(o2, 1, 2.0);
// Run the synth!
Synthesizer *s = new Synthesizer(BUFFER_SIZE, mix, c);
return 0;
}
示例5: 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;
}
示例6: tolua_aps_sound_Mixer_sound_Mixer_setGain00
static int tolua_aps_sound_Mixer_sound_Mixer_setGain00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Mixer",0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Mixer* self = (Mixer*) tolua_tousertype(tolua_S,1,0);
std::string key = ((std::string) tolua_tocppstring(tolua_S,2,0));
float gain = ((float) tolua_tonumber(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setGain'", NULL);
#endif
{
self->setGain(key,gain);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'setGain'.",&tolua_err);
return 0;
#endif
}
示例7: main
int
main()
{
Lamp lamp;
Mixer mixer;
CoinBox coinBox;
BillBox billBox;
Mediator mediator(&lamp, &mixer, &coinBox, &billBox);
mixer.SetMediator(&mediator);
coinBox.SetMediator(&mediator);
billBox.SetMediator(&mediator);
// -- 90 명이 서비스 받음
for (int i = 0; i < 90; i++)
coinBox.InsertCoin();
// -- 고장 & 수리
mixer.OutOfOrder();
coinBox.InsertCoin();
billBox.InsertBill();
mixer.Repair();
billBox.InsertBill(8);
}
示例8: 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;
}
示例9: mh_readPatch
void mh_readPatch()
{
G_Mixer.ready = false;
G_Mixer.outVol = G_Patch.masterVolOut;
G_Mixer.inVol = G_Patch.masterVolIn;
G_Mixer.bpm = G_Patch.bpm;
G_Mixer.bars = G_Patch.bars;
G_Mixer.beats = G_Patch.beats;
G_Mixer.quantize = G_Patch.quantize;
G_Mixer.metronome = G_Patch.metronome;
#ifdef WITH_VST
__mh_readPatchPlugins__(&G_Patch.masterInPlugins, PluginHost::MASTER_IN);
__mh_readPatchPlugins__(&G_Patch.masterOutPlugins, PluginHost::MASTER_OUT);
#endif
G_Mixer.rewind();
G_Mixer.updateFrameBars();
G_Mixer.ready = true;
}
示例10: glue_setBeginEndChannel
void glue_setBeginEndChannel(gdEditor *win, int ch, int b, int e, bool recalc, bool check) {
if (check) {
if ((unsigned) e > G_Mixer.chan[ch]->size)
e = G_Mixer.chan[ch]->size;
if (b < 0)
b = 0;
if ((unsigned) b > G_Mixer.chan[ch]->size)
b = (G_Mixer.chan[ch]->size)-2;
if ((unsigned) b >= G_Mixer.chanEndTrue[ch])
b = G_Mixer.chanStart[ch];
if ((unsigned) e <= G_Mixer.chanStartTrue[ch])
e = G_Mixer.chanEnd[ch];
}
/* print mono values */
char tmp[16];
sprintf(tmp, "%d", b/2);
win->chanStart->value(tmp);
tmp[0] = '\0';
sprintf(tmp, "%d", e/2);
win->chanEnd->value(tmp);
G_Mixer.setChanStart(ch, b);
G_Mixer.setChanEnd (ch, e);
/* recalc is not needed when the user drags the bars directly over the waveform */
if (recalc) {
win->wt->wave->recalcPoints(); // importante, altrimenti non si vedono
win->wt->wave->redraw();
}
}
示例11: tolua_aps_sound_Mixer_sound_Mixer_loadMusic00
static int tolua_aps_sound_Mixer_sound_Mixer_loadMusic00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Mixer",0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_iscppstring(tolua_S,3,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Mixer* self = (Mixer*) tolua_tousertype(tolua_S,1,0);
std::string key = ((std::string) tolua_tocppstring(tolua_S,2,0));
std::string path = ((std::string) tolua_tocppstring(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'loadMusic'", NULL);
#endif
{
self->loadMusic(key,path);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'loadMusic'.",&tolua_err);
return 0;
#endif
}
示例12: tolua_aps_sound_Mixer_sound_Mixer_update00
static int tolua_aps_sound_Mixer_sound_Mixer_update00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Mixer",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Mixer* self = (Mixer*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'update'", NULL);
#endif
{
self->update();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'update'.",&tolua_err);
return 0;
#endif
}
示例13: mh_loadPatch_DEPR_
void mh_loadPatch_DEPR_(bool isProject, const char *projPath)
{
G_Mixer.init();
G_Mixer.ready = false;
int numChans = G_Patch_DEPR_.getNumChans();
for (int i=0; i<numChans; i++) {
Channel *ch = glue_addChannel(G_Patch_DEPR_.getColumn(i), G_Patch_DEPR_.getType(i));
string samplePath = isProject ? projPath + gGetSlash() + G_Patch_DEPR_.getSamplePath(i) : "";
ch->readPatch_DEPR_(samplePath.c_str(), i);
}
G_Mixer.outVol = G_Patch_DEPR_.getOutVol();
G_Mixer.inVol = G_Patch_DEPR_.getInVol();
G_Mixer.bpm = G_Patch_DEPR_.getBpm();
G_Mixer.bars = G_Patch_DEPR_.getBars();
G_Mixer.beats = G_Patch_DEPR_.getBeats();
G_Mixer.quantize = G_Patch_DEPR_.getQuantize();
G_Mixer.metronome = G_Patch_DEPR_.getMetronome();
G_Patch_DEPR_.lastTakeId = G_Patch_DEPR_.getLastTakeId();
G_Patch_DEPR_.samplerate = G_Patch_DEPR_.getSamplerate();
G_Mixer.rewind();
G_Mixer.updateFrameBars();
G_Mixer.ready = true;
}
示例14: Mixer_Channel_Rate
void Mixer_Channel_Rate(void* channel, double rate)
{
if (gOpenRCT2Headless) return;
gMixer.Lock();
((Channel*)channel)->SetRate(rate);
gMixer.Unlock();
}
示例15: Mixer_Channel_Volume
void Mixer_Channel_Volume(void* channel, int volume)
{
if (gOpenRCT2Headless) return;
gMixer.Lock();
((Channel*)channel)->SetVolume(volume);
gMixer.Unlock();
}