void AudioController::OpenAudio(const wxString &url) { CloseAudio(); if (!url) throw agi::InternalError("AudioController::OpenAudio() was passed an empty string. This must not happen.", 0); wxString path_part; if (url.StartsWith(_T("dummy-audio:"), &path_part)) { /* * scheme ::= "dummy-audio" ":" signal-specifier "?" signal-parameters * signal-specifier ::= "silence" | "noise" | "sine" "/" frequency * frequency ::= integer * signal-parameters ::= signal-parameter [ "&" signal-parameters ] * signal-parameter ::= signal-parameter-name "=" integer * signal-parameter-name ::= "sr" | "bd" | "ch" | "ln" * * Signal types: * "silence", a silent signal is generated. * "noise", a white noise signal is generated. * "sine", a sine wave is generated at the specified frequency. * * Signal parameters: * "sr", sample rate to generate signal at. * "bd", bit depth to generate signal at (usually 16). * "ch", number of channels to generate, usually 1 or 2. The same signal is generated * in every channel even if one would be LFE. * "ln", length of signal in samples. ln/sr gives signal length in seconds. */ provider = new DummyAudioProvider(5*30*60*1000, path_part.StartsWith(L"noise")); } else if (url.StartsWith(_T("video-audio:"), &path_part)) { /* * scheme ::= "video-audio" ":" stream-type * stream-type ::= "stream" | "cache" * * Stream types: * * "stream", the audio is streamed as required directly from the video provider, * and cannot be used to drive an audio display. Seeking is unreliable. * * "cache", the entire audio is cached to memory or disk. Audio displays can be * driven and seeking is reliable. Opening takes longer because the entire audio * stream has to be decoded and stored. */ } else if (url.StartsWith(_T("file:"), &path_part)) { /* * scheme ::= "file" ":" "//" file-system-path * * On Unix-like systems, the file system path is regular. On Windows-systems, the * path uses forward slashes instead of back-slashes and the drive letter is * preceded by a slash. * * URL-encoding?? */ } else { /* * Assume it's not a URI but instead a filename in the platform's native format. */ wxFileName fn(url); if (!fn.FileExists()) { agi::FileNotFoundError fnf(STD_STR(url)); throw agi::AudioOpenError( "Failed opening audio file (parsing as plain filename)", &fnf); } provider = AudioProviderFactory::GetProvider(url); } try { player = AudioPlayerFactory::GetAudioPlayer(); player->SetProvider(provider); player->OpenStream(); } catch (...) { delete player; delete provider; player = 0; provider = 0; throw; } audio_url = url; // Tell listeners about this. AnnounceAudioOpen(provider); }
void check(F *f) { int caught; // try with whole object caught = 0; try { fnf(f); } catch(A *p) { abort(); } // A is ambiguous catch(F *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnf(f); } catch(A *p) { abort(); } // A is ambiguous catch(E *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnf(f); } catch(A *p) { abort(); } // A is ambiguous catch(D *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnf(f); } catch(A *p) { abort(); } // A is ambiguous catch(B *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnf(f); } catch(A *p) { abort(); } // A is ambiguous catch(C *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); // try with D object caught = 0; try { fnd(f); } catch(A *p) { abort(); } // A is ambiguous catch(D *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnd(f); } catch(A *p) { abort(); } // A is ambiguous catch(B *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnd(f); } catch(A *p) { abort(); } // A is ambiguous catch(C *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); // try with E object caught = 0; try { fne(f); } catch(A *p) { caught = 1; if (p != (E *)f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fne(f); } catch(E *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fne(f); } catch(F *p) { abort(); } catch(...) { caught = 1; } if (!caught) abort(); // try with an A object caught = 0; try { fna((B *)f); } catch(B *p) { abort(); } // throw type is static type catch(A *p) { caught = 1; if (p != (B *)f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fna((C *)f); } catch(C *p) { abort(); } // throw type is static type catch(A *p) { caught = 1; if (p != (C *)f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fna((E *)f); } catch(E *p) { abort(); } // throw type is static type catch(A *p) { caught = 1; if (p != (E *)f) abort();} catch(...) { abort(); } if (!caught) abort(); // try with B object caught = 0; try { fnb((B *)f); } catch(A *p) { caught = 1; if (p != (B *)f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnb((B *)f); } catch(B *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnb((B *)f); } catch(C *p) { abort(); } catch(D *p) { abort(); } catch(...) { caught =1; } if (!caught) abort(); // try with C object caught = 0; try { fnc((C *)f); } catch(A *p) { caught = 1; if (p != (C *)f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnc((C *)f); } catch(C *p) { caught = 1; if (p != f) abort();} catch(...) { abort(); } if (!caught) abort(); caught = 0; try { fnc((C *)f); } catch(B *p) { abort(); } catch(D *p) { abort(); } catch(...) { caught =1; } if (!caught) abort(); return; }
//_____________________________________________________________________________ Bool_t ProofAux::Process(Long64_t entry) { // The Process() function is called for each entry in the tree (or possibly // keyed object in the case of PROOF) to be processed. The entry argument // specifies which entry in the currently loaded tree is to be processed. // It can be passed to either ProofAux::GetEntry() or TBranch::GetEntry() // to read either all or the required parts of the data. When processing // keyed objects with PROOF, the object is already loaded and is available // via the fObject pointer. // // This function should contain the "body" of the analysis. It can contain // simple or elaborate selection criteria, run algorithms on the data // of the event and typically fill histograms. // // The processing can be stopped by calling Abort(). // // Use fStatus to set the return value of TTree::Process(). // // The return value is currently not used. // Nothing to do if the action if not defined if (fAction < 0) { Error("Process", "action not specified!"); return kFALSE; } // Link to current element, if any TDSetElement *fCurrent = 0; TPair *elemPair = 0; if (fInput && (elemPair = dynamic_cast<TPair *>(fInput->FindObject("PROOF_CurrentElement")))) { if ((fCurrent = dynamic_cast<TDSetElement *>(elemPair->Value()))) { Info("Process", "entry %lld: file: '%s'", entry, fCurrent->GetName()); } else { Error("Process", "entry %lld: no file specified!", entry); return kFALSE; } } // Act now if (fAction == 0) { TString fnt; // Generate the TTree and save it in the specified file if (GenerateTree(fCurrent->GetName(), fNEvents, fnt) != 0) { Error("Process", "problems generating tree (%lld, %s, %lld)", entry, fCurrent->GetName(), fNEvents); return kFALSE; } // The output filename TString fnf(fnt); TString xf = gSystem->BaseName(fnf); fnf = gSystem->DirName(fnf); if (xf.Contains("tree")) { xf.ReplaceAll("tree", "friend"); } else { if (xf.EndsWith(".root")) { xf.ReplaceAll(".root", "_friend.root"); } else { xf += "_friend"; } } fnf += TString::Format("/%s", xf.Data()); // Generate the TTree friend and save it in the specified file if (GenerateFriend(fnt, fnf) != 0) { Error("Process", "problems generating friend tree for %s (%s)", fCurrent->GetName(), fnt.Data()); return kFALSE; } } else if (fAction == 1) { TString fnt; // Generate the TTree and save it in the specified file if (GenerateTree(fCurrent->GetName(), fNEvents, fnt) != 0) { Error("Process", "problems generating tree (%lld, %s, %lld)", entry, fCurrent->GetName(), fNEvents); return kFALSE; } // Generate the TTree friend and save it in the specified file if (GenerateFriend(fnt) != 0) { Error("Process", "problems generating friend tree for %s (%s)", fCurrent->GetName(), fnt.Data()); return kFALSE; } } else { // Unknown action Warning("Process", "do not know how to process action %d - do nothing", fAction); return kFALSE; } return kTRUE; }