ComponentResult AUInstrumentBase::Reset( AudioUnitScope inScope, AudioUnitElement inElement) { #if DEBUG_PRINT printf("AUInstrumentBase::Reset\n"); #endif if (inScope == kAudioUnitScope_Global) { // kill all notes.. mFreeNotes.Empty(); for (UInt32 i=0; i<mNumNotes; ++i) { SynthNote *note = GetNote(i); if (note->IsSounding()) note->Kill(0); note->ListRemove(); mFreeNotes.AddNote(note); } mNumActiveNotes = 0; mAbsoluteSampleFrame = 0; // empty lists. UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); group->Reset(); } } return noErr; }
ComponentResult AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inNumberFrames) { PerformEvents(inTimeStamp); UInt32 numOutputs = Outputs().GetNumberOfElements(); for (UInt32 j = 0; j < numOutputs; ++j) { AudioBufferList& bufferList = GetOutput(j)->GetBufferList(); for (UInt32 k = 0; k < bufferList.mNumberBuffers; ++k) { memset(bufferList.mBuffers[k].mData, 0, bufferList.mBuffers[k].mDataByteSize); } } UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); OSStatus err = group->Render(inNumberFrames); if (err) return err; } mAbsoluteSampleFrame += inNumberFrames; return noErr; }
void ALMGroup::_Build(BALMLayout* layout, BReference<XTab> left, BReference<YTab> top, BReference<XTab> right, BReference<YTab> bottom) const { if (LayoutItem()) layout->AddItem(LayoutItem(), left, top, right, bottom); else if (View()) { layout->AddView(View(), left, top, right, bottom); } else { for (unsigned int i = 0; i < Groups().size(); i++) { const ALMGroup& current = Groups()[i]; if (Orientation() == B_HORIZONTAL) { BReference<XTab> currentRight; if (i == Groups().size() - 1) currentRight = right; else currentRight = layout->AddXTab(); current._Build(layout, left, top, currentRight, bottom); left = currentRight; } else { BReference<YTab> currentBottom; if (i == Groups().size() - 1) currentBottom = bottom; else currentBottom = layout->AddYTab(); current._Build(layout, left, top, right, currentBottom); top = currentBottom; } } } }
OSStatus AUInstrumentBase::Render( AudioUnitRenderActionFlags & ioActionFlags, const AudioTimeStamp & inTimeStamp, UInt32 inNumberFrames) { PerformEvents(inTimeStamp); AUScope &outputs = Outputs(); UInt32 numOutputs = outputs.GetNumberOfElements(); for (UInt32 j = 0; j < numOutputs; ++j) { GetOutput(j)->PrepareBuffer(inNumberFrames); // AUBase::DoRenderBus() only does this for the first output element AudioBufferList& bufferList = GetOutput(j)->GetBufferList(); for (UInt32 k = 0; k < bufferList.mNumberBuffers; ++k) { memset(bufferList.mBuffers[k].mData, 0, bufferList.mBuffers[k].mDataByteSize); } } UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); OSStatus err = group->Render((SInt64)inTimeStamp.mSampleTime, inNumberFrames, outputs); if (err) return err; } mAbsoluteSampleFrame += inNumberFrames; return noErr; }
SynthNote* AUInstrumentBase::VoiceStealing(UInt32 inFrame, bool inKillIt) { #if DEBUG_PRINT printf("enter voice stealing\n"); #endif // free list was empty so we need to kill a note. UInt32 startState = inKillIt ? kNoteState_FastReleased : kNoteState_Released; for (UInt32 i = startState; i <= startState; --i) { #if DEBUG_PRINT printf(" steal state %d\n", i); #endif UInt32 numGroups = Groups().GetNumberOfElements(); for (UInt32 j = 0; j < numGroups; ++j) { SynthGroupElement *group = (SynthGroupElement*)Groups().GetElement(j); #if DEBUG_PRINT printf(" steal group %d size %d\n", j, group->mNoteList[i].Length()); #endif if (group->mNoteList[i].NotEmpty()) { #if DEBUG_PRINT printf("not empty %d %d\n", i, j); #endif SynthNote *note = group->mNoteList[i].FindMostQuietNote(); if (inKillIt) { #if DEBUG_PRINT printf("--=== KILL ===---\n"); #endif note->mRelativeKillFrame = inFrame; note->Kill(inFrame); group->mNoteList[i].RemoveNote(note); if (i != kNoteState_FastReleased) DecNumActiveNotes(); return note; } else { #if DEBUG_PRINT printf("--=== FAST RELEASE ===---\n"); #endif group->mNoteList[i].RemoveNote(note); note->FastRelease(inFrame); group->mNoteList[kNoteState_FastReleased].AddNote(note); DecNumActiveNotes(); // kNoteState_FastReleased counts as inactive for voice stealing purposes. return NULL; } } } } #if DEBUG_PRINT printf("no notes to steal????\n"); #endif return NULL; // It should be impossible to get here. It means there were no notes to kill in any state. }
void GlooxCLEntry::RerequestAuth (const QString& reason) { if (ODS_) return; Account_->GetClientConnection ()->Subscribe (GetJID (), reason, GetEntryName (), Groups ()); }
SynthGroupElement * AUInstrumentBase::GetElForNoteID (NoteInstanceID inNoteID) { #if DEBUG_PRINT printf("GetElForNoteID id %u\n", inNoteID); #endif AUScope & groups = Groups(); unsigned int numEls = groups.GetNumberOfElements(); for (unsigned int i = 0; i < numEls; ++i) { SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i)); if (el->GetNote(inNoteID) != NULL) // searches for any note state return el; } throw static_cast<OSStatus>(kAudioUnitErr_InvalidElement); }
SynthGroupElement * AUInstrumentBase::GetElForGroupID (MusicDeviceGroupID inGroupID) { AUScope & groups = Groups(); unsigned int numEls = groups.GetNumberOfElements(); SynthGroupElement* unassignedEl = NULL; for (unsigned int i = 0; i < numEls; ++i) { SynthGroupElement* el = reinterpret_cast<SynthGroupElement*>(groups.GetElement(i)); if (el->GroupID() == inGroupID) return el; if (el->GroupID() == SynthGroupElement::kUnassignedGroup) { unassignedEl = el; break; // we fill this up from the start of the group scope vector } } if (unassignedEl) { unassignedEl->SetGroupID(inGroupID); return unassignedEl; } throw static_cast<OSStatus>(kAudioUnitErr_InvalidElement); }
TextureAtlas() : TextureAtlas(0, Groups()) { }
void VkEntry::ReemitGroups () { emit groupsChanged (Groups ()); }
void GlooxCLEntry::SetAuthRequested (bool auth) { AuthRequested_ = auth; emit statusChanged (GetStatus (QString ()), QString ()); emit groupsChanged (Groups ()); }
int main(int argc, char **argv) { int done; char units[16], fname[80]; int optc; while ( (optc = bu_getopt( argc, argv, "tsmnc" )) != -1) { switch ( optc ) /* Set joint type and cable option */ { case 't': torus = 1; break; case 's': sphere = 1; break; case 'm': mitre = 1; break; case 'n': nothing = 1; break; case 'c': cable = 1; break; case '?': fprintf( stderr, "Illegal option %c\n", optc ); Usage(); return 1; break; } } if ( (torus + sphere + mitre + nothing) > 1 ) /* Too many joint options */ { Usage(); fprintf( stderr, "Options t, s, m, n are mutually exclusive\n" ); return 1; } else if ( (torus + sphere + mitre + nothing) == 0 ) { torus = 1; /* default */ } if ( (argc - bu_optind) != 2 ) { Usage(); return 1; } bu_strlcpy( name, argv[bu_optind++], sizeof(name) ); /* Base name for objects */ fdout = wdb_fopen( argv[bu_optind] ); if ( fdout == NULL ) { fprintf( stderr, "Cannot open %s\n", argv[bu_optind] ); perror( "Pipe" ); Usage(); return 1; } MAT_IDN(identity); /* Identity matrix for all objects */ pi = atan2( 0.0, -1.0 ); /* PI */ printf( "FLUID & PIPING V%d.%d 10 Mar 89\n\n", VERSION, RELEASE ); printf( "append %s to your target description using 'concat' in mged\n", argv[bu_optind] ); k = 0.0; while ( k == 0.0 ) { printf( "UNITS? (ft, in, m, cm, default is millimeters) "); bu_fgets(units, sizeof(units), stdin); switch (units[0]) { case '\0': k = 1.0; break; case 'f': k = 12*25.4; break; case 'i': k=25.4; break; case 'm': if ( units[1] == '\0') k=1000.0; else k=1.0; break; case 'c': k=10.0; break; default: k=0.0; printf( "\n\t%s is not a legal choice for units\n", units ); printf( "\tTry again\n" ); break; } } done = 0; while ( !done ) { if ( !cable ) { printf( "radius and wall thickness: "); if (scanf("%lf %lf", &radius, &wall) == EOF ) return 1; if (radius > wall) done = 1; else { printf( " *** bad input!\n\n"); printf( "\tradius must be larger than wall thickness\n" ); printf( "\tTry again\n" ); } } else { printf( "radius: "); if ( scanf("%lf", &radius ) == EOF ) return 1; done=1; } } radius=k*radius; wall=k*wall; Readpoints(); /* Read data points */ Names(); /* Construct names for all solids */ Normals(); /* Calculate normals and other vectors */ Adjust(); /* Adjust points to allow for elbows */ /* Generate Title */ bu_strlcpy(fname, name, sizeof(fname)); if ( !cable ) bu_strlcat(fname, " pipe and fluid", sizeof(fname)); else bu_strlcat(fname, " cable", sizeof(fname)); /* Create ident record */ mk_id(fdout, fname); Pipes(); /* Construct the piping */ Elbows(); /* Construct the elbow sections */ Groups(); /* Make some groups */ return 0; }
void MSNBuddyEntry::SetGroups (const QStringList& groups) { Account_->GetGroupManager ()->SetGroups (this, groups, Groups ()); }
void MRIMBuddy::SetGroup (const QString& group) { Info_.GroupNumber_ = A_->GetGroupManager ()->GetGroupNumber (group); Group_ = group; emit groupsChanged (Groups ()); }