EffectParameter::EffectParameter(Effect* pEffect, EffectsManager* pEffectsManager, int iParameterNumber, EffectManifestParameterPointer pParameter) : QObject(), // no parent m_pEffect(pEffect), m_pEffectsManager(pEffectsManager), m_iParameterNumber(iParameterNumber), m_pParameter(pParameter), m_bAddedToEngine(false) { // qDebug() << debugString() << "Constructing new EffectParameter from EffectManifestParameter:" // << m_parameter.id(); m_minimum = m_pParameter->getMinimum(); m_maximum = m_pParameter->getMaximum(); // Sanity check the maximum and minimum if (m_minimum > m_maximum) { qWarning() << debugString() << "WARNING: Parameter maximum is less than the minimum."; m_maximum = m_minimum; } // If the parameter specifies a default, set that. Otherwise use the minimum // value. m_default = m_pParameter->getDefault(); if (m_default < m_minimum || m_default > m_maximum) { qWarning() << debugString() << "WARNING: Parameter default is outside of minimum/maximum range."; m_default = m_minimum; } // Finally, set the value to the default. m_value = m_default; }
void EffectParameter::setMaximum(double maximum) { m_maximum = maximum; if (m_maximum > m_parameter.getMaximum()) { qWarning() << debugString() << "WARNING: Maximum value is less than plugin's absolute maximum, clamping."; m_maximum = m_parameter.getMaximum(); } if (m_maximum < m_minimum) { qWarning() << debugString() << "WARNING: New maximum was below the minimum, clamped."; m_maximum = m_minimum; } // There's a degenerate case here where the minimum could be larger // than the manifest maximum. If that's the case, then the maximum // value is currently above the manifest maximum. Since similar // guards exist in the setMinimum call, this should not be able to // happen. Q_ASSERT(m_maximum <= m_parameter.getMaximum()); if (clampValue()) { qWarning() << debugString() << "WARNING: Value was outside of new maximum, clamped."; } if (clampDefault()) { qWarning() << debugString() << "WARNING: Default was outside of new maximum, clamped."; } updateEngineState(); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { if(DLL_PROCESS_ATTACH == fdwReason) { fptr = fopen("mstapi.log","w"); if(NULL != fptr) { struct _timeb timebuffer; char *timeline; _ftime( &timebuffer ); timeline = ctime( & ( timebuffer.time ) ); // put a header on the log entry: // char * header = 'Captains log, Star Date %.19s.%-3hu' char * annoy = "-----------"; fprintf(fptr,"\n;\t%s Logging Started %.19s.%-3hu %s \n", annoy, timeline, timebuffer.millitm, annoy); fprintf(fptr,";Time\t\tSEV\tMessage\t\t\t\t\t\t\tMethod\n"); } debugString(8,"DllMain","DLL_PROCESS_ATTACH",_where()); g_hinstDLL = (HINSTANCE)hinstDLL; } if(DLL_PROCESS_DETACH == fdwReason) { debugString(8,"DllMain","DLL_PROCESS_DETACH",_where()); teardownSound(); fclose(fptr); } return TRUE; }
void SoftmaxLayer::runForwardImplementation(Bundle& bundle) { auto& inputActivationsVector = bundle[ "inputActivations"].get<MatrixVector>(); auto& outputActivationsVector = bundle["outputActivations"].get<MatrixVector>(); assert(inputActivationsVector.size() == 1); auto inputActivations = foldTime(inputActivationsVector.back()); util::log("SoftmaxLayer") << " Running forward propagation of matrix " << inputActivations.shapeString() << "\n"; if(util::isLogEnabled("SoftmaxLayer::Detail")) { util::log("SoftmaxLayer::Detail") << " input: " << inputActivations.debugString(); } auto outputActivations = softmax(inputActivations); if(util::isLogEnabled("SoftmaxLayer::Detail")) { util::log("SoftmaxLayer::Detail") << " outputs: " << outputActivations.debugString(); } saveMatrix("outputActivations", outputActivations); outputActivationsVector.push_back(unfoldTime(outputActivations, inputActivationsVector.front().size())); }
/* * Print a stack trace of the current thread for debug purposes */ void debugTrace() { Ref sf = frame; for (; sf != NULL; sf = sf[FRAME_RETURN_FRAME].r) { printf(" at "); Ref method = sf[FRAME_METHOD].r; Ref type = method[ENTRY_OWNER].r; debugString(type[TYPE_NAME].r); printf("."); debugString(method[ENTRY_NAME].r); printf("("); Ref source = type[TYPE_SOURCE].r; if (source == NULL) { printf("Unknown Source"); } else { debugString(source); int pc = sf[FRAME_PC].i; Ref lnt = method[METHOD_LINE_NUMBERS].r; unsigned short* table = (unsigned short*) (lnt + ARRAY_DATA); if (table != NULL) { int length = lnt[ARRAY_LENGTH].i; int line = -1; int index = 0; while (index < length) { unsigned short startEntry = table[index++]; unsigned short lineEntry = table[index++]; if (pc >= startEntry) { line = lineEntry; } if (pc < startEntry) { break; } } if (line >= 0) { printf(":%d", line); } } } printf(")\n"); } }
bool NetworkSocket::setRemoteAddress(const NetworkAddr& addr) { if(!isOpen()) { errors << "NetworkSocket::setRemoteAddress: socket is closed" << endl; return false; } if(getNLaddr(addr) == NULL) { errors << "NetworkSocket::setRemoteAddress " << debugString() << ": given address is invalid" << endl; return false; } if( GetNetAddrPort(addr) == 0 ) { errors << "NetworkSocket::setRemoteAddress " << debugString() << ": port is set to 0" << endl; } if(nlSetRemoteAddr(m_socket->sock, getNLaddr(addr)) == NL_FALSE) { std::string addrStr = "INVALIDADDR"; NetAddrToString(addr, addrStr); errors << "NetworkSocket::setRemoteAddress " << debugString() << ": failed to set destination " << addrStr << ": " << GetLastErrorStr() << endl; ResetSocketError(); return false; } return true; }
bool EngineEffectRack::processEffectsRequest(const EffectsRequest& message, EffectsResponsePipe* pResponsePipe) { EffectsResponse response(message); switch (message.type) { case EffectsRequest::ADD_CHAIN_TO_RACK: if (kEffectDebugOutput) { qDebug() << debugString() << "ADD_CHAIN_TO_RACK" << message.AddChainToRack.pChain << message.AddChainToRack.iIndex; } response.success = addEffectChain(message.AddChainToRack.pChain, message.AddChainToRack.iIndex); break; case EffectsRequest::REMOVE_CHAIN_FROM_RACK: if (kEffectDebugOutput) { qDebug() << debugString() << "REMOVE_CHAIN_FROM_RACK" << message.RemoveChainFromRack.pChain << message.RemoveChainFromRack.iIndex; } response.success = removeEffectChain(message.RemoveChainFromRack.pChain, message.RemoveChainFromRack.iIndex); break; default: return false; } pResponsePipe->writeMessages(&response, 1); return true; }
JNIEXPORT jint JNICALL Java_net_xtapi_serviceProvider_MSTAPI_connectCall (JNIEnv *pEnv, jobject oObj, jint lLine, jstring oDest, jint lHandle) { const char* utf_string; jboolean isCopy; long lRet = 0; char szDebug[256]; HCALL hCall = 0; utf_string = pEnv->GetStringUTFChars(oDest,&isCopy); wsprintf(szDebug,"Will place call from line %d to %s.",lLine,utf_string); debugString(8,"connectCall",szDebug,_where()); lRet = lineMakeCall((HLINE)lHandle, &hCall, utf_string, 0, 0); long lWait = (long)hCall; if(JNI_TRUE == isCopy) { pEnv->ReleaseStringUTFChars(oDest,utf_string); } // If lineMakeCall succeeded then lRet > 0. However lineMakeCall is // async so we wait on the change of hCall befor returning if the // call to lineMakeCall was successfull.... int loop = 0; wsprintf(szDebug,"lineMakeCall returned -> %d",lRet); if(lRet > 0) { debugString(8,"connectCall",szDebug,_where()); while((long)hCall == 0) { Sleep(20); loop++; if(loop * 20 > MAXCALLWAIT_MS) break; // Bail out!! } } else { debugString(1,"connectCall",szDebug,_where()); return - 1; } wsprintf(szDebug,"Waited %d milliseconds for lineMakeCall",loop *20); debugString(8,"connectCall",szDebug,_where()); wsprintf(szDebug,"hCall = -> %d",(long)hCall); debugString(8,"connectCall",szDebug,_where()); return (long)hCall; }
void TapDmc3xlTimelineMode::onButton(Button *sender, unsigned char event) { #ifdef DEBUG debugString("TapDmc3xlTimelineMode::onButton"); debug(sender->pin); debug(event); #endif switch (sender->pin) { case BTN_LEFT: debugString("left"); if (event == ButtonEvent::UP) { if (!sender->isHeld) { device->onTapDivision(); device->setLedDuration(device->ledLeft, 1, 100); } else { device->setMode(5); //CHANGE } } break; case BTN_CENTER: if (event == ButtonEvent::UP) { if (!sender->isHeld) { device->goToNextDeviceMode(); } else { device->sendInfiniteRepeatOff(); device->setLed(device->ledCenter, Color::BLUE); } } else if (event == ButtonEvent::HOLD) { device->sendInfiniteRepeatOn(); device->setLed(device->ledCenter, Color::WHITE); } break; case BTN_RIGHT: if (event == ButtonEvent::DOWN) { device->onRemoteTap(); device->setLedDuration(device->ledRight, 1, 100); } break; } }
bool EngineEffectChain::processEffectsRequest(const EffectsRequest& message, EffectsResponsePipe* pResponsePipe) { EffectsResponse response(message); switch (message.type) { case EffectsRequest::ADD_EFFECT_TO_CHAIN: if (kEffectDebugOutput) { qDebug() << debugString() << "ADD_EFFECT_TO_CHAIN" << message.AddEffectToChain.pEffect << message.AddEffectToChain.iIndex; } response.success = addEffect(message.AddEffectToChain.pEffect, message.AddEffectToChain.iIndex); break; case EffectsRequest::REMOVE_EFFECT_FROM_CHAIN: if (kEffectDebugOutput) { qDebug() << debugString() << "REMOVE_EFFECT_FROM_CHAIN" << message.RemoveEffectFromChain.pEffect << message.RemoveEffectFromChain.iIndex; } response.success = removeEffect(message.RemoveEffectFromChain.pEffect, message.RemoveEffectFromChain.iIndex); break; case EffectsRequest::SET_EFFECT_CHAIN_PARAMETERS: if (kEffectDebugOutput) { qDebug() << debugString() << "SET_EFFECT_CHAIN_PARAMETERS" << "enabled" << message.SetEffectChainParameters.enabled << "mix" << message.SetEffectChainParameters.mix; } response.success = updateParameters(message); break; case EffectsRequest::ENABLE_EFFECT_CHAIN_FOR_CHANNEL: if (kEffectDebugOutput) { qDebug() << debugString() << "ENABLE_EFFECT_CHAIN_FOR_CHANNEL" << message.channel; } response.success = enableForChannel(message.channel); break; case EffectsRequest::DISABLE_EFFECT_CHAIN_FOR_CHANNEL: if (kEffectDebugOutput) { qDebug() << debugString() << "DISABLE_EFFECT_CHAIN_FOR_CHANNEL" << message.channel; } response.success = disableForChannel(message.channel); break; default: return false; } pResponsePipe->writeMessages(&response, 1); return true; }
bool EngineEffect::processEffectsRequest(const EffectsRequest& message, EffectsResponsePipe* pResponsePipe) { EngineEffectParameter* pParameter = NULL; EffectsResponse response(message); switch (message.type) { case EffectsRequest::SET_EFFECT_PARAMETERS: if (kEffectDebugOutput) { qDebug() << debugString() << "SET_EFFECT_PARAMETERS" << "enabled" << message.SetEffectParameters.enabled; } if (m_enableState != EffectProcessor::DISABLED && !message.SetEffectParameters.enabled) { m_enableState = EffectProcessor::DISABLING; } else if (m_enableState == EffectProcessor::DISABLED && message.SetEffectParameters.enabled) { m_enableState = EffectProcessor::ENABLING; } response.success = true; pResponsePipe->writeMessages(&response, 1); return true; break; case EffectsRequest::SET_PARAMETER_PARAMETERS: if (kEffectDebugOutput) { qDebug() << debugString() << "SET_PARAMETER_PARAMETERS" << "parameter" << message.SetParameterParameters.iParameter << "minimum" << message.minimum << "maximum" << message.maximum << "default_value" << message.default_value << "value" << message.value; } pParameter = m_parameters.value( message.SetParameterParameters.iParameter, NULL); if (pParameter) { pParameter->setMinimum(message.minimum); pParameter->setMaximum(message.maximum); pParameter->setDefaultValue(message.default_value); pParameter->setValue(message.value); response.success = true; } else { response.success = false; response.status = EffectsResponse::NO_SUCH_PARAMETER; } pResponsePipe->writeMessages(&response, 1); return true; default: break; } return false; }
void Timeline::sendPatch() { debugString("Timeline::sendProgramUp"); MIDI::sendPC(patchNumber); //delay(_bankChangeDelay); }
JNIEXPORT jint JNICALL Java_net_xtapi_serviceProvider_MSTAPI_sendDigits (JNIEnv * pEnv, jobject oObj, jint lHandle, jstring oDigits) { const char* utf_string; jboolean isCopy; utf_string = pEnv->GetStringUTFChars(oDigits,&isCopy); long lRes = lineGenerateDigits((HCALL)lHandle, LINEDIGITMODE_DTMF, utf_string, 0); if(JNI_TRUE == isCopy) { pEnv->ReleaseStringUTFChars(oDigits,utf_string); } if(lRes != 0) { char szMsg[256]; wsprintf(szMsg,"lineGenerateDigits returned %d",lRes); debugString(1,"sendDigits",szMsg,_where()); } return lRes; }
// Use a secondary thread to work the windows message pump. DWORD WINAPI SecondaryThread(LPVOID pInputParam) { MSG msg; // msg-pump. while (GetMessage(&msg, NULL, 0, 0)) { //debugString(8,"SecondaryThread","msg-pump",_where()); g_hWnd = msg.hwnd; if(msg.message == WM_USER + 1) { // shutDown was called, shutdown TAPI and return. if( g_hTAPI != NULL) { debugString(4,"SecondaryThread","lineShutdown",_where()); lineShutdown( g_hTAPI ); g_hTAPI = NULL; } return 0; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } return 0; }
Layer::BlockSparseMatrix Layer::runReverse(const BlockSparseMatrix& m) const { if(util::isLogEnabled("Layer")) { util::log("Layer") << " Running reverse propagation on matrix (" << m.rows() << " rows, " << m.columns() << " columns) through layer with dimensions (" << blocks() << " blocks, " << getInputCount() << " inputs, " << getOutputCount() << " outputs, " << blockStep() << " block step).\n"; util::log("Layer") << " layer: " << m_sparseMatrix.shapeString() << "\n"; } auto result = m.reverseConvolutionalMultiply(m_sparseMatrix.transpose()); if(util::isLogEnabled("Layer")) { util::log("Layer") << " output: " << result.shapeString() << "\n"; } if(util::isLogEnabled("Layer::Detail")) { util::log("Layer::Detail") << " output: " << result.debugString() << "\n"; } return result; }
static int set_array_element(jsobjtype array, int idx, const char *value, enum ej_proptype proptype) { int l; if (!allowJS || !cw->winobj || !array) return -1; debugPrint(5, "> set [%d]=%s", idx, debugString(value)); head.cmd = EJ_CMD_SETAREL; head.obj = array; head.proptype = proptype; head.proplength = 0; if (value) head.proplength = strlen(value); head.n = idx; if (writeHeader()) return -1; if (writeToJS(value, head.proplength)) return -1; if (readMessage()) return -1; ack5(); return 0; } /* set_array_element */
JNIEXPORT jint JNICALL Java_net_xtapi_serviceProvider_MSTAPI_answerCall (JNIEnv *pEnv, jobject oObj, jint lHandle) { long lRet; char szDebug[256]; wsprintf(szDebug,"answerCall handle %d",lHandle); debugString(4,"answerCall",szDebug,_where()); lRet = lineAnswer((HCALL)lHandle,NULL,0); wsprintf(szDebug,"lineAnswer returned %d",lRet); debugString(4,"answerCall",szDebug,_where()); return lRet; }
void EffectChainSlot::slotChainEffectChanged(unsigned int effectSlotNumber, bool shouldEmit) { //qDebug() << debugString() << "slotChainEffectChanged" << effectSlotNumber; if (m_pEffectChain) { const QList<EffectPointer> effects = m_pEffectChain->effects(); EffectSlotPointer pSlot; EffectPointer pEffect; if (effects.size() > m_slots.size()) { qWarning() << debugString() << "has too few slots for effect"; } if (effectSlotNumber < (unsigned) m_slots.size()) { pSlot = m_slots.at(effectSlotNumber); } if (effectSlotNumber < (unsigned) effects.size()) { pEffect = effects.at(effectSlotNumber); } if (pSlot != nullptr) { pSlot->loadEffect(pEffect); } m_pControlNumEffects->forceSet(math_min( static_cast<unsigned int>(m_slots.size()), m_pEffectChain->numEffects())); if (shouldEmit) { emit(updated()); } } }
void MainWindow::startServer() { if(!db || !db->isOpen()) { QMessageBox::information(this, tr("No database"), tr("you need to configure database for server at first...")); return; } if(server) { server->close(); delete server; } server = new FSEServer(this); server->setDatabase(db); connect(server, SIGNAL(acceptError(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); connect(server, SIGNAL(errorString(QString)), this, SLOT(logCollect(QString))); connect(server, SIGNAL(debugString(QString)), this, SLOT(logCollect(QString))); if(server->listen(QHostAddress(IPv4), serverPort)) { logCollect(tr("start to listen ") + IPv4 + ":" +QString::number(serverPort)); stateChange(ServerWorking); } else { qDebug() << "start failed" << server->serverError(); stopServer(); } }
int NetworkSocket::Read(void* buffer, int nbytes) { if(!isOpen()) { errors << "NetworkSocket::Read: cannot read on closed socket" << endl; return NL_INVALID; } ResetSocketError(); NLint ret = nlRead(m_socket->sock, buffer, nbytes); // Error checking if (ret == NL_INVALID) { // messageend-error is just that there is no data; we can ignore that if (!IsMessageEndSocketErrorNr(GetSocketErrorNr())) { #ifdef DEBUG std::string errStr = GetLastErrorStr(); // cache errStr that debugString will not overwrite it errors << "ReadSocket " << debugString() << ": " << errStr << endl; #endif // Is this perhaps the solution for the Bad file descriptor error? //Close(); } return NL_INVALID; } return ret; }
void EffectChainSlot::registerChannel(const ChannelHandleAndGroup& handle_group) { if (m_channelInfoByName.contains(handle_group.name())) { qWarning() << debugString() << "WARNING: registerChannel already has channel registered:" << handle_group.name(); return; } double initialValue = 0.0; int deckNumber; if (PlayerManager::isDeckGroup(handle_group.name(), &deckNumber) && (m_iChainSlotNumber + 1) == (unsigned) deckNumber) { initialValue = 1.0; } ControlPushButton* pEnableControl = new ControlPushButton( ConfigKey(m_group, QString("group_%1_enable").arg(handle_group.name())), true, initialValue); pEnableControl->setButtonMode(ControlPushButton::POWERWINDOW); ChannelInfo* pInfo = new ChannelInfo(handle_group, pEnableControl); m_channelInfoByName[handle_group.name()] = pInfo; m_channelStatusMapper.setMapping(pEnableControl, handle_group.name()); connect(pEnableControl, SIGNAL(valueChanged(double)), &m_channelStatusMapper, SLOT(map())); if (m_pEffectChain != nullptr) { if (pEnableControl->toBool()) { m_pEffectChain->enableForChannel(handle_group); } else { m_pEffectChain->disableForChannel(handle_group); } } }
void Timeline::resetUndoRedo() { #ifdef DEBUG debugString("Timeline::resetUndoRedo"); #endif isRedo = false; }
void Dmc3xlTimeline::onTimer(Timer *sender) { #ifdef DEBUG debugString("Dmc3xlTimeline::onTimer"); debug(sender->id); #endif switch (sender->id) { case TIMER_SWITCH_UP: sendSwitchUp(); setLedDuration(ledRight, 1, 100); break; case TIMER_SWITCH_DOWN: sendSwitchDown(); setLedDuration(ledLeft, 1, 100); break; case TIMER_LEVEL_UP: setLevel(); sendLevel(); setLedDuration(ledRight, 1, 100); break; case TIMER_LEVEL_DOWN: setLevel(); sendLevel(); setLedDuration(ledLeft, 1, 100); break; } }
void Timeline::onRemoteTap() { #ifdef DEBUG debugString("Timeline::sendRemoteTap"); #endif MIDI::sendCC(CC_REMOTE_TAP, 0); }
static int set_property(jsobjtype obj, const char *name, const char *value, enum ej_proptype proptype) { int l; if (!allowJS || !cw->winobj || !obj) return -1; debugPrint(5, "> set %s=%s", name, debugString(value)); head.cmd = EJ_CMD_SETPROP; head.obj = obj; head.proptype = proptype; head.proplength = strlen(value); head.n = strlen(name); if (writeHeader()) return -1; if (writeToJS(name, head.n)) return -1; if (writeToJS(value, strlen(value))) return -1; if (proptype == EJ_PROP_FUNCTION) jsSourceFile = name; if (readMessage()) return -1; jsSourceFile = NULL; ack5(); return 0; } /* set_property */
void LoopExit() { dprintf(debugString()); romname[strlen(romname)-3] = 0; strcat(romname, "srm"); int sram_size = SRam.end-SRam.start+1; if(SRam.reg_back & 4) sram_size=0x2000; for(; sram_size > 0; sram_size--) if(SRam.data[sram_size-1]) break; if(sram_size) { FILE *f = fopen(romname, "wb"); if(f) { fwrite(SRam.data, 1, sram_size, f); fclose(f); } } FileMenu.exit(); EmuExit(); DSoundExit(); PsndLen=0; InputExit(); DirectExit(); if (DebugFile) fclose(DebugFile); DebugFile=NULL; }
EffectParameter* Effect::getParameterById(const QString& id) const { EffectParameter* pParameter = m_parametersById.value(id, NULL); if (pParameter == NULL) { qWarning() << debugString() << "getParameterById" << "WARNING: parameter for id does not exist:" << id; } return pParameter; }
void Timeline::onPlayLoop() { #ifdef DEBUG debugString("Timeline::playLoop"); #endif MIDI::sendNote(NOTE_PLAY, VELOCITY); loopState = LOOP_STATE_PLAYING; //3 }
void Timeline::sendInfiniteRepeatOff() { #ifdef DEBUG debugString("Timeline::sendInfinteRepeatOff"); #endif MIDI::sendCC(CC_INFINITE_REPEATS, CC_VAL_INFINITE_REPEATS_OFF); isInfiniteRepeating = false; }
void Timeline::onTapDivision() { #ifdef DEBUG debugString("Timeline::sendTapDivision"); #endif tapDivision = (tapDivision + 1) % (CC_VAL_TAP_DIVISION_MAX + 1); //0 - 4 MIDI::sendCC(CC_TAP_DIVISION, tapDivision); }