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; }
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] }
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); } }
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; }
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; }
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 }
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); }
void* Mixer_Play_Music(int pathid) { if (gMixer.LoadMusic(pathid)) { return gMixer.Play(gMixer.musicstreams[pathid], MIXER_LOOP_INFINITE, false); } return 0; }
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; }
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(); } }
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 }
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 }
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; }
void Mixer_Channel_Rate(void* channel, double rate) { if (gOpenRCT2Headless) return; gMixer.Lock(); ((Channel*)channel)->SetRate(rate); gMixer.Unlock(); }
void Mixer_Channel_Volume(void* channel, int volume) { if (gOpenRCT2Headless) return; gMixer.Lock(); ((Channel*)channel)->SetVolume(volume); gMixer.Unlock(); }
void Mixer_Channel_Pan(void* channel, float pan) { if (gOpenRCT2Headless) return; gMixer.Lock(); ((Channel*)channel)->SetPan(pan); gMixer.Unlock(); }
void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length) { Mixer* mixer = (Mixer*)arg; memset(stream, 0, length); for (int i = 0; i < 10; i++) { mixer->MixChannel(mixer->channels[i], stream, length); } }
void MixerGroup::set_max_delta_out_once(float delta_out_max) { Mixer *mixer = _first; while (mixer != nullptr) { mixer->set_max_delta_out_once(delta_out_max); mixer = mixer->_next; } }
void MixerGroup::set_airmode(Airmode airmode) { Mixer *mixer = _first; while (mixer != nullptr) { mixer->set_airmode(airmode); mixer = mixer->_next; } }
void MixerGroup::groups_required(uint32_t &groups) { Mixer *mixer = _first; while (mixer != nullptr) { mixer->groups_required(groups); mixer = mixer->_next; } }
void MixerGroup::set_thrust_factor(float val) { Mixer *mixer = _first; while (mixer != nullptr) { mixer->set_thrust_factor(val); mixer = mixer->_next; } }
unsigned MixerGroup::mix(float *outputs, unsigned space) { Mixer *mixer = _first; unsigned index = 0; while ((mixer != nullptr) && (index < space)) { index += mixer->mix(outputs + index, space - index); mixer = mixer->_next; } return index; }
unsigned MixerGroup::mix(float *outputs, unsigned space, uint16_t *status_reg) { Mixer *mixer = _first; unsigned index = 0; while ((mixer != NULL) && (index < space)) { index += mixer->mix(outputs + index, space - index, status_reg); mixer = mixer->_next; } return index; }
/* * Clean up and free all ressources of all found Mixers, which were found in the initMixer() call */ void MixerToolBox::deinitMixer() { //kdDebug(67100) << "IN MixerToolBox::deinitMixer()"<<endl; Mixer *mixer; while ( (mixer=Mixer::mixers().first()) != 0) { //kdDebug(67100) << "MixerToolBox::deinitMixer() Remove Mixer" << endl; mixer->close(); Mixer::mixers().remove(mixer); delete mixer; } // kdDebug(67100) << "OUT MixerToolBox::deinitMixer()"<<endl; }
uint16_t MixerGroup::get_saturation_status() { Mixer *mixer = _first; uint16_t sat = 0; while (mixer != nullptr) { sat |= mixer->get_saturation_status(); mixer = mixer->_next; } return sat; }
void KMixDockWidget::handleNewMaster(int soundcard_id, QString& channel_id) // !! @todo rework parameters { //kdDebug(67100) << "KMixDockWidget::handleNewMaster() soundcard_id=" << soundcard_id << " , channel_id=" << channel_id << endl; Mixer *mixer = Mixer::mixers().at(soundcard_id); if ( mixer == 0 ) { kdError(67100) << "KMixDockWidget::createPage(): Invalid Mixer (soundcard_id=" << soundcard_id << ")" << endl; return; // can not happen } m_mixer = mixer; Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere". Mixer::setMasterCardDevice( channel_id ); createMasterVolWidget(); }
/** * Create or recreate the Mixer GUI elements * * @param saveConfig Whether to save all View configurations before recreating * @param forceNewTab To enforce opening a new tab, even when the profileList in the kmixrc is empty. * It should only be set to "true" in case of a Hotplug (because then the user definitely expects a new Tab to show). */ void KMixWindow::recreateGUI(bool saveConfig, const QString& mixerId, bool forceNewTab) { // -1- Remember which of the tabs is currently selected for restoration for re-insertion int oldTabPosition = m_wsMixers->currentIndex(); if (saveConfig) saveViewConfig(); // save the state before recreating // -2- RECREATE THE ALREADY EXISTING TABS ********************************** QMap<Mixer*, bool> mixerHasProfile; // -2a- Build a list of all active profiles in the main window (that means: from all tabs) QList<GUIProfile*> activeGuiProfiles; for (int i = 0; i < m_wsMixers->count(); ++i) { KMixerWidget* kmw = dynamic_cast<KMixerWidget*>(m_wsMixers->widget(i)); if (kmw) { activeGuiProfiles.append(kmw->getGuiprof()); } } // TODO The following loop is a bit buggy, as it iterates over all cached Profiles. But that is wrong for Tabs that got closed. // I need to loop over something else, e.g. a profile list built from the currently open Tabs. // Or (if it that is easier) I might discard the Profile from the cache on "close-tab" (but that must also include unplug actions). foreach( GUIProfile* guiprof, activeGuiProfiles){ KMixerWidget* kmw = findKMWforTab(guiprof->getId()); Mixer *mixer = Mixer::findMixer( guiprof->getMixerId() ); if ( mixer == 0 ) { kError() << "MixerToolBox::find() hasn't found the Mixer for the profile " << guiprof->getId(); continue; } mixerHasProfile[mixer] = true; if ( kmw == 0 ) { // does not yet exist => create addMixerWidget(mixer->id(), guiprof->getId(), -1); } else { // did exist => remove and insert new guiprof at old position int indexOfTab = m_wsMixers->indexOf(kmw); if ( indexOfTab != -1 ) m_wsMixers->removeTab(indexOfTab); delete kmw; addMixerWidget(mixer->id(), guiprof->getId(), indexOfTab); } } // Loop over all GUIProfile's
int main(int argc, char *argv[]) { qDBusRegisterMetaType<DBusUIntList>(); qDBusRegisterMetaType<DBusPropertyList>(); QApplication a(argc, argv); QIcon::setThemeName("elementary"); Mixer m; m.show(); return a.exec(); }
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; }
void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length) { Mixer* mixer = (Mixer*)arg; memset(stream, 0, length); std::list<Channel*>::iterator i = mixer->channels.begin(); while (i != mixer->channels.end()) { mixer->MixChannel(*(*i), stream, length); if (((*i)->done && (*i)->deleteondone) || (*i)->stopping) { delete (*i); i = mixer->channels.erase(i); } else { i++; } } }