void endCd() {
     std::cout << "Shutting down CD..." << std::endl;
     _amp->off();
     _amp->setCd(_cd);
     _cd->eject();
     _cd->off();
 }
 void listenToRadio(double frequency) {
     std::cout << "Tuning in the airwaves..." << std::endl;
     _tuner->on();
     _tuner->setFrequency(frequency);
     _amp->on();
     _amp->setVolume(5);
     _amp->setTuner(_tuner);
 }
 void endCd()
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::endCd"));
   std::cout << "Shutting down CD..." << std::endl;
   _amp->off();
   _amp->setCd( _cd );
   _cd->eject();
   _cd->off();
 }
 void listenToCd(std::string cdTitle) {
     std::cout << "Get ready for an audiopile experence..." << std::endl;
     _lights->on();
     _amp->on();
     _amp->setVolume(5);
     _amp->setCd(_cd);
     _amp->setStereoSound();
     _cd->on();
     _cd->play(cdTitle);
 }
 void listenToRadio( double frequency )
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::listenToRadio"));
   std::cout << "Tuning in the airwaves..." << std::endl;
   _tuner->on();
   _tuner->setFrequency( frequency );
   _amp->on();
   _amp->setVolume( 5 );
   _amp->setTuner( _tuner );
 }
 void listenToCd( std::string cdTitle )
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::listenToCd"));
   std::cout << "Get ready for an audiopile experence..." << std::endl;
   _lights->on();
   _amp->on();
   _amp->setVolume( 5 );
   _amp->setCd( _cd );
   _amp->setStereoSound();
   _cd->on();
   _cd->play( cdTitle );
 }
 void watchMovie(std::string movie) {
     std::cout << "Get ready to watch a movie..." << std::endl;
     _popper->on();
     _popper->pop();
     _lights->dim(10);
     _screen->down();
     _projector->on();
     _projector->wideScreenMode();
     _amp->on();
     _amp->setDvd(_dvd);
     _amp->setSurroundSound();
     _amp->setVolume(5);
     _dvd->on();
     _dvd->play(movie);
 }
示例#8
0
 void playMovie()
 {
     dvd->on();
     projector->on();
     amplifier->on();
     dvd->play();
 }
 void endRadio()
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::endRadio"));
   std::cout << "Shutting down the tuner..." << std::endl;
   _tuner->off();
   _amp->off();
 }
示例#10
0
 void watchMovie( std::string movie )
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::watchMovie"));
   std::cout << "Get ready to watch a movie..." << std::endl;
   _popper->on();
   _popper->pop();
   _lights->dim( 10 );
   _screen->down();
   _projector->on();
   _projector->wideScreenMode();
   _amp->on();
   _amp->setDvd( _dvd );
   _amp->setSurroundSound();
   _amp->setVolume( 5 );
   _dvd->on();
   _dvd->play( movie );
 }
示例#11
0
int main()
{

	Audio_IO audiostream;

	audiostream.set_mode(AUDIO_IO_READWRITE);
  audiostream.set_samplerate(SAMPLERATE); // constante aanmaken
  audiostream.set_nrofchannels(NOC);	// constante aanmaken
  audiostream.set_framesperbuffer(FPB); // constante aanmaken

  audiostream.initialise();
  audiostream.list_devices();

	int device;
	cout << "\nGive input device number: ";
  cin >> device;
  audiostream.set_input_device(device);

  cout << "Give output device number: ";
  cin >> device;
  audiostream.set_output_device(device);

  audiostream.start_server();

		Amplifier* amp;
		
		switch(MODE)
		{
			default: amp = new Amplifier();
			case 0: amp = new Amplifier();
			case 1: amp = new Tremolo();
			case 2: amp = new Bitcrusher();
		}

		while(true)
		{
			audiostream.read(amp->get_buffer());
			amp->process_samples();
			audiostream.write(amp->get_buffer());
		}

		audiostream.finalise();
	
		return 0;
} // main()
示例#12
0
int main()
{
    DVD dvd;
    Amplifier amplifier;
    Projector projector;
    // non-facade method
    // play movie
    cout<<"################# Non-facade Pattern ####################"<<endl;
    dvd.on();
    projector.on();
    amplifier.on();
    dvd.play();

    // using facade pattern
    cout<<"################# Facade Pattern ####################"<<endl;
    FacadeThreater ft(&dvd, &amplifier, &projector);
    ft.playMovie();
    return 0;
}
 void endMovie() {
     std::cout << "Shutting movie theater down..." << std::endl;
     _popper->off();
     _lights->on();
     _screen->up();
     _projector->off();
     _amp->off();
     _dvd->stop();
     _dvd->eject();
     _dvd->off();
 }
示例#14
0
 void endMovie()
 {
   HUM_TRACE(ACE_TEXT("HomeTheaterFacade::endMovie"));
   std::cout << "Shutting movie theater down..." << std::endl;
   _popper->off();
   _lights->on();
   _screen->up();
   _projector->off();
   _amp->off();
   _dvd->stop();
   _dvd->eject();
   _dvd->off();
 }
示例#15
0
int main(int argc, char** argv) {
    std::cout << "%SUITE_STARTING% testAmplifierServer" << std::endl;
    Amplifier driver;
    AmplifierServer server(&driver);
    driver.set_description(new DummyAmpDesc(&driver));
    std::cout << "Amplifier driver created" << std::endl;
    std::cout << driver.get_description()->get_json();
    po::options_description options("Program Options");
	options.add_options()
			("help,H","Show program options and help");
	options.add(driver.get_options()).add(server.get_options());
	po::variables_map vm;
	po::store(po::parse_command_line(argc,argv,options),vm);
	if (vm.count("help"))
		cout << options <<"\n";
	po::notify(vm);
	Logger log(driver.get_sampling_rate(),"testServer");
    server.set_logger(&log);
	server.init(vm);
	if (!vm.count("start"))
		server.start_sampling();
    return (EXIT_SUCCESS);
}
示例#16
0
int main(int argc, char* argv[])
{
    if (argc < 2)
    {
        cout << "Please provide something like this: " << endl;
        cout << "'guitarfx amplifier 1','guitarfx distortion 75 0.5' or 'guitarfx tremolo 5 0.5'" << endl;
        cout << "'these parameters are: amplitude, gain & bandwith, and rate & depth" << endl;
        return 0;
    }
    
    else if (argc > 2)
    {
        if (strcmp(argv[1], "amplifier") == 0)
        {
            Amplifier* effect;
            effect = new Amplifier();
            effect->setLevel(atof(argv[2]));
            cout << endl;
            effect->info();
            cout << endl;
            effect->startAudioCallback();
            while (true)
            {
                effect->readBuffer();
                effect->process();
                effect->writeBuffer();
            }
        }
        
        else if (strcmp(argv[1], "distortion") == 0)
        {
            Distortion* effect;
            effect = new Distortion();
            effect->setGain(atof(argv[2]));
            effect->setBandwith(atof(argv[3]));
            cout << endl;
            effect->info();
            cout << endl;
            effect->startAudioCallback();
            while (true)
            {
                effect->readBuffer();
                effect->process();
                effect->writeBuffer();
            }
        }
        
        else if (strcmp(argv[1], "tremolo") == 0)
        {
            Tremolo* effect;
            effect = new Tremolo();
            effect->setRate(atof(argv[2]));
            effect->setDepth(atof(argv[3]));
            cout << endl;
            effect->info();
            cout << endl;
            effect->startAudioCallback();
            while (true)
            {
                effect->readBuffer();
                effect->process();
                effect->writeBuffer();
            }
        }
    }
} // main()
示例#17
0
 void stopMovie()
 {
     amplifier->off();
     projector->off();
     dvd->off();
 }
 void endRadio() {
     std::cout << "Shutting down the tuner..." << std::endl;
     _tuner->off();
     _amp->off();
 }