MixerGui::MixerGui(SafePtr<IControl> parent, MainMixer* mixer) : Window(parent, 0, 0, 600, 300, "Main mixer"), _mixer(mixer) { SafePtr<IControl> hframe = safe_new(Frame(safePtr(), 0, 0, 600, 300, 0)); // Main volume controls SafePtr<IControl> frame = safe_new(Frame(hframe, 0, 0, 20, 300, 0)); SafePtr<Label> header = safe_new(Label(frame, 0, 20, "M")).cast<Label>(); SafePtr<Slider> slider = safe_new(Slider(frame, 0, 40, 280, 0.0, 1.5, &_mixer->getMasterVolume()->_vol, 50)).cast<Slider>(); header->setPreferedSize(0, 14, 1); slider->setPreferedSize(0, 0, 1); frame->packVertically(5); frame->setPreferedSize(0, 0, 1); for (int i = 0; i < _mixer->getChannels(); ++i) { char buffer[16]; sprintf(buffer, "Ch.%i", i+1); SafePtr<IControl> frame = safe_new(Frame(hframe, 0, 0, 20, 300, 0)); SafePtr<Button> button = safe_new(Button(frame, 0, 0, "SQ.", mixer->getSynthQueue(i)->showGuiAction())).cast<Button>(); SafePtr<Label> header = safe_new(Label(frame, 0, 20, buffer)).cast<Label>(); SafePtr<Slider> slider = safe_new(Slider(frame, 0, 40, 280, 0.0, 1.5, &_mixer->getVolume(i)->_vol, 50)).cast<Slider>(); button->setPreferedSize(0, 22, 1); header->setPreferedSize(0, 14, 1); slider->setPreferedSize(0, 0, 1); frame->packVertically(5); frame->setPreferedSize(0, 0, 1); } hframe->packHorizontally(5); }
void init(){ gui << Image().handle("image").minSize(32,24) << Image().handle("imageOut").minSize(32,24) << Slider(1,22,5).out("filterSize").label("filterSize").maxSize(100,2).handle("filterSize-handle") << Slider(1,22,10).out("difference").label("difference").maxSize(100,2).handle("difference-handle") << CheckBox("useCL", true).out("disableCL").maxSize(100,2).handle("disableCL-handle") << Show(); int maxFilterSize=pa("-maxFilterSize"); int nullValue=pa("-nullValue"); smoothing = new MotionSensitiveTemporalSmoothing(nullValue, maxFilterSize); grabber.init(pa("-i")); update(); }
void ActionMenu::Init() { Vector2f pos = GetLocalPos(); m_slider = Slider(pos); m_slider.SetSlideRate(800); if (m_numChoices == 2) { pos.x = GAME_SCREEN_WIDTH; m_miniWin.SetLocalPos(Position(68, 1)); } else if (m_numChoices == 4) { m_bAllCaps = true; pos.y = GAME_SCREEN_HEIGHT; m_miniWin.SetLocalPos(Position(80, 25)); } m_slider.SetOffScreenPos(pos); m_slider.SnapOffScreen(); AddChild(m_slider); m_miniWin.IgnoreSlider(true); m_miniWin.SetText(GetCurrChoiceText()); m_miniWin.SetFont(FontMgr::Instance().GetFont(FontStyle::FixedWidth)); AddChild(m_miniWin); }
void ScrollBar::LeftDown(Point p, dword) { push = GetMousePart(); LLOG("ScrollBar::LeftDown(" << p << ")"); LLOG("MousePos = " << GetMousePos() << ", ScreenView = " << GetScreenView() << ", rel. pos = " << (GetMousePos() - GetScreenView().TopLeft())); LLOG("GetWorkArea = " << GetWorkArea()); LLOG("VisibleScreenView = " << GetVisibleScreenView()); LLOG("PartRect(0) = " << GetPartRect(0)); LLOG("PartRect(1) = " << GetPartRect(1)); LLOG("PartRect(2) = " << GetPartRect(2)); LLOG("ScrollBar::LeftDown: mousepart = " << (int)push << ", rect = " << GetPartRect(push) << ", overthumb = " << style->overthumb << ", slider = " << Slider()); LLOG("thumbpos = " << thumbpos << ", thumbsize = " << thumbsize); if(push == 2) delta = GetHV(p.x, p.y) - thumbpos; else { if(jump) { delta = thumbsize / 2; Drag(p); } else if(push == 0) PrevPage(); else NextPage(); } SetCapture(); Refresh(); WhenLeftClick(); }
float GUI::GUISlider(Rect slider_rect, float _minValue, float _maxValue, float _value, char* slider_id, SliderStyle* slider_style) { Slider* slider = New Slider(slider_rect, _minValue, _maxValue, _value, slider_id, slider_style); AddSlider(slider); if(sliderState.count(slider_id)) slider->state = sliderState[slider_id]; else slider->state = Normal; slider->GetButtonState(); sliderState[slider_id] = slider->state; if(slider->state == Active){ float width = slider->style->sliderBarSize*(slider->rect.bottom - slider->rect.top); POINT cursorPos = gEngine->GetInput()->GetCursorPos(); slider->value = slider->minValue + (slider->maxValue - slider->minValue)*(cursorPos.x - width/2 - slider->rect.left)/ (slider->rect.right - slider->rect.left - width); if(slider->value < slider->minValue) slider->value = slider->minValue; if(slider->value > slider->maxValue) slider->value = slider->maxValue; } return slider->value; }
Wt::WWidget *FormWidgets::slider() { Wt::WTemplate *result = new TopicTemplate("forms-slider"); result->bindWidget("Slider", Slider()); result->bindWidget("SliderVertical", SliderVertical()); return result; }
void ScrollBar::Paint(Draw& w) { w.DrawRect(GetSize(), SColorPaper()); int cc; Size sz = style->through ? GetSize() : Slider(cc).GetSize(); light = GetMousePart(); int p = push; if(!HasCapture()) p = -1; const Value *hl[] = { style->hlower, style->hupper, style->hthumb }; const Value *vl[] = { style->vupper, style->vlower, style->vthumb }; const Value **l = IsHorz() ? hl : vl; if(prev.IsShowEnabled()) { for(int i = 0; i < 3; i++) { Rect pr = GetPartRect(i); if(i != 2) { w.Clip(pr); pr = style->through ? GetSize() : Slider(); } if(i != 2 || thumbsize >= style->thumbmin) ChPaint(w, pr, l[i][p == i ? CTRL_PRESSED : light == i ? CTRL_HOT : CTRL_NORMAL]); if(i != 2) w.End(); } } else if(style->through) ChPaint(w, sz, l[0][CTRL_DISABLED]); else if(IsHorz()) { ChPaint(w, cc, 0, sz.cx / 2, sz.cy, l[0][CTRL_DISABLED]); ChPaint(w, cc + sz.cx / 2, 0, sz.cx - sz.cx / 2, sz.cy, l[1][CTRL_DISABLED]); } else { ChPaint(w, 0, cc, sz.cx, sz.cy / 2, l[0][CTRL_DISABLED]); ChPaint(w, 0, cc + sz.cy / 2, sz.cx, sz.cy - sz.cy / 2, l[1][CTRL_DISABLED]); // w.DrawRect(0, cc, sz.cx, sz.cy / 2, Red()); _DBG_ // w.DrawRect(0, cc + sz.cy / 2, sz.cx, sz.cy - sz.cy / 2, Green()); _DBG_ } }
TripleOscillatorGui::TripleOscillatorGui(SafePtr<IControl> parent, TripleOscillator* osc): _osc(osc), Window(parent, 0, 0, 240, 260, osc->getSynthName().c_str()) { SafePtr<IControl> slider = safe_new(Slider(safePtr(), 0, 0, 0, -400, 600, &osc->_shift)); SafePtr<IControl> frame = safe_new(Frame(safePtr(), 0, 0, 0, 0, 0)); frame->adopt(osc->_adsr[0]->getGui()); SafePtr<IControl> label1 = safe_new(Label(frame, 0, 0, "First oscillator")); SafePtr<IControl> frame3 = safe_new(Frame(frame, 0, 0, 0, 0, 0)); SafePtr<PictureSelector> psel1 = safe_new(PictureSelector(frame3, 0, 0, 32, 32, &osc->_first_gen)).cast<PictureSelector>(); SafePtr<IControl> exp = safe_new(IControl(frame3)); // expander to make pselector go left frame3->setPreferedSize(0, 34, 1); frame3->packHorizontally(5); SafePtr<IControl> label2 = safe_new(Label(frame, 0, 0, "Second oscillator")); SafePtr<IControl> frame1 = safe_new(Frame(frame, 0, 0, 0, 0, 0)); SafePtr<PictureSelector> psel2 = safe_new(PictureSelector(frame1, 0, 0, 32, 32, &osc->_second_gen)).cast<PictureSelector>(); SafePtr<IControl> wheel1_label = safe_new(Label(frame1, 0, 0, "Detune osc2")); SafePtr<IControl> wheel1 = safe_new(Wheel(frame1, 30, 5, 20, 20, -100.0, 100.0, &_osc->_first)); wheel1_label->setPreferedSize(100, 20, 1); frame1->setPreferedSize(0, 34, 1); frame1->packHorizontally(5); SafePtr<IControl> label3 = safe_new(Label(frame, 0, 0, "Third oscillator")); SafePtr<IControl> frame2 = safe_new(Frame(frame, 0, 0, 0, 0, 0)); SafePtr<PictureSelector> psel3 = safe_new(PictureSelector(frame2, 0, 0, 32, 32, &osc->_third_gen)).cast<PictureSelector>(); SafePtr<IControl> wheel2_label = safe_new(Label(frame2, 0, 0, "Detune osc3")); SafePtr<IControl> wheel2 = safe_new(Wheel(frame2, 30, 5, 20, 20, -100.0, 100.0, &_osc->_second)); wheel2_label->setPreferedSize(100, 20, 1); frame2->setPreferedSize(0, 34, 1); frame2->packHorizontally(5); frame->packVertically(5); packHorizontally(5); // Add generator images to picture selectors for (int i = 0; i < (int)GEN_NUMBER; ++i) { const char* filename = GeneratorFactory::inst()->getGeneratorPictureFilename((GeneratorType)i); psel1->addPicture(filename); psel2->addPicture(filename); psel3->addPicture(filename); } }
void init() { grabber.init(pa("-i")); if (pa("-s")) { utils::Size size = pa("-s"); grabber.setDesiredSizeInternal(size); } // create the GUI gui << ( VBox() << ( HBox() << Draw().label("Original").handle("view1").minSize(16, 12) << Draw().label("Median").handle("view2").minSize(16, 12) << Draw().label("Bilateral Filtered").handle("view3").minSize(16, 12) ) << ( HBox() << Draw().label("Original").handle("viewedge1").minSize(16, 12) << Draw().label("Median").handle("viewedge2").minSize(16, 12) << Draw().label("Bilateral Filtered").handle("viewedge3").minSize(16, 12) ) << CheckBox("Use LAB",true).handle("use_lab") << CheckBox("Use gray image",false).handle("to_gray") << Slider(1,24,4).label("Bilateral Kernel Radius").handle("bi_radius") << Slider(1,24,4).label("Median Kernel Radius").handle("median_radius") << FSlider(0.1,200,5).label("sigma_r (bilateral) ").handle("sigma_r") << FSlider(0.1,200,5).label("sigma_s (bilateral) ").handle("sigma_s") << Slider(0,255,200).label("Canny low th").handle("canny_low_th") << Slider(0,255,255).label("Canny high th").handle("canny_high_th") << Slider(10,100,100).label("ROI of Img (Percent)").handle("roi_size") << Fps().handle("fps") ); gui << Show(); bi_filter = new BilateralFilterOp(); }
void MapTile::init() { image = gl::Texture(loadImage(loadResource(MAP_IMG))); std::cout << "Image size " << image.getSize() << std::endl; maporigin.x = cinder::app::getWindowWidth()/2; maporigin.y = cinder::app::getWindowHeight()/2; //my vars track_mode = MODE_IDLE; currW = 0; zoom = 0.5; offset_zoom = 0.0; color = ColorA(0.2,0.3,0.4,0.7); int pad = getWindowWidth()/5; sliders.push_back( Slider( Vec2f(getWindowWidth()*0.1, getWindowHeight()/2) , Vec2f(30, 500), ColorA(0.9,0.4,0.5,0.5), GEST_EL, Slider::VERTICAL ) ); hide_all_sliders(); timer.start(); //init pointers ref_pos = cv::Point3f(-1,-1,-1); empty_hand = new gestoos::nui::Hand(); empty_hand2 = new gestoos::nui::Hand(); empty_hand->clear(); empty_hand2->clear(); hand_g = empty_hand; hand_slider = empty_hand2; //std::cout<<" hand_g present "<<hand_g->is_present()<<std::endl; }
void DebugMenu::OnActivate() { float maxWidth = 0.0f; float height = m_Settings.verticalPadding; float yOffset = height; ActionList* actionList = m_Path ? &m_Path->actionList : &m_ActionList; if (m_Path) { DebugMenuItem* item = spnew DebugMenuItem(spnew BackAction(m_Path->parent), Rectangle(0.0f, 18.0f - yOffset, 0.0f, height)); m_Panel->Add(item); yOffset += height * 2.0f; maxWidth = item->GetFont().GetWidth(item->GetAction()->ToString()) * 0.5f; } for (IAction* action : *actionList) { float y = 18.0f - yOffset; DebugMenuItem* item = spnew DebugMenuItem(action, Rectangle(0.0f, y, 0.0f, height)); m_Panel->Add(item); yOffset += height * 2.0f; const Font& font = item->GetFont(); float stringWidth = font.GetWidth(item->GetAction()->ToString()) * 0.5f; if (stringWidth > maxWidth) maxWidth = stringWidth; } maxWidth += m_Settings.horizontalPadding; for (Widget* widget : m_Panel->GetWidgets()) { DebugMenuItem* item = (DebugMenuItem*)widget; Rectangle& bounds = item->GetBounds(); bounds.x = maxWidth; bounds.width = maxWidth; } const float sliderWidth = 0.75f; float sliderX = maxWidth * 2.0f + sliderWidth; for (uint i = 0; i < 4; i++) { m_Slider[i] = spnew Slider({ sliderX + i * sliderWidth * 2.0f, 9.0f, sliderWidth, 9.0f }, true); m_Panel->Add(m_Slider[i])->SetActive(false); } }
void init(){ int masksize = 10; int thresh = 2; float gamma = 0; if(pa("-config")){ ConfigFile f(*pa("-config")); masksize = f["config.masksize"]; thresh = f["config.threshold"]; gamma = f["config.gammaslope"]; } gui << Draw().minSize(16,12).handle("orig").label("original image") << Image().minSize(16,12).handle("prev").label("preview image") << ( VBox().label("controls") << Slider(2,200,masksize).label("mask size").out("masksize").minSize(15,2).handle("a") << FSlider(-30,40,thresh).label("threshold").out("threshold").minSize(15,2).handle("b") << FSlider(0,15,gamma).label("gamma slope").out("gamma").minSize(15,2).handle("c") << Button("next image").handle("next") << Button("stopped","running").out("loop").handle("d") << Button("no clip","clip to roi").out("clipToROI").handle("e") << Button("save params").handle("save") << Combo("region mean,tiledNN,tiledLIN").handle("algorithm").label("algorithm") << ( HBox() << Label("..ms").handle("time").label("apply time").minSize(2,3) << Fps(10).handle("fps").minSize(4,3).label("fps") ) ) << Show(); grabber.init(pa("-i")); if(grabber.getType() != "file"){ grabber.useDesired<Size>(pa("-s")); if(!pa("-color")){ grabber.useDesired(formatGray); }else{ grabber.useDesired(formatRGB); } grabber.useDesired(depth8u); } gui.registerCallback(step,"a,b,c,d,e,next,algorithm"); gui["orig"].install(new MouseHandler(mouse)); step(); }
Rect ScrollBar::GetPartRect(int p) const { Rect h = Slider(); int sbo = style->overthumb; int off = GetHV(h.left, h.top); int ts = thumbsize; if(ts < style->thumbmin) ts = 0; switch(p) { case 0: HV(h.right, h.bottom) = thumbpos - sbo + ts / 2 + off; break; case 1: HV(h.left, h.top) = thumbpos + ts / 2 + sbo + off; break; case 2: HV(h.left, h.top) = thumbpos - sbo + off; HV(h.right, h.bottom) = thumbpos + ts + sbo + off; break; } return h; }
void DrawScreen() { bool redraw=true; if(!firstframe && mouse_x-mouse_px==0 && mouse_y-mouse_py==0 && !mouse_left && !mouse_right) redraw=false; if(!mouse_left) { if(vselected!=NULL || vcurbutton>-1) { redraw=true; refresh_counter=2; } vselected=NULL; } if(refresh_counter>0) { refresh_counter--; redraw=true; } if(playing_sample) redraw=true; if(drawcount++>20) { redraw=true; drawcount=0; } if(!redraw) return; firstframe=false; ddkLock(); ClearScreen(0xC0B090); DrawText(10, 10, 0x504030, "GENERATOR"); for(int i=0;i<7;i++) { if(Button(5, 35+i*30, false, categories[i].name, 300+i)) { switch(i) { case 0: // pickup/coin ResetParams(); p_base_freq=0.4f+frnd(0.5f); p_env_attack=0.0f; p_env_sustain=frnd(0.1f); p_env_decay=0.1f+frnd(0.4f); p_env_punch=0.3f+frnd(0.3f); if(rnd(1)) { p_arp_speed=0.5f+frnd(0.2f); p_arp_mod=0.2f+frnd(0.4f); } break; case 1: // laser/shoot ResetParams(); wave_type=rnd(2); if(wave_type==2 && rnd(1)) wave_type=rnd(1); p_base_freq=0.5f+frnd(0.5f); p_freq_limit=p_base_freq-0.2f-frnd(0.6f); if(p_freq_limit<0.2f) p_freq_limit=0.2f; p_freq_ramp=-0.15f-frnd(0.2f); if(rnd(2)==0) { p_base_freq=0.3f+frnd(0.6f); p_freq_limit=frnd(0.1f); p_freq_ramp=-0.35f-frnd(0.3f); } if(rnd(1)) { p_duty=frnd(0.5f); p_duty_ramp=frnd(0.2f); } else { p_duty=0.4f+frnd(0.5f); p_duty_ramp=-frnd(0.7f); } p_env_attack=0.0f; p_env_sustain=0.1f+frnd(0.2f); p_env_decay=frnd(0.4f); if(rnd(1)) p_env_punch=frnd(0.3f); if(rnd(2)==0) { p_pha_offset=frnd(0.2f); p_pha_ramp=-frnd(0.2f); } if(rnd(1)) p_hpf_freq=frnd(0.3f); break; case 2: // explosion ResetParams(); wave_type=3; if(rnd(1)) { p_base_freq=0.1f+frnd(0.4f); p_freq_ramp=-0.1f+frnd(0.4f); } else { p_base_freq=0.2f+frnd(0.7f); p_freq_ramp=-0.2f-frnd(0.2f); } p_base_freq*=p_base_freq; if(rnd(4)==0) p_freq_ramp=0.0f; if(rnd(2)==0) p_repeat_speed=0.3f+frnd(0.5f); p_env_attack=0.0f; p_env_sustain=0.1f+frnd(0.3f); p_env_decay=frnd(0.5f); if(rnd(1)==0) { p_pha_offset=-0.3f+frnd(0.9f); p_pha_ramp=-frnd(0.3f); } p_env_punch=0.2f+frnd(0.6f); if(rnd(1)) { p_vib_strength=frnd(0.7f); p_vib_speed=frnd(0.6f); } if(rnd(2)==0) { p_arp_speed=0.6f+frnd(0.3f); p_arp_mod=0.8f-frnd(1.6f); } break; case 3: // powerup ResetParams(); if(rnd(1)) wave_type=1; else p_duty=frnd(0.6f); if(rnd(1)) { p_base_freq=0.2f+frnd(0.3f); p_freq_ramp=0.1f+frnd(0.4f); p_repeat_speed=0.4f+frnd(0.4f); } else { p_base_freq=0.2f+frnd(0.3f); p_freq_ramp=0.05f+frnd(0.2f); if(rnd(1)) { p_vib_strength=frnd(0.7f); p_vib_speed=frnd(0.6f); } } p_env_attack=0.0f; p_env_sustain=frnd(0.4f); p_env_decay=0.1f+frnd(0.4f); break; case 4: // hit/hurt ResetParams(); wave_type=rnd(2); if(wave_type==2) wave_type=3; if(wave_type==0) p_duty=frnd(0.6f); p_base_freq=0.2f+frnd(0.6f); p_freq_ramp=-0.3f-frnd(0.4f); p_env_attack=0.0f; p_env_sustain=frnd(0.1f); p_env_decay=0.1f+frnd(0.2f); if(rnd(1)) p_hpf_freq=frnd(0.3f); break; case 5: // jump ResetParams(); wave_type=0; p_duty=frnd(0.6f); p_base_freq=0.3f+frnd(0.3f); p_freq_ramp=0.1f+frnd(0.2f); p_env_attack=0.0f; p_env_sustain=0.1f+frnd(0.3f); p_env_decay=0.1f+frnd(0.2f); if(rnd(1)) p_hpf_freq=frnd(0.3f); if(rnd(1)) p_lpf_freq=1.0f-frnd(0.6f); break; case 6: // blip/select ResetParams(); wave_type=rnd(1); if(wave_type==0) p_duty=frnd(0.6f); p_base_freq=0.2f+frnd(0.4f); p_env_attack=0.0f; p_env_sustain=0.1f+frnd(0.1f); p_env_decay=frnd(0.2f); p_hpf_freq=0.1f; break; default: break; } PlaySample(); } } DrawBar(110, 0, 2, 480, 0x000000); DrawText(120, 10, 0x504030, "MANUAL SETTINGS"); DrawSprite(ld48, 8, 440, 0, 0xB0A080); if(Button(130, 30, wave_type==0, "SQUAREWAVE", 10)) wave_type=0; if(Button(250, 30, wave_type==1, "SAWTOOTH", 11)) wave_type=1; if(Button(370, 30, wave_type==2, "SINEWAVE", 12)) wave_type=2; if(Button(490, 30, wave_type==3, "NOISE", 13)) wave_type=3; bool do_play=false; DrawBar(5-1-1, 412-1-1, 102+2, 19+2, 0x000000); if(Button(5, 412, false, "RANDOMIZE", 40)) { p_base_freq=pow(frnd(2.0f)-1.0f, 2.0f); if(rnd(1)) p_base_freq=pow(frnd(2.0f)-1.0f, 3.0f)+0.5f; p_freq_limit=0.0f; p_freq_ramp=pow(frnd(2.0f)-1.0f, 5.0f); if(p_base_freq>0.7f && p_freq_ramp>0.2f) p_freq_ramp=-p_freq_ramp; if(p_base_freq<0.2f && p_freq_ramp<-0.05f) p_freq_ramp=-p_freq_ramp; p_freq_dramp=pow(frnd(2.0f)-1.0f, 3.0f); p_duty=frnd(2.0f)-1.0f; p_duty_ramp=pow(frnd(2.0f)-1.0f, 3.0f); p_vib_strength=pow(frnd(2.0f)-1.0f, 3.0f); p_vib_speed=frnd(2.0f)-1.0f; p_vib_delay=frnd(2.0f)-1.0f; p_env_attack=pow(frnd(2.0f)-1.0f, 3.0f); p_env_sustain=pow(frnd(2.0f)-1.0f, 2.0f); p_env_decay=frnd(2.0f)-1.0f; p_env_punch=pow(frnd(0.8f), 2.0f); if(p_env_attack+p_env_sustain+p_env_decay<0.2f) { p_env_sustain+=0.2f+frnd(0.3f); p_env_decay+=0.2f+frnd(0.3f); } p_lpf_resonance=frnd(2.0f)-1.0f; p_lpf_freq=1.0f-pow(frnd(1.0f), 3.0f); p_lpf_ramp=pow(frnd(2.0f)-1.0f, 3.0f); if(p_lpf_freq<0.1f && p_lpf_ramp<-0.05f) p_lpf_ramp=-p_lpf_ramp; p_hpf_freq=pow(frnd(1.0f), 5.0f); p_hpf_ramp=pow(frnd(2.0f)-1.0f, 5.0f); p_pha_offset=pow(frnd(2.0f)-1.0f, 3.0f); p_pha_ramp=pow(frnd(2.0f)-1.0f, 3.0f); p_repeat_speed=frnd(2.0f)-1.0f; p_arp_speed=frnd(2.0f)-1.0f; p_arp_mod=frnd(2.0f)-1.0f; do_play=true; } if(Button(5, 382, false, "MUTATE", 30)) { if(rnd(1)) p_base_freq+=frnd(0.1f)-0.05f; // if(rnd(1)) p_freq_limit+=frnd(0.1f)-0.05f; if(rnd(1)) p_freq_ramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_freq_dramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_duty+=frnd(0.1f)-0.05f; if(rnd(1)) p_duty_ramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_vib_strength+=frnd(0.1f)-0.05f; if(rnd(1)) p_vib_speed+=frnd(0.1f)-0.05f; if(rnd(1)) p_vib_delay+=frnd(0.1f)-0.05f; if(rnd(1)) p_env_attack+=frnd(0.1f)-0.05f; if(rnd(1)) p_env_sustain+=frnd(0.1f)-0.05f; if(rnd(1)) p_env_decay+=frnd(0.1f)-0.05f; if(rnd(1)) p_env_punch+=frnd(0.1f)-0.05f; if(rnd(1)) p_lpf_resonance+=frnd(0.1f)-0.05f; if(rnd(1)) p_lpf_freq+=frnd(0.1f)-0.05f; if(rnd(1)) p_lpf_ramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_hpf_freq+=frnd(0.1f)-0.05f; if(rnd(1)) p_hpf_ramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_pha_offset+=frnd(0.1f)-0.05f; if(rnd(1)) p_pha_ramp+=frnd(0.1f)-0.05f; if(rnd(1)) p_repeat_speed+=frnd(0.1f)-0.05f; if(rnd(1)) p_arp_speed+=frnd(0.1f)-0.05f; if(rnd(1)) p_arp_mod+=frnd(0.1f)-0.05f; do_play=true; } DrawText(515, 170, 0x000000, "VOLUME"); DrawBar(490-1-1+60, 180-1+5, 70, 2, 0x000000); DrawBar(490-1-1+60+68, 180-1+5, 2, 205, 0x000000); DrawBar(490-1-1+60, 180-1, 42+2, 10+2, 0xFF0000); Slider(490, 180, sound_vol, false, " "); if(Button(490, 200, false, "PLAY SOUND", 20)) PlaySample(); if(Button(490, 290, false, "LOAD SOUND", 14)) { char filename[256]; if(FileSelectorLoad(hWndMain, filename, 1)) // WIN32 { ResetParams(); LoadSettings(filename); PlaySample(); } } if(Button(490, 320, false, "SAVE SOUND", 15)) { char filename[256]; if(FileSelectorSave(hWndMain, filename, 1)) // WIN32 SaveSettings(filename); } DrawBar(490-1-1+60, 380-1+9, 70, 2, 0x000000); DrawBar(490-1-2, 380-1-2, 102+4, 19+4, 0x000000); if(Button(490, 380, false, "EXPORT .WAV", 16)) { char filename[256]; if(FileSelectorSave(hWndMain, filename, 0)) // WIN32 ExportWAV(filename); } char str[10]; sprintf(str, "%i HZ", wav_freq); if(Button(490, 410, false, str, 18)) { if(wav_freq==44100) wav_freq=22050; else wav_freq=44100; } sprintf(str, "%i-BIT", wav_bits); if(Button(490, 440, false, str, 19)) { if(wav_bits==16) wav_bits=8; else wav_bits=16; } int ypos=4; int xpos=350; DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_env_attack, false, "ATTACK TIME"); Slider(xpos, (ypos++)*18, p_env_sustain, false, "SUSTAIN TIME"); Slider(xpos, (ypos++)*18, p_env_punch, false, "SUSTAIN PUNCH"); Slider(xpos, (ypos++)*18, p_env_decay, false, "DECAY TIME"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_base_freq, false, "START FREQUENCY"); Slider(xpos, (ypos++)*18, p_freq_limit, false, "MIN FREQUENCY"); Slider(xpos, (ypos++)*18, p_freq_ramp, true, "SLIDE"); Slider(xpos, (ypos++)*18, p_freq_dramp, true, "DELTA SLIDE"); Slider(xpos, (ypos++)*18, p_vib_strength, false, "VIBRATO DEPTH"); Slider(xpos, (ypos++)*18, p_vib_speed, false, "VIBRATO SPEED"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_arp_mod, true, "CHANGE AMOUNT"); Slider(xpos, (ypos++)*18, p_arp_speed, false, "CHANGE SPEED"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_duty, false, "SQUARE DUTY"); Slider(xpos, (ypos++)*18, p_duty_ramp, true, "DUTY SWEEP"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_repeat_speed, false, "REPEAT SPEED"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_pha_offset, true, "PHASER OFFSET"); Slider(xpos, (ypos++)*18, p_pha_ramp, true, "PHASER SWEEP"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); Slider(xpos, (ypos++)*18, p_lpf_freq, false, "LP FILTER CUTOFF"); Slider(xpos, (ypos++)*18, p_lpf_ramp, true, "LP FILTER CUTOFF SWEEP"); Slider(xpos, (ypos++)*18, p_lpf_resonance, false, "LP FILTER RESONANCE"); Slider(xpos, (ypos++)*18, p_hpf_freq, false, "HP FILTER CUTOFF"); Slider(xpos, (ypos++)*18, p_hpf_ramp, true, "HP FILTER CUTOFF SWEEP"); DrawBar(xpos-190, ypos*18-5, 300, 2, 0x0000000); DrawBar(xpos-190, 4*18-5, 1, (ypos-4)*18, 0x0000000); DrawBar(xpos-190+299, 4*18-5, 1, (ypos-4)*18, 0x0000000); if(do_play) PlaySample(); ddkUnlock(); if(!mouse_left) vcurbutton=-1; }
type.meta = { }; type.LoadBaseClasses( db, typeID, { } ); // Constructors type.AddConstructor<Slider, SliderType>( [](m::ArgumentList &args) { return m::Variant { Slider( args[ 0 ].GetValue<SliderType>( ) ) }; }, { }, false ); // Dynamic Constructors type.AddConstructor<Slider, SliderType>( [](m::ArgumentList &args) { return m::Variant { new Slider( args[ 0 ].GetValue<SliderType>( ) )
Rect ScrollBar::Slider() const { int dummy; return Slider(dummy); }
int ScrollBar::GetRange() const { Size sz = Slider().GetSize(); return GetHV(sz.cx, sz.cy); }