InvocationResult WebPage::invokeCapybaraFunction(const char *name, const QStringList &arguments) { QString qname(name); JavascriptInvocation invocation(qname, arguments, this); return invocation.invoke(currentFrame()); }
PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); }
ImageOrientation BitmapImage::currentFrameOrientation() { return frameOrientationAtIndex(currentFrame()); }
ShortAxisFitting::ShortAxisFitting(std::vector<std::string> mesh, std::vector<std::vector<Point3D> > markers) : inputMesh(mesh), saxMarkers(markers) { numberOfModelFrames_ = mesh.size(); cmiss_nodes.resize(98); //Load the mesh //Initialise cmgui and get context context_ = Cmiss_context_create("saxfit"); //This required for using the cmiss_context_execute_command Cmiss_context_enable_user_interface(context_, NULL); /**< Handle to the context */ Cmiss_region_id root_region = Cmiss_context_get_default_region(context_); std::string region_name = "heart"; // Create a heart region Cmiss_region_id heart_region = Cmiss_region_create_child(root_region, region_name.c_str()); // Read in the heart model spaced over the number of model frames for (unsigned int i = 0; i < numberOfModelFrames_ - 1; i++) { double time = static_cast<double>(i) / numberOfModelFrames_; Cmiss_stream_information_id stream_information = Cmiss_region_create_stream_information(root_region); Cmiss_stream_information_region_id stream_information_region = Cmiss_stream_information_cast_region(stream_information); Cmiss_stream_resource_id stream_resource = Cmiss_stream_information_create_resource_memory_buffer(stream_information, mesh[i].c_str(), mesh[i].length()); Cmiss_stream_information_region_set_resource_attribute_real(stream_information_region, stream_resource, CMISS_STREAM_INFORMATION_REGION_ATTRIBUTE_TIME, time); Cmiss_region_read(root_region, stream_information); Cmiss_stream_resource_destroy(&stream_resource); Cmiss_stream_information_destroy(&stream_information); Cmiss_stream_information_region_destroy(&stream_information_region); } // Wrap the end point add another set of nodes at time 1.0 { Cmiss_stream_information_id stream_information = Cmiss_region_create_stream_information(root_region); Cmiss_stream_information_region_id stream_information_region = Cmiss_stream_information_cast_region(stream_information); Cmiss_stream_resource_id stream_resource = Cmiss_stream_information_create_resource_memory_buffer(stream_information, mesh[0].c_str(), mesh[0].length()); int r = Cmiss_stream_information_region_set_resource_attribute_real(stream_information_region, stream_resource, CMISS_STREAM_INFORMATION_REGION_ATTRIBUTE_TIME, 1.0); Cmiss_region_read(root_region, stream_information); Cmiss_stream_resource_destroy(&stream_resource); Cmiss_stream_information_destroy(&stream_information); Cmiss_stream_information_region_destroy(&stream_information_region); } //Cmiss_region_id heart_region = Cmiss_region_find_child_by_name(root_region, region_name.c_str()); //Get the field module of the heart region field_module_ = Cmiss_region_get_field_module(heart_region); if (field_module_ != 0) { Cmiss_field_module_begin_change(field_module_); // 'coordinates' is an assumed field in // a rc coordinate system. coordinates_rc_ = Cmiss_field_module_find_field_by_name(field_module_, "coordinates"); //Create the cache cache = Cmiss_field_module_create_cache(field_module_); Cmiss_field_module_end_change(field_module_); //Get node handles Cmiss_nodeset_id nodeset = Cmiss_field_module_find_nodeset_by_name(field_module_, "cmiss_nodes"); Cmiss_node_iterator_id nodeIterator = Cmiss_nodeset_create_node_iterator(nodeset); Cmiss_node_id node = Cmiss_node_iterator_next(nodeIterator); if (node != 0) { while (node) { int node_id = Cmiss_node_get_identifier(node); cmiss_nodes[node_id - 1] = node; node = Cmiss_node_iterator_next(nodeIterator); } } Cmiss_nodeset_destroy(&nodeset); Cmiss_node_iterator_destroy(&nodeIterator); int endo[] = { 55, 57, 71, 73, 66, 67, 69, 60, 61, 63, 52, 53, 54, 56, 70, 72, 64, 65, 68, 58, 59, 62, 50, 51, 77, 84, 85, 81, 82, 83, 78, 79, 80, 74, 75, 76, 89, 96, 97, 93, 94, 95, 90, 91, 92, 86, 87, 88, 98 }; memcpy(endoNodeIds, endo, sizeof(int) * 49); //int sax[] = { 73, 74, 75, 76, 83, 84, 80, 81, 82, 77, 78, 79 }; //int sax[] = { 79, 78, 77, 82, 81, 80, 84, 83, 76, 75, 74, 73 }; int sax[] = { 80, 81, 82, 77, 78, 79, 73, 74, 75, 76, 83, 84 }; memcpy(saxNodes, sax, sizeof(int) * NUMBER_OF_SAX_NODES); segmentNodes = new double*[24]; for (int i = 0; i < 24; i++) { segmentNodes[i] = new double[2]; } //Store the initial endo coordinates const int NUMBER_OF_ENDO_NODES = 48; //Skip apex double coord[3]; for(int frame = 0;frame<numberOfModelFrames_;frame++){ std::vector<Point3D> frameCoords; Cmiss_field_module_begin_change(field_module_); { double time = ((double) frame) / ((double) numberOfModelFrames_); if (frame == (numberOfModelFrames_ - 1)) { time = 1.0; } Cmiss_field_cache_set_time(cache, time); for (int nc = 0; nc < NUMBER_OF_ENDO_NODES; nc++) { Cmiss_field_cache_set_node(cache, cmiss_nodes[endoNodeIds[nc] - 1]); Cmiss_field_evaluate_real(coordinates_rc_, cache, 3, coord); Point3D start(coord); frameCoords.push_back(start); } initEndoCoordinates.push_back(frameCoords); } Cmiss_field_module_end_change(field_module_); } //Set the segment node ids segmentNodes[0][0] = aplaxNodes0; segmentNodes[0][1] = aplaxNodes1; segmentNodes[1][0] = aplaxNodes1; segmentNodes[1][1] = aplaxNodes2; segmentNodes[2][0] = aplaxNodes2; segmentNodes[2][1] = aplaxNodes3; segmentNodes[3][0] = aplaxNodes3; segmentNodes[3][1] = aplaxNodes4; segmentNodes[4][0] = aplaxNodes4; segmentNodes[4][1] = aplaxNodes5; segmentNodes[5][0] = aplaxNodes5; segmentNodes[5][1] = aplaxNodes6; segmentNodes[6][0] = aplaxNodes6; segmentNodes[6][1] = aplaxNodes7; segmentNodes[7][0] = aplaxNodes7; segmentNodes[7][1] = aplaxNodes8; segmentNodes[8][0] = tchNodes0; segmentNodes[8][1] = tchNodes1; segmentNodes[9][0] = tchNodes1; segmentNodes[9][1] = tchNodes2; segmentNodes[10][0] = tchNodes2; segmentNodes[10][1] = tchNodes3; segmentNodes[11][0] = tchNodes3; segmentNodes[11][1] = tchNodes4; segmentNodes[12][0] = tchNodes4; segmentNodes[12][1] = tchNodes5; segmentNodes[13][0] = tchNodes5; segmentNodes[13][1] = tchNodes6; segmentNodes[14][0] = tchNodes6; segmentNodes[14][1] = tchNodes7; segmentNodes[15][0] = tchNodes7; segmentNodes[15][1] = tchNodes8; segmentNodes[16][0] = fchNodes0; segmentNodes[16][1] = fchNodes1; segmentNodes[17][0] = fchNodes1; segmentNodes[17][1] = fchNodes2; segmentNodes[18][0] = fchNodes2; segmentNodes[18][1] = fchNodes3; segmentNodes[19][0] = fchNodes3; segmentNodes[19][1] = fchNodes4; segmentNodes[20][0] = fchNodes4; segmentNodes[20][1] = fchNodes5; segmentNodes[21][0] = fchNodes5; segmentNodes[21][1] = fchNodes6; segmentNodes[22][0] = fchNodes6; segmentNodes[22][1] = fchNodes7; segmentNodes[23][0] = fchNodes7; segmentNodes[23][1] = fchNodes8; //Compute the segment lengths initialSegmentLengths = new double[NUMBER_OF_SEGMENTS * numberOfModelFrames_]; ShortAxisOptimizationInput input; input.NUMBER_OF_SEGMENTS = NUMBER_OF_SEGMENTS; input.cache = cache; input.cmiss_nodes = &cmiss_nodes; input.coordinates_rc = coordinates_rc_; input.result = &initialSegmentLengths; input.numberOfModelFrames = numberOfModelFrames_; input.initialSegmentLengths = NULL; input.segmentNodes = segmentNodes; getSegmentLengths(&input); //Compute the average rotation that of the sax markers std::vector<Point3D>& iptCoord(saxMarkers[0]); unsigned int numSaxMarkers = iptCoord.size(); Point3D saxCentroid(0, 0, 0); for (int i = 0; i < numSaxMarkers; i++) { saxCentroid += iptCoord[i]; } saxCentroid = saxCentroid*(-1.0/numSaxMarkers); initFrame = iptCoord; for (int i = 0; i < numSaxMarkers; i++) { initFrame[i]+=saxCentroid; } for(int frame = 0;frame<numberOfModelFrames_;frame++){ std::vector<Point3D>& ipCoord(saxMarkers[frame]); unsigned int numSaxMarkers = ipCoord.size(); Point3D saxcentroid(0, 0, 0); for (int i = 0; i < numSaxMarkers; i++) { saxcentroid += ipCoord[i]; } saxcentroid = saxcentroid*(-1.0/numSaxMarkers); std::vector<Point3D> currentFrame(ipCoord); for (int i = 0; i < numSaxMarkers; i++) { currentFrame[i]+=saxcentroid; } double avgAngle = 0.0; for (int i = 0; i < numSaxMarkers; i++) { avgAngle += (atan2(currentFrame[i].z-initFrame[i].z,currentFrame[i].x-initFrame[i].x)); } avgAngle /=numSaxMarkers; targetDeltas.push_back(avgAngle); std::cout<<frame<<"\t"<<avgAngle*180/M_PI<<std::endl; } //The initFrame markers should correspond to the initFrame of the mesh as that is what is used in the comparisons initFrame.clear(); Point3D sax_centroid(0, 0, 0); for (int seg = 0; seg < NUMBER_OF_SAX_NODES; seg++) { Cmiss_field_cache_set_node(cache, cmiss_nodes[saxNodes[seg]]); Cmiss_field_evaluate_real(coordinates_rc_, cache, 3, coord); Point3D start(coord); initFrame.push_back(start); sax_centroid += start; } sax_centroid = sax_centroid * (-1.0 / NUMBER_OF_SAX_NODES); for (int seg = 0; seg < NUMBER_OF_SAX_NODES; seg++) { initFrame[seg] += sax_centroid; } } else { std::cout << "--- No field module for heart region!!! (Short Axis Fitting)"; std::cout << "No field module " << std::endl; throw -1; } Cmiss_region_destroy(&heart_region); Cmiss_region_destroy(&root_region); }
GdkPixbuf* BitmapImage::getGdkPixbuf() { return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame())); }
v8::Handle<v8::Value> V8AudioContext::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.AudioContext.Contructor"); if (!args.IsConstructCall()) return throwTypeError("AudioContext constructor cannot be called as a function.", args.GetIsolate()); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); Frame* frame = currentFrame(BindingState::instance()); if (!frame) return throwError(ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate()); Document* document = frame->document(); if (!document) return throwError(ReferenceError, "AudioContext constructor associated document is unavailable", args.GetIsolate()); RefPtr<AudioContext> audioContext; if (!args.Length()) { // Constructor for default AudioContext which talks to audio hardware. ExceptionCode ec = 0; audioContext = AudioContext::create(document, ec); if (ec) return setDOMException(ec, args.GetIsolate()); if (!audioContext.get()) return throwError(SyntaxError, "audio resources unavailable for AudioContext construction", args.GetIsolate()); } else { // Constructor for offline (render-target) AudioContext which renders into an AudioBuffer. // new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate); if (args.Length() < 3) return throwNotEnoughArgumentsError(args.GetIsolate()); bool ok = false; int32_t numberOfChannels = toInt32(args[0], ok); if (!ok || numberOfChannels <= 0 || numberOfChannels > 10) return throwError(SyntaxError, "Invalid number of channels", args.GetIsolate()); int32_t numberOfFrames = toInt32(args[1], ok); if (!ok || numberOfFrames <= 0) return throwError(SyntaxError, "Invalid number of frames", args.GetIsolate()); float sampleRate = toFloat(args[2]); if (sampleRate <= 0) return throwError(SyntaxError, "Invalid sample rate", args.GetIsolate()); ExceptionCode ec = 0; audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec); if (ec) return setDOMException(ec, args.GetIsolate()); } if (!audioContext.get()) return throwError(SyntaxError, "Error creating AudioContext", args.GetIsolate()); // Transform the holder into a wrapper object for the audio context. V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get()); audioContext->ref(); return args.Holder(); }
QPoint scrollPosition() const { QWebFrame* frame = currentFrame(); return frame ? frame->scrollPosition() : QPoint(); }
void NodesTool::itemResponse(const TupItemResponse *response) { #ifdef K_DEBUG #ifdef Q_OS_WIN qDebug() << "[NodesTool::itemResponse()]"; #else T_FUNCINFOX("NodesTool"); #endif #endif QGraphicsItem *item = 0; if (response->action() != TupProjectRequest::Remove) { TupFrame *frame = currentFrame(); if (response->action() == TupProjectRequest::Ungroup) { QPointF point = response->position(); item = k->scene->itemAt(point, QTransform()); } else { item = frame->item(response->itemIndex()); } } switch (response->action()) { case TupProjectRequest::Convert: { if (item) { k->nodeGroup = new TNodeGroup(item, k->scene, TNodeGroup::LineSelection, k->baseZValue); } else { #ifdef K_DEBUG QString msg = "NodesTool::itemResponse() - Fatal Error: No item was found"; #ifdef Q_OS_WIN qDebug() << msg; #else tError() << msg; #endif #endif } } break; case TupProjectRequest::EditNodes: { if (item) { if (k->activeSelection) { if (qgraphicsitem_cast<QGraphicsPathItem *>(k->nodeGroup->parentItem()) == item) { k->nodeGroup->show(); k->nodeGroup->syncNodesFromParent(); k->nodeGroup->saveParentProperties(); } } else { k->nodeGroup = new TNodeGroup(item, k->scene, TNodeGroup::LineSelection, k->baseZValue); k->nodeGroup->show(); k->activeSelection = true; k->nodeGroup->resizeNodes(k->realFactor); } } else { #ifdef K_DEBUG QString msg = "NodesTool::itemResponse() - Fatal Error: No item was found"; #ifdef Q_OS_WIN qDebug() << msg; #else tError() << msg; #endif #endif } } break; case TupProjectRequest::Remove: { return; } break; case TupProjectRequest::Ungroup: { // reset(k->scene); if (item) { k->nodeGroup = new TNodeGroup(item, k->scene, TNodeGroup::LineSelection, k->baseZValue); k->nodeGroup->show(); k->activeSelection = true; k->nodeGroup->resizeNodes(k->realFactor); } else { #ifdef K_DEBUG QString msg = "NodesTool::itemResponse() - Fatal error: No item was found"; #ifdef Q_OS_WIN qDebug() << msg; #else tError() << msg; #endif #endif } return; } break; default: { #ifdef K_DEBUG qDebug() << "NodesTool::itemResponse() - default action"; #endif if (k->activeSelection) { k->nodeGroup->show(); if (k->nodeGroup->parentItem()) { k->nodeGroup->parentItem()->setSelected(true); k->nodeGroup->syncNodesFromParent(); } } } break; } }
void NodesTool::release(const TupInputDeviceInformation *input, TupBrushManager *brushManager, TupGraphicsScene *scene) { #ifdef K_DEBUG #ifdef Q_OS_WIN qDebug() << "[NodesTool::release()]"; #else T_FUNCINFOX("tools"); #endif #endif Q_UNUSED(brushManager); QList<QGraphicsItem *> currentSelection = scene->selectedItems(); if (!currentSelection.isEmpty()) { QGraphicsItem *selectedItem = currentSelection.at(0); TupFrame *frame = currentFrame(); int itemIndex = frame->indexOf(selectedItem); if (qgraphicsitem_cast<TupSvgItem *>(selectedItem)) { TOsd::self()->display(tr("Error"), tr("SVG objects cannot be edited!"), TOsd::Error); return; } if (TupGraphicLibraryItem *libraryItem = qgraphicsitem_cast<TupGraphicLibraryItem *>(selectedItem)) { if (libraryItem->itemType() == TupLibraryObject::Image) { TOsd::self()->display(tr("Error"), tr("Images have no nodes!"), TOsd::Error); return; } } if (qgraphicsitem_cast<TupItemGroup *>(selectedItem)) { if (k->activeSelection) k->nodeGroup->clear(); QPointF coord = input->pos(); if (itemIndex >= 0) { TupProjectRequest event = TupRequestBuilder::createItemRequest( scene->currentSceneIndex(), k->currentLayer, k->currentFrame, itemIndex, coord, scene->spaceContext(), TupLibraryObject::Item, TupProjectRequest::Ungroup); emit requested(&event); } return; } if (!qgraphicsitem_cast<TControlNode*>(selectedItem)) { if (!qgraphicsitem_cast<TupPathItem *>(selectedItem)) { TOsd::self()->display(tr("Error"), tr("Only pencil/ink lines can be edited!"), TOsd::Error); return; } } if (itemIndex == -1) { if (qgraphicsitem_cast<TControlNode*>(selectedItem)) { QGraphicsItem *item = k->nodeGroup->parentItem(); int position = frame->indexOf(item); if (position >= 0) { // if (qgraphicsitem_cast<QGraphicsPathItem *>(item)) { QString path = qgraphicsitem_cast<TupPathItem *>(item)->pathToString(); TupProjectRequest event = TupRequestBuilder::createItemRequest(scene->currentSceneIndex(), k->currentLayer, k->currentFrame, position, QPointF(), scene->spaceContext(), TupLibraryObject::Item, TupProjectRequest::EditNodes, path); emit requested(&event); k->nodeGroup->clearChangedNodes(); // } } else { #ifdef K_DEBUG QString msg = "NodesTool::release() - Fatal Error: Invalid position [ " + QString::number(position) + " ]"; #ifdef Q_OS_WIN qDebug() << msg; #else tError() << msg; #endif #endif } } else { #ifdef K_DEBUG QString msg = "NodesTool::release() - Invalid selected item index: " + QString::number(itemIndex); #ifdef Q_OS_WIN qDebug() << msg; #else tWarning() << msg; #endif #endif } return; } // Avoiding to select the same item twice if (k->activeSelection) { TupFrame *frame = currentFrame(); int oldIndex = frame->indexOf(k->nodeGroup->parentItem()); if (oldIndex != itemIndex) { k->nodeGroup->clear(); k->nodeGroup = new TNodeGroup(selectedItem, scene, TNodeGroup::LineSelection, k->baseZValue); k->nodeGroup->show(); k->nodeGroup->resizeNodes(k->realFactor); if (TupPathItem *path = qgraphicsitem_cast<TupPathItem *>(selectedItem)) { if (path->isNotEdited()) path->saveOriginalPath(); } } else { if (k->nodeGroup->hasChangedNodes()) { QGraphicsItem *item = k->nodeGroup->parentItem(); int position = frame->indexOf(item); if (position >= 0) { QString path = qgraphicsitem_cast<TupPathItem *>(item)->pathToString(); TupProjectRequest event = TupRequestBuilder::createItemRequest(scene->currentSceneIndex(), k->currentLayer, k->currentFrame, position, QPointF(), scene->spaceContext(), TupLibraryObject::Item, TupProjectRequest::EditNodes, path); emit requested(&event); k->nodeGroup->clearChangedNodes(); } else { #ifdef K_DEBUG QString msg = "NodesTool::release() - Fatal Error: Invalid position [ " + QString::number(position) + " ]"; #ifdef Q_OS_WIN qDebug() << msg; #else tError() << msg; #endif #endif } } else { #ifdef K_DEBUG QString msg = "NodesTool::release() - Node group has NO changes!"; #ifdef Q_OS_WIN qDebug() << msg; #else tWarning() << msg; #endif #endif } } } else { k->nodeGroup = new TNodeGroup(selectedItem, scene, TNodeGroup::LineSelection, k->baseZValue); k->nodeGroup->show(); k->activeSelection = true; k->nodeGroup->resizeNodes(k->realFactor); if (TupPathItem *path = qgraphicsitem_cast<TupPathItem *>(selectedItem)) { if (path->isNotEdited()) path->saveOriginalPath(); } } } else { if (k->activeSelection) { #ifdef K_DEBUG QString msg = "NodesTool::release() - Empty selection! Removing nodes..."; #ifdef Q_OS_WIN qDebug() << msg; #else tWarning() << msg; #endif #endif k->nodeGroup->clear(); k->nodeGroup = 0; k->activeSelection = false; } } }
QByteArray WebPage::body() { return currentFrame()->property("body").toByteArray(); }
QString WebPage::contentType() { return currentFrame()->property("contentType").toString(); }
QStringList WebPage::pageHeaders() { return currentFrame()->property("headers").toStringList(); }
int WebPage::getLastStatus() { return currentFrame()->property("statusCode").toInt(); }
QStringList WebPage::getAttachedFileNames() { return currentFrame()->evaluateJavaScript(QString("Capybara.attachedFiles")).toStringList(); }
bool BitmapImage::bitmapForCurrentFrame(SkBitmap* bitmap) { return frameAtIndex(currentFrame(), bitmap); }
void Editor::backup(int backupLayer, int backupFrame, QString undoText) { while (mBackupList.size() - 1 > mBackupIndex && mBackupList.size() > 0) { delete mBackupList.takeLast(); } while (mBackupList.size() > 19) // we authorize only 20 levels of cancellation { delete mBackupList.takeFirst(); mBackupIndex--; } Layer* layer = mObject->getLayer(backupLayer); if (layer != nullptr) { if (layer->type() == Layer::BITMAP) { BitmapImage* bitmapImage = static_cast<LayerBitmap*>(layer)->getLastBitmapImageAtFrame(backupFrame, 0); if (currentFrame() == 1) { int previous = layer->getPreviousKeyFramePosition(backupFrame); bitmapImage = static_cast<LayerBitmap*>(layer)->getBitmapImageAtFrame(previous); } if (bitmapImage != nullptr) { BackupBitmapElement* element = new BackupBitmapElement(bitmapImage); element->layer = backupLayer; element->frame = backupFrame; element->undoText = undoText; element->somethingSelected = getScribbleArea()->isSomethingSelected(); element->mySelection = getScribbleArea()->mySelection; element->myTransformedSelection = getScribbleArea()->myTransformedSelection; element->myTempTransformedSelection = getScribbleArea()->myTempTransformedSelection; mBackupList.append(element); mBackupIndex++; } } else if (layer->type() == Layer::VECTOR) { VectorImage* vectorImage = static_cast<LayerVector*>(layer)->getLastVectorImageAtFrame(backupFrame, 0); if (vectorImage != nullptr) { BackupVectorElement* element = new BackupVectorElement(vectorImage); element->layer = backupLayer; element->frame = backupFrame; element->undoText = undoText; element->somethingSelected = getScribbleArea()->isSomethingSelected(); element->mySelection = getScribbleArea()->mySelection; element->myTransformedSelection = getScribbleArea()->myTransformedSelection; element->myTempTransformedSelection = getScribbleArea()->myTempTransformedSelection; mBackupList.append(element); mBackupIndex++; } } else if (layer->type() == Layer::SOUND) { int previous = layer->getPreviousKeyFramePosition(backupFrame); KeyFrame* key = layer->getLastKeyFrameAtPosition(backupFrame); // in case tracks overlap, get previous frame if (key == nullptr) { KeyFrame* previousKey = layer->getKeyFrameAt(previous); key = previousKey; } if (key != nullptr) { SoundClip* clip = static_cast<SoundClip*>(key); if (clip) { BackupSoundElement* element = new BackupSoundElement(clip); element->layer = backupLayer; element->frame = backupFrame; element->undoText = undoText; element->fileName = clip->fileName(); mBackupList.append(element); mBackupIndex++; } } } } updateAutoSaveCounter(); emit updateBackup(); }
/* ------------------------------------------------------------------ run --- */ int MBASE::run() { const int totalSamps = insamps + tapcount; int thisFrame = currentFrame(); const int outChans = outputChannels(); DBG1(printf("%s::run(): totalSamps = %d\n", name(), totalSamps)); // this will return chunksamps' worth of input, even if we have // passed the end of the input (will produce zeros) getInput(thisFrame, framesToRun()); DBG1(printf("getInput(%d, %d) called\n", thisFrame, framesToRun())); int bufsamps = getBufferSize(); const int outputOffset = this->output_offset; // loop for required number of output samples const int frameCount = framesToRun(); memset(this->outbuf, 0, frameCount * outChans * sizeof(BUFTYPE)); int frame = 0; while (frame < frameCount) { // limit buffer size to end of current pull (chunksamps) if (frameCount - frame < bufsamps) bufsamps = max(0, frameCount - frame); thisFrame = currentFrame(); // store this locally for efficiency DBG1(printf("top of main loop: frame = %d thisFrame = %d bufsamps = %d\n", frame, thisFrame, bufsamps)); DBG(printf("input signal:\n")); DBG(PrintInput(&in[frame], bufsamps)); // add signal to delay put_tap(thisFrame, &in[frame], bufsamps); // if processing input signal or flushing delay lines ... if (thisFrame < totalSamps) { // limit buffer size of end of input data if (totalSamps - thisFrame < bufsamps) bufsamps = max(0, totalSamps - thisFrame); if ((tapcount = updatePosition(thisFrame)) < 0) RTExit(-1); DBG1(printf(" vector loop: bufsamps = %d\n", bufsamps)); for (int ch = 0; ch < 2; ch++) { for (int path = 0; path < m_paths; path++) { Vector *vec = &m_vectors[ch][path]; /* get delayed samps */ get_tap(thisFrame, ch, path, bufsamps); #if 0 DBG(printf("signal [%d][%d] before filters:\n", ch, path)); DBG(PrintSig(vec->Sig, bufsamps)); #endif /* air absorpt. filters */ air(vec->Sig, bufsamps, vec->Airdata); /* wall absorpt. filters */ if (path > 0) // no filtering of direct signal wall(vec->Sig, bufsamps, vec->Walldata); /* do binaural angle filters if necessary*/ if (m_binaural) { fir(vec->Sig, thisFrame, g_Nterms[path], vec->Fircoeffs, vec->Firtaps, bufsamps); } DBG(printf("signal [%d][%d] before rvb:\n", ch, path)); DBG(PrintSig(vec->Sig, bufsamps)); // DBG(PrintSig(vec->Sig, bufsamps, SIG_THRESH)); } } DBG(printf("summing vectors\n")); Vector *vec; register float *outptr = &this->outbuf[frame*outChans]; // sum unscaled reflected paths as global input for RVB. for (int path = 0; path < m_paths; path++) { vec = &m_vectors[0][path]; addScaleBufToOut(&outptr[2], vec->Sig, bufsamps, outChans, 1.0); vec = &m_vectors[1][path]; addScaleBufToOut(&outptr[3], vec->Sig, bufsamps, outChans, 1.0); } if (!m_binaural) { // now do cardioid mike effect // add scaled reflected paths to output as early response for (int path = 1; path < m_paths; path++) { vec = &m_vectors[0][path]; addScaleBufToOut(&outptr[0], vec->Sig, bufsamps, outChans, vec->MikeAmp); vec = &m_vectors[1][path]; addScaleBufToOut(&outptr[1], vec->Sig, bufsamps, outChans, vec->MikeAmp); #if 0 DBG(printf("early response L and R:\n")); DBG(PrintOutput(&outptr[0], bufsamps, outChans, SIG_THRESH)); DBG(PrintOutput(&outptr[1], bufsamps, outChans, SIG_THRESH)); #endif } } else { // copy scaled, filtered reflected paths (reverb input) as the early reponse // to the output for (int ch = 0; ch < 2; ++ch) { float *dest = &outptr[ch]; float *src = &outptr[ch+2]; for (int n=0; n<bufsamps; ++n) { *dest = *src; dest += outChans; src += outChans; } } } /* add the direct signal into the output bus */ for (int n = 0; n < bufsamps; n++) { outptr[0] += m_vectors[0][0].Sig[n]; outptr[1] += m_vectors[1][0].Sig[n]; outptr += outChans; } DBG(printf("FINAL MIX LEFT CHAN:\n")); DBG(PrintOutput(&this->outbuf[frame*outChans], bufsamps, outChans)); } increment(bufsamps); frame += bufsamps; bufsamps = getBufferSize(); // update DBG1(printf("\tmain loop done. thisFrame now %d\n", currentFrame())); } DBG1(printf("%s::run done\n\n", name())); return frame; }
void Editor::scrubForward() { scrubTo(currentFrame() + 1); }
QPoint maximumScrollPosition() const { QWebFrame* frame = currentFrame(); QSize s = frame ? frame->contentsSize() - frame->geometry().size() : QSize(0, 0); return QPoint(qMax(0, s.width()), qMax(0, s.height())); }
KeyFrame* Editor::addNewKey() { return addKeyFrame(layers()->currentLayerIndex(), currentFrame()); }
void setScrollPosition(const QPoint& point, const QPoint& /* overShootDelta */) { QWebFrame* frame = currentFrame(); if (frame) frame->setScrollPosition(point); }
int STGRANR::run() { long i,attacksamps,j,thechunksamp,waitsamps,left,ngrains,rsamps; float *outp; float loc, ampfac, interval; double frac; const int frameCount = framesToRun(); if (in == NULL) /* first time, so allocate it */ in = new float [RTBUFSAMPS * inputChannels()]; // if ( (durhi*(float)SR) > frameCount()) // rtcmix_advise("STGRANR", "Grain duration larger than buffer."); outp = outbuf; /* point to inst private out buffer */ // figure out how many grains are in this chunk ngrains = (int)((float)frameCount/(rate*(float)SR)); if ( ngrains < 1 ) { if ( grainoverlap ) ngrains = 1; else { if ( (rrand()*.5+.5) < ((float)frameCount/(rate*(float)SR)) ) ngrains = 1; else ngrains = 0; } } thechunksamp = 0; if ( ngrains ) { for (i = 0; i < ngrains; i++) { attacksamps = frameCount/ngrains; // no grainoverlap yet transp = (float)prob(transplo, transpmid, transphi, transpti); interval = octpch(transp); increment = (double) cpsoct(10.0 + interval) / cpsoct(10.0); gdur = (float)prob(durlo,durmid,durhi,durti); grainsamps = (long)(gdur*(float)SR); if ( grainsamps > attacksamps) { overlapsample = grainsamps - attacksamps; // where to start in next attacksamps in envelop grainoverlap = 1; grainsamps = attacksamps; } ratevar = (float)prob(ratevarlo, ratevarmid, ratevarhi, ratevarti); waitsamps = (long)(ratevar*(float)(attacksamps - grainsamps)); spread = (float)prob(loclo,locmid,lochi,locti); tableset(SR, gdur, grlen, tabg); for ( j = 0; j < attacksamps; j++ ) { if (--branch < 0) { aamp = tablei(currentFrame(), amptable, tabs) * amp; branch = skip; } while (get_frame) { if (inframe >= attacksamps) { rtgetin(in, this, attacksamps * inputChannels()); inframe = 0; } oldersig[0] = oldsig[0]; oldsig[0] = newsig[0]; newsig[0] = in[(inframe * inputChannels())/* + inchan*/]; if ( inputChannels() == 2 ) { oldersig[1] = oldsig[1]; oldsig[1] = newsig[1]; newsig[1] = in[(inframe * inputChannels())+1]; } inframe++; incount++; if (counter - (double) incount < 0.5) get_frame = 0; } if(( j < grainsamps + waitsamps) && ( j > waitsamps )) { ampfac = tablei(j-waitsamps,grenvtable,tabg); frac = (counter - (double) incount) + 2.0; outp[0] = interp(oldersig[0], oldsig[0], newsig[0], frac) * ampfac; if (inputChannels() == 2 && outputChannels() == 2) // split stereo files between the channels outp[1] = interp(oldersig[1], oldsig[1], newsig[1], frac) * ampfac; } else outp[0] = 0.0; if (outputChannels() == 2 ) { // split stereo files between the channels outp[1] = (1.0 - spread) * outp[0]; outp[0] *= spread; } Instrument::increment(); // sample of whole note thechunksamp++; // sample within chunk outp += outputChannels(); counter += increment; /* keeps track of interp pointer */ if (counter - (double) incount >= -0.5) get_frame = 1; } totalgrains++; } } else { // ngrains = 0 for ( j = 0; j < frameCount; j++ ) { outp[0] = 0.0; if (outputChannels() == 2) outp[1] = 0.0; outp += outputChannels(); Instrument::increment(); // sample of whole note thechunksamp++; // sample within chunk } } // rtcmix_advise("STGRANR", "totalgrains: %ld\n",totalgrains); return thechunksamp; }
NativeImagePtr BitmapImage::nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); }
/* Called by the scheduler for every time slice in which this instrument should run. This is where the real work of the instrument is done. */ int LPCPLAY::run() { int n = 0; float out[2]; /* Space for only 2 output chans! */ #if 0 printf("\nLPCPLAY::run()\n"); #endif // Samples may have been left over from end of previous run's block if (_leftOver > 0) { int toAdd = min(_leftOver, framesToRun()); #ifdef debug printf("using %d leftover samps starting at offset %d\n", _leftOver, _savedOffset); #endif rtbaddout(&_alpvals[_savedOffset], toAdd); increment(toAdd); n += toAdd; _leftOver -= toAdd; _savedOffset += toAdd; } /* framesToRun() returns the number of sample frames -- 1 sample for each channel -- that we have to write during this scheduler time slice. */ for (; n < framesToRun(); n += _counter) { double p[12]; update(p, 12); _amp = p[2]; _pitch = p[3]; _transposition = ABS(_pitch); _warpFactor = p[6]; _reson_is_on = p[7] ? true : false; _cf_fact = p[7]; _bw_fact = p[8]; int loc; if ( _unvoiced_rate && !_voiced ) { ++_frameno; /* if unvoiced set to normal rate */ } else { _frameno = _frame1 + ((float)(currentFrame())/nSamps()) * _frames; } #if 0 printf("frame %g\n", _frameno); #endif if (_dataSet->getFrame(_frameno,_coeffs) == -1) break; // If requested, stabilize this frame before using if (_autoCorrect) stabilize(_coeffs, _nPoles); float buzamp = getVoicedAmp(_coeffs[THRESH]); _voiced = (buzamp > 0.1); /* voiced = 0 for 10:1 noise */ float noisamp = (1.0 - buzamp) * _randamp; /* for now */ _ampmlt = _amp * _coeffs[RESIDAMP]; if (_coeffs[RMSAMP] < _cutoff) _ampmlt = 0; float cps = tablei(currentFrame(),_pchvals,_tblvals); float newpch = cps; // If input pitch was specified as -X.YZ, use this as actual pitch if ((_pitch < 0) && (ABS(_pitch) >= 1)) newpch = _transposition; if (_reson_is_on) { /* If _cf_fact is greater than 20, treat as absolute freq. Else treat as factor. If _bw_fact is greater than 20, treat as absolute freq. Else treat as factor (i.e., cf * factor == bw). */ float cf = (_cf_fact < 20.0) ? _cf_fact*cps : _cf_fact; float bw = (_bw_fact < 20.0) ? cf * _bw_fact : _bw_fact; rszset(SR, cf, bw, 1., _rsnetc); #ifdef debug printf("cf %g bw %g cps %g\n", cf, bw,cps); #endif } float si = newpch * _magic; float *cpoint = _coeffs + 4; if (_warpFactor != 0.0) { float warp = (_warpFactor > 1.) ? .0001 : _warpFactor; _ampmlt *= _warpPole.set(warp, cpoint, _nPoles); } if (_hnfactor < 1.0) { buzamp *= _hnfactor; /* compensate for gain increase */ } float hn = (_hnfactor <= 1.0) ? (int)(_hnfactor*_srd2/newpch)-2 : _hnfactor; _counter = int(((float)SR/(newpch * _perperiod) ) * .5); _counter = (_counter > (nSamps() - currentFrame())) ? nSamps() - currentFrame() : _counter; #ifdef debug printf("fr: %g err: %g bzamp: %g noisamp: %g pch: %g ctr: %d\n", _frameno,_coeffs[THRESH],_ampmlt*buzamp,_ampmlt*noisamp,newpch,_counter); #endif if (_counter <= 0) break; // Catch bad pitches which generate array overruns else if (_counter > _arrayLen) { rtcmix_warn("LPCPLAY", "Counter exceeded array size -- limiting. Frame pitch: %f", newpch); _counter = _arrayLen; } bbuzz(_ampmlt*buzamp,si,hn,_sineFun,&_phs,_buzvals,_counter); #ifdef debug printf("\t _buzvals[0] = %g\n", _buzvals[0]); #endif l_brrand(_ampmlt*noisamp,_noisvals,_counter); /* TEMPORARY */ #ifdef debug printf("\t _noisvals[0] = %g\n", _noisvals[0]); #endif for (loc=0; loc<_counter; loc++) { _buzvals[loc] += _noisvals[loc]; /* add voiced and unvoiced */ } if (_warpFactor) { float warp = (_warpFactor > 1.) ? shift(_coeffs[PITCH],newpch,(float)SR) : _warpFactor; #ifdef debug printf("\tpch: %f newpch: %f d: %f\n",_coeffs[PITCH], newpch, warp); #endif /************* warp = ABS(warp) > .2 ? SIGN(warp) * .15 : warp; ***************/ _warpPole.run(_buzvals, warp, cpoint, _alpvals, _counter); } else { ballpole(_buzvals,&_jcount,_nPoles,_past,cpoint,_alpvals,_counter); } #ifdef debug { int x; float maxamp=0; for (x=0;x<_counter;x++) { if (ABS(_alpvals[x]) > ABS(maxamp)) maxamp = _alpvals[x]; } printf("\t maxamp = %g\n", maxamp); } #endif if (_reson_is_on) bresonz(_alpvals,_rsnetc,_alpvals,_counter); // Apply envelope last float envelope = evp(currentFrame(),_envFun,_envFun,_evals); bmultf(_alpvals, envelope, _counter); int sampsToAdd = min(_counter, framesToRun() - n); /* Write this block to the output buffer. */ rtbaddout(_alpvals, sampsToAdd); /* Keep track of how many sample frames this instrument has generated. */ increment(sampsToAdd); } // Handle case where last synthesized block extended beyond framesToRun() if (n > framesToRun()) { _leftOver = n - framesToRun(); _savedOffset = _counter - _leftOver; #ifdef debug printf("saving %d samples left over at offset %d\n", _leftOver, _savedOffset); #endif } return framesToRun(); }
void GameCritterObject::onMovementAnimationEnded(Event* event) { auto hexagon = movementQueue()->back(); movementQueue()->pop_back(); Game::getInstance()->locationState()->moveObjectToHexagon(this, hexagon); auto animation = dynamic_cast<Animation*>(ui()); if (movementQueue()->size() == 0) { _moving = false; animation->stop(); setActionAnimation("aa"); return; } auto newHexagon = movementQueue()->back(); auto newOrientation = this->hexagon()->orientationTo(newHexagon); if (event->name() == "animationEnded" || (int)newOrientation != orientation()) { _orientation = newOrientation; auto newAnimation = _generateMovementAnimation(); if (event->name() == "actionFrame") { newAnimation->setCurrentFrame(animation->currentFrame()); newAnimation->setActionFrame(animation->actionFrame()); } else { newAnimation->setActionFrame(_running ? 2 : 4); } newAnimation->addEventHandler("actionFrame", std::bind(&GameCritterObject::onMovementAnimationEnded, this, std::placeholders::_1)); newAnimation->addEventHandler("animationEnded", std::bind(&GameCritterObject::onMovementAnimationEnded, this, std::placeholders::_1)); newAnimation->play(); delete _ui; _ui = animation = newAnimation; } if (event->name() == "actionFrame") { // at each action frame critter switches to the next hex and frame positions are offset relative to the action frame offsets auto actionFrame = animation->frames()->at(animation->actionFrame()); for (auto it = animation->frames()->rbegin(); it != animation->frames()->rend(); ++it) { auto frame = (*it); frame->setXOffset(frame->xOffset() - actionFrame->xOffset()); frame->setYOffset(frame->yOffset() - actionFrame->yOffset()); if (frame == actionFrame) break; } if (_running) { switch (animation->actionFrame()) { // those frame numbers were guessed to make seamless running animation case 2: animation->setActionFrame(4); break; case 4: animation->setActionFrame(6); break; case 5: animation->setActionFrame(7); break; } } } }
int LPCIN::run() { int n = 0; float out[2]; /* Space for only 2 output chans! */ const int inchans = inputChannels(); // Samples may have been left over from end of previous run's block if (_leftOver > 0) { int toAdd = min(_leftOver, framesToRun()); #ifdef debug printf("using %d leftover samps starting at offset %d\n", _leftOver, _savedOffset); #endif bmultf(&_alpvals[_savedOffset], _ampmlt, toAdd); // Scale signal rtbaddout(&_alpvals[_savedOffset], toAdd); increment(toAdd); n += toAdd; _leftOver -= toAdd; _savedOffset += toAdd; } /* framesToRun() returns the number of sample frames -- 1 sample for each channel -- that we have to write during this scheduler time slice. */ for (; n < framesToRun(); n += _counter) { double p[10]; update(p, LPCIN_bw + 1); _amp = p[LPCIN_amp]; _warpFactor = p[LPCIN_warp]; _reson_is_on = p[LPCIN_cf] ? true : false; _cf_fact = p[LPCIN_cf]; _bw_fact = p[LPCIN_bw]; int loc; _frameno = _frame1 + ((float)(currentFrame())/nSamps()) * _frames; #ifdef debug printf("\tgetting frame %g of %d (%d out of %d signal samps)\n", _frameno, (int)_frames, currentFrame(), nSamps()); #endif if (_dataSet->getFrame(_frameno,_coeffs) == -1) break; // If requested, stabilize this frame before using if (_autoCorrect) stabilize(_coeffs, _nPoles); _ampmlt = _amp * _coeffs[RESIDAMP] / 10000.0; // XXX normalize this! float newpch = (_coeffs[PITCH] > 0.0) ? _coeffs[PITCH] : 64.0; if (_coeffs[RMSAMP] < _cutoff) _ampmlt = 0; if (_reson_is_on) { /* Treat _cf_fact as absolute freq. If _bw_fact is greater than 20, treat as absolute freq. Else treat as factor (i.e., cf * factor == bw). */ float cf = _cf_fact; float bw = (_bw_fact < 20.0) ? cf * _bw_fact : _bw_fact; rszset(SR, cf, bw, 1., _rsnetc); /* printf("%f %f %f %f\n",_cf_fact*cps, _bw_fact*_cf_fact*cps,_cf_fact,_bw_fact,cps); */ } float *cpoint = _coeffs + 4; if (_warpFactor != 0.0) { float warp = (_warpFactor > 1.) ? .0001 : _warpFactor; _ampmlt *= _warpPole.set(warp, cpoint, _nPoles); } _counter = int(((float)SR/(newpch * /*_perperiod*/ 1.0) ) * .5); // _counter = (RTBUFSAMPS < MAXVALS) ? RTBUFSAMPS : MAXVALS; // _counter = (_counter > (nSamps() - currentFrame())) ? nSamps() - currentFrame() : _counter; _counter = min(_counter, framesToRun() - n); if (_counter <= 0) break; rtgetin(_inbuf, this, _counter); // Deinterleave input for (int from=_inChannel, to=0; to < _counter; from += inchans, ++to) _buzvals[to] = _inbuf[from]; #ifdef debug printf("\t _buzvals[0] = %g\n", _buzvals[0]); #endif if (_warpFactor) { // float warp = (_warpFactor > 1.) ? shift(_coeffs[PITCH],newpch,(float)SR) : _warpFactor; float warp = _warpFactor; #ifdef debug printf("\tpch: %f newpch: %f d: %f\n",_coeffs[PITCH], newpch, warp); #endif /************* warp = ABS(warp) > .2 ? SIGN(warp) * .15 : warp; ***************/ _warpPole.run(_buzvals, warp, cpoint, _alpvals, _counter); } else { ballpole(_buzvals,&_jcount,_nPoles,_past,cpoint,_alpvals,_counter); } #ifdef debug { int x; float maxamp=0; for (x=0;x<_counter;x++) { if (ABS(_alpvals[x]) > ABS(maxamp)) maxamp = _alpvals[x]; } printf("\t maxamp = %g\n", maxamp); } #endif if (_reson_is_on) bresonz(_alpvals,_rsnetc,_alpvals,_counter); int sampsToAdd = min(_counter, framesToRun() - n); // printf("\tscaling %d samples by %g\n", sampsToAdd, _ampmlt); bmultf(_alpvals, _ampmlt, sampsToAdd); // Scale signal /* Write this block to the output buffer. */ rtbaddout(_alpvals, sampsToAdd); /* Keep track of how many sample frames this instrument has generated. */ increment(sampsToAdd); } // Handle case where last synthesized block extended beyond framesToRun() if (n > framesToRun()) { _leftOver = n - framesToRun(); _savedOffset = _counter - _leftOver; #ifdef debug printf("saving %d samples left over at offset %d\n", _leftOver, _savedOffset); #endif } return framesToRun(); }
bool BitmapImage::currentFrameKnownToBeOpaque() { return !frameHasAlphaAtIndex(currentFrame()); }
void JGRAN :: doupdate() { double p[19]; update(p, 19); amp = p[2]; if (amp_table) amp *= amp_table->tick(currentFrame(), 1.0); // Get new random values. double randur = fabs(durnoi->tick()); // [0, 1] double ranfreq = fabs(freqnoi->tick()); double ranamp = fabs(ampnoi->tick()); if (randomize_phase) ranphase = fabs(phasenoi->tick()) * TWO_PI; // Read pfields or tables, depending on number of args to inst. All this // nargs testing is for backwards compatibility with pre-v4 scores. double minfreq, maxfreq; if (nargs > 10) minfreq = p[10]; else minfreq = minfreq_table->tick(currentFrame(), 1.0); if (nargs > 11) maxfreq = p[11]; else maxfreq = maxfreq_table->tick(currentFrame(), 1.0); double minspeed, maxspeed; if (nargs > 12) minspeed = p[12]; else minspeed = minspeed_table->tick(currentFrame(), 1.0); if (nargs > 13) maxspeed = p[13]; else maxspeed = maxspeed_table->tick(currentFrame(), 1.0); double minintens, maxintens; if (nargs > 14) minintens = p[14]; else minintens = minintens_table->tick(currentFrame(), 1.0); if (nargs > 15) maxintens = p[15]; else maxintens = maxintens_table->tick(currentFrame(), 1.0); double density; if (nargs > 16) density = p[16]; else density = density_table->tick(currentFrame(), 1.0); // Compute next grain duration. double logminspeed = log(minspeed); double speeddiff = fabs(log(maxspeed) - logminspeed); int tmp = (int) ((double) krate / exp(logminspeed + (randur * speeddiff))); next_graindur = ((double) tmp / (double) krate) + (1.0 / (double) krate); // Compute next grain amplitude multiplier. if (ranamp < density) { double intens = minintens + ((maxintens - minintens) * ranamp); next_grainamp = ampdb(intens); } else next_grainamp = 0.0; // Compute next carrier frequency. double logminfreq = log(minfreq); double freqdiff = fabs(log(maxfreq) - logminfreq); next_carfreq = exp(logminfreq + (ranfreq * freqdiff)); // Compute next modulator frequency and depth, if we're doing FM. if (osctype == FM) { double modmult, index; if (nargs > 8) modmult = p[8]; else modmult = modmult_table->tick(currentFrame(), 1.0); if (nargs > 9) index = p[9]; else index = modindex_table->tick(currentFrame(), 1.0); next_modfreq = next_carfreq * modmult; next_moddepth = index * next_modfreq; } // Compute next pan. if (outputChannels() == 2) { double pan, panvar; if (nargs > 17) pan = p[17]; else pan = pan_table->tick(currentFrame(), 1.0); if (nargs > 18) panvar = p[18]; else panvar = panvar_table->tick(currentFrame(), 1.0); next_grainpan = pan; double ranpan = pannoi->tick(); // [-1, 1] ranpan *= panvar; next_grainpan += ranpan; if (next_grainpan > 1.0) next_grainpan = 1.0; else if (next_grainpan < 0.0) next_grainpan = 0.0; } }
/* ------------------------------------------------------------------ run --- */ int MROOM::run() { const int samps = framesToRun() * inputChannels(); rtgetin(in, this, samps); for (int i = 0; i < samps; i += inputChannels()) { float insig, delval = 0.0, rvbsig = 0.0; if (currentFrame() < insamps) { /* still taking input */ if (--branch <= 0) { if (amparray) aamp = tablei(currentFrame(), amparray, amptabs) * ovamp; branch = skip; } if (--quantbranch <= 0) { float xposit = tablei(currentFrame(), xpos, xpostabs); float yposit = tablei(currentFrame(), ypos, ypostabs); distndelset(xposit, yposit, xdim, ydim, innerwidth, reflect); quantbranch = quantskip; } if (inchan == AVERAGE_CHANS) { insig = 0.0; for (int n = 0; n < inputChannels(); n++) insig += in[i + n]; insig /= (float)inputChannels(); } else insig = in[i + inchan]; insig *= aamp; } else /* in ring-down phase */ insig = 0.0; DELPUT(insig, delayline, deltabs); float rout = 0.0; for (int m = 1; m < NTAPS; m += 2) { #ifdef INTERP_GET DLIGET(delayline, del[m], deltabs, delval); #else DELGET(delayline, del[m], deltabs, delval); #endif rout += delval * amp[m]; if (m < 2) rvbsig = -rout; } rvbsig += rout; float out[2]; out[0] = rout + reverb(rvbsig, rvbarrayr); float lout = 0.0; for (int m = 0; m < NTAPS; m += 2) { #ifdef INTERP_GET DLIGET(delayline, del[m], deltabs, delval); #else DELGET(delayline, del[m], deltabs, delval); #endif lout += delval * amp[m]; if (m < 2) rvbsig = -lout; } rvbsig += lout; out[1] = lout + reverb(rvbsig, rvbarrayl); rtaddout(out); increment(); } return framesToRun(); }
QVariantMap WebPage::pageHeaders() { return currentFrame()->property("headers").toMap(); }