#include "guimodule.h" #include "it_enum_list.h" # include #include #include #define PN_GATE 0 #define PN_LORANGE 1 #define PN_HIRANGE 2 #define PN_OUT 3 GuiModule::GuiModule(seGuiCallback seaudioMaster, void *p_resvd1) : SEGUI_base(seaudioMaster, p_resvd1) { int gate = false; imChanged = false; // pay attention to pins now } void GuiModule::OnGuiPinValueChange(SeGuiPin *p_pin) { if(imChanged) return; // i'm already changing pins; leave me alone imChanged = true; // okay, now i'm gonna change stuff, please don't interrupt me. hehe SYSTEMTIME st; GetSystemTime(&st); // first, check any 'parameters' that will affect our formula gate = getPin(PN_GATE)->getValueInt(); lorange = getPin(PN_LORANGE)->getValueInt(); hirange = getPin(PN_HIRANGE)->getValueInt(); if (gate == true ){ srand((unsigned int)st.wMilliseconds); i_out = (int)((hirange - lorange) * rand()/(float)RAND_MAX + lorange); } getPin(PN_OUT)->setValueInt( i_out ); imChanged = false; // now we're done, start paying attention to the pins again }