コード例 #1
0
ファイル: play.cpp プロジェクト: stgnet/stglib
int main(int argc,char **argv)
{
	if (!*++argv)
	{
		StdOutput<<"use: play (file.wav)\n";
		exit(1);
	}

	StWaveFile source(*argv);
	if (source._Error)
	{
		StdError<<"could not open file: "<<source._GetErrorString()<<"\n";
		exit(2);
	}

	StdOutput<<"       Format="<<source._WaveFormat.Format<<"\n";
	StdOutput<<"     Channels="<<source._WaveFormat.Channels<<"\n";
	StdOutput<<"SamplesPerSec="<<source._WaveFormat.SamplesPerSec<<"\n";
	StdOutput<<"BitsPerSample="<<source._WaveFormat.BitsPerSample<<"\n";

	StAudioOutput speaker(source._WaveFormat);
	if (speaker._Error)
	{
		StdError<<"could not open speaker: "<<speaker._GetErrorString()<<"\n";
		exit(3);
	}

	source>>speaker;

	return(0);
}
コード例 #2
0
int main()
{
    // Turn off miniblip buzzer
    PwmOut speaker(P0_8);
    speaker=0.0;
    // Create a temporary DigitalIn so we can configure the pull-down resistor.
    DigitalIn(DATA_PIN, PullDown);

    // The pixel array control class.
    neopixel::PixelArray array(DATA_PIN);

    neopixel::Pixel vector[25];
    void_matrix(vector);
    

    
    
    
    while (1) {
        float pot = ain.read() * 100.0f;
        if(pot<50){
            drawVector(sonrisa,vector,255,0,0);
        }else{
            drawVector(sonrisaTriste,vector,0,0,255);
        }
        
        array.update(vector, 64);
        wait_ms(500);
        
    }
}
コード例 #3
0
int main()
{
    // Turn off miniblip buzzer
    PwmOut speaker(P0_8);
    speaker=0.0;
    // Create a temporary DigitalIn so we can configure the pull-down resistor.
    DigitalIn(DATA_PIN, PullDown);

    // The pixel array control class.
    neopixel::PixelArray array(DATA_PIN);

    neopixel::Pixel vector[25];
    void_matrix(vector);
    

    
    
    
    while (1) {
        float pot = ain.read() * 100.0f;
        if(pot<25)
            drawVector(sonrisaTriste,vector,0,0,255);
        else 
            if(pot >=25 && pot <75)
                drawVector(sonrisaRegular,vector,0,255,0);
            else
                drawVector(sonrisa,vector,255,0,0);
        float pushed = din.read();
        if(pushed>0.5)
            drawVector(bocaAbierta,vector,255,255,0);
        array.update(vector, 64);
        wait_ms(75);
        
    }
}
コード例 #4
0
int main()
{
    // Turn off miniblip buzzer
    PwmOut speaker(P0_8);
    speaker=0.0;
    // Create a temporary DigitalIn so we can configure the pull-down resistor.
    DigitalIn(DATA_PIN, PullDown);
    // The pixel array control class.
    neopixel::PixelArray array(DATA_PIN);    

    //Genero la variable que representa el potenciometro
    AnalogIn   ain(POTEN);

    
    for(int j=0;j<NLEDS;j++){
        tablero[j]= EMPTY;   
    }
    tablero[bird]=BIRD;   
     
    
    while (1) {
        if(ciclos==0){
            ciclos = NUMEROCICLOSPORJUEGADA;
            if(!lose)generarTablero();            
        }
        pintarTablero();
        colorbrigthness::calculatecolorMatrix(lista,NLEDS,255*ain);
        array.update(lista,NLEDS);
        ciclos--;
        wait_ms(100);        
    }
}
コード例 #5
0
static int main_(int /* argc */, char** /*argv*/)
{
    ff::sinks::speech_sink sink(SPF_IS_FILENAME);

#ifdef FASTFORMAT_USE_VOLE
    vole::object    speaker(comstl::interface_cast<IDispatch>(sink.get()));
#endif /* FASTFORMAT_USE_VOLE */

#ifdef FASTFORMAT_USE_VOLE
    { for(long rate = 0; 5 != rate; ++rate)
    {
        speaker.put_property(L"Rate", rate * 2);
#endif /* FASTFORMAT_USE_VOLE */

        ff::fmt(sink
            ,   FF_STR("This is a demonstration of FastFormat's ability to speak, compiled with {0}, in configuration {1}, and with the {2} encoding")
            /* {0}: compiler name */
            ,   FF_STRINGIZE(STLSOFT_COMPILER_VERSION_STRING)
            /* {1}: configuration */
            ,   FF_STRINGIZE(FF_CONFIGURATION)
            /* {2}: encoding */
            ,   FF_STRINGIZE(FF_ENCODING)
            );

#ifdef FASTFORMAT_USE_VOLE
    }}
#endif /* FASTFORMAT_USE_VOLE */

    return EXIT_SUCCESS;
}
コード例 #6
0
int main()
{
    // Turn off miniblip buzzer
    PwmOut speaker(P0_8);
    speaker=0.0;
    // Create a temporary DigitalIn so we can configure the pull-down resistor.
    DigitalIn(DATA_PIN, PullDown);

    // The pixel array control class.
    neopixel::PixelArray array(DATA_PIN);

    // Generamos el array y lo vaciamos
    neopixel::Pixel vector[25];
    void_matrix(vector);
    //Introducimos varios colores de prueba
    fill_pixel(vector,0,0,255,0,0);
    fill_pixel(vector,1,1,255,0,0);
    fill_pixel(vector,2,2,0,255,0);
    fill_pixel(vector,3,3,255,0,0);
    fill_pixel(vector,4,4,255,0,0);
    fill_pixel(vector,0,4,0,0,255);
    fill_pixel(vector,1,3,0,0,255);
    fill_pixel(vector,3,1,0,0,255);
    fill_pixel(vector,4,0,0,0,255);
    
    
    while (1) {
        array.update(vector, 64);
        
    }
}
コード例 #7
0
ファイル: robot.cpp プロジェクト: querry43/Arduino
robot::robot() :
    left_arm(servo(1, left_arm_min, left_arm_min + arm_range)),
    right_arm(servo(0, right_arm_min, right_arm_min - arm_range)),
    head(servo(2, head_center - head_range, head_center + head_range)),
    torso(servo(3, torso_center - torso_range, torso_center + torso_range)),
    tilt(servo(15, tilt_center - tilt_range, tilt_center + tilt_range)),
    left_eye(rgb_led(4)),
    right_eye(rgb_led(8)),
    chest(led_grid(2, 3, 4, 5)),
    voice(speaker(9)){ }
コード例 #8
0
static void dma_cmd8 (SB16State *s, int mask, int dma_len)
{
    s->fmt = AUD_FMT_U8;
    s->use_hdma = 0;
    s->fmt_bits = 8;
    s->fmt_signed = 0;
    s->fmt_stereo = (s->mixer_regs[0x0e] & 2) != 0;
    if (-1 == s->time_const) {
        if (s->freq <= 0)
            s->freq = 11025;
    }
    else {
        int tmp = (256 - s->time_const);
        s->freq = (1000000 + (tmp / 2)) / tmp;
    }

    if (dma_len != -1) {
        s->block_size = dma_len << s->fmt_stereo;
    }
    else {
        /* This is apparently the only way to make both Act1/PL
           and SecondReality/FC work

           Act1 sets block size via command 0x48 and it's an odd number
           SR does the same with even number
           Both use stereo, and Creatives own documentation states that
           0x48 sets block size in bytes less one.. go figure */
        s->block_size &= ~s->fmt_stereo;
    }

    s->freq >>= s->fmt_stereo;
    s->left_till_irq = s->block_size;
    s->bytes_per_second = (s->freq << s->fmt_stereo);
    /* s->highspeed = (mask & DMA8_HIGH) != 0; */
    s->dma_auto = (mask & DMA8_AUTO) != 0;
    s->align = (1 << s->fmt_stereo) - 1;

    if (s->block_size & s->align) {
        dolog ("warning: misaligned block size %d, alignment %d\n",
               s->block_size, s->align + 1);
    }

    ldebug ("freq %d, stereo %d, sign %d, bits %d, "
            "dma %d, auto %d, fifo %d, high %d\n",
            s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits,
            s->block_size, s->dma_auto, s->fifo, s->highspeed);

    continue_dma8 (s);
    speaker (s, 1);
}
コード例 #9
0
/**
 * @example     DuplexUART_Demo.cpp
 *
 * Write "Hello world!" out via UART protocol and receive an echo
 *
 * @include PropWare_DuplexUART/CMakeLists.txt
 */
int main () {
    uint32_t              threadStack[256];
    Listener              listener(threadStack);
    PropWare::SimplexUART speaker(TX_PIN);

    // Start our new cog and initialize the speaking UART
    speaker.set_baud_rate(BAUD_RATE);
    speaker.set_parity(PARITY);
    pwSyncOut.printf("New cog ID: %d. Ready to send!!!\n", PropWare::Runnable::invoke(listener));

    while (1) {
        waitcnt(200 * MILLISECOND + CNT);
        speaker.puts(TEST_STRING);
    }
}
コード例 #10
0
ファイル: test10.cpp プロジェクト: rinovan/AudioShift
int main(int argc, char** argv) {
    Pa_Initialize();
    std::atomic<bool> trigger;
    std::atomic<bool> exit;
    MyNode node;
    NodeThread nodeT(node);
    SpeakerThread speaker(nodeT.readHandle);
    nodeT.start();
    speaker.start();
    std::this_thread::sleep_for(std::chrono::seconds(10));
    GtkThread(argc, argv, node.trigger, &exit);
    nodeT.stop();
    speaker.stop();
    Pa_Terminate();
    return 0;
}
コード例 #11
0
int main() {
    
PwmOut speaker(P0_8);

    while(true){

    if(pushbutton){
    
        speaker=10.0;
    
    }else{
    
        speaker=0.0;    
    
    }
}

}
コード例 #12
0
ファイル: main.cpp プロジェクト: rafnarok/miniblip_examples
int main()
{
    // setup
    DigitalIn(MATRIX_PIN, PullDown);
    neopixel::PixelArray array(MATRIX_PIN);

    // Turn off miniblip buzzer
    PwmOut speaker(P0_8);
    speaker=0.0;
    
    pinta(0,0,0);
    
    wait(1);
    
    for (int i = 0; i < TOUCH_N; i++) {
        p_touch_io[i] = new DigitalInOut(touch_pin[i]);
        p_touch_io[i]->mode(PullDown);
        p_touch_io[i]->output();
        p_touch_io[i]->write(1);
    }
    
    tick.attach(detect, 1.0 / 64.0);
    
    while(1) {
        // do something
        
        switch (mode){
            case 1:
                pinta(20,0,0);
                break;
            case 2:
                pinta(0,20,0);
                break;
            case 3:
                pinta(0,0,20);
                break;
            case 4:
                pinta(20,20,0);
                break;
            }
        array.update(buffer, NLEDS); 
                
    }
}
コード例 #13
0
ファイル: bebox.cpp プロジェクト: PugsyMAME/mame
void bebox_state::bebox_peripherals(machine_config &config)
{
	config.m_minimum_quantum = attotime::from_hz(60);

	PIT8254(config, m_pit8254, 0);
	m_pit8254->set_clk<0>(4772720/4); /* heartbeat IRQ */
	m_pit8254->set_clk<1>(4772720/4); /* dram refresh */
	m_pit8254->set_clk<2>(4772720/4); /* pio port c pin 4, and speaker polling */
	m_pit8254->out_handler<0>().set(FUNC(bebox_state::bebox_timer0_w));
	m_pit8254->out_handler<2>().set("kbdc", FUNC(kbdc8042_device::write_out2));

	AM9517A(config, m_dma8237[0], XTAL(14'318'181)/3);
	m_dma8237[0]->out_hreq_callback().set(FUNC(bebox_state::bebox_dma_hrq_changed));
	m_dma8237[0]->out_eop_callback().set(FUNC(bebox_state::bebox_dma8237_out_eop));
	m_dma8237[0]->in_memr_callback().set(FUNC(bebox_state::bebox_dma_read_byte));
	m_dma8237[0]->out_memw_callback().set(FUNC(bebox_state::bebox_dma_write_byte));
	m_dma8237[0]->in_ior_callback<2>().set(FUNC(bebox_state::bebox_dma8237_fdc_dack_r));
	m_dma8237[0]->out_iow_callback<2>().set(FUNC(bebox_state::bebox_dma8237_fdc_dack_w));
	m_dma8237[0]->out_dack_callback<0>().set(FUNC(bebox_state::pc_dack0_w));
	m_dma8237[0]->out_dack_callback<1>().set(FUNC(bebox_state::pc_dack1_w));
	m_dma8237[0]->out_dack_callback<2>().set(FUNC(bebox_state::pc_dack2_w));
	m_dma8237[0]->out_dack_callback<3>().set(FUNC(bebox_state::pc_dack3_w));

	AM9517A(config, m_dma8237[1], XTAL(14'318'181)/3);

	PIC8259(config, m_pic8259[0], 0);
	m_pic8259[0]->out_int_callback().set(FUNC(bebox_state::bebox_pic8259_master_set_int_line));
	m_pic8259[0]->in_sp_callback().set_constant(1);
	m_pic8259[0]->read_slave_ack_callback().set(FUNC(bebox_state::get_slave_ack));

	PIC8259(config, m_pic8259[1], 0);
	m_pic8259[1]->out_int_callback().set(FUNC(bebox_state::bebox_pic8259_slave_set_int_line));
	m_pic8259[1]->in_sp_callback().set_constant(0);

	NS16550(config, "ns16550_0", 0);   /* TODO: Verify model */
	NS16550(config, "ns16550_1", 0);   /* TODO: Verify model */
	NS16550(config, "ns16550_2", 0);   /* TODO: Verify model */
	NS16550(config, "ns16550_3", 0);   /* TODO: Verify model */

	/* video hardware */
	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
	screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480);
	screen.set_screen_update("vga", FUNC(cirrus_gd5428_device::screen_update));

	cirrus_gd5428_device &vga(CIRRUS_GD5428(config, "vga", 0));
	vga.set_screen("screen");

	speaker_device &speaker(SPEAKER(config, "mono"));
	speaker.front_center();

	ym3812_device &ym3812(YM3812(config, "ym3812", 3579545));
	ym3812.add_route(ALL_OUTPUTS, speaker, 1.0);

	FUJITSU_29F016A(config, "flash");

	scsi_port_device &scsibus(SCSI_PORT(config, "scsi"));
	scsibus.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_0));
	scsibus.set_slot_device(2, "cdrom", SCSICD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_3));

	lsi53c810_device &scsictrl(LSI53C810(config, "lsi53c810"));
	scsictrl.set_irq_callback(FUNC(bebox_state::scsi_irq_callback));
	scsictrl.set_dma_callback(FUNC(bebox_state::scsi_dma_callback));
	scsictrl.set_fetch_callback(FUNC(bebox_state::scsi_fetch));
	scsictrl.set_scsi_port("scsi");

	ide_controller_device &idectrl(IDE_CONTROLLER(config, "ide"));
	idectrl.set_default_ata_devices("hdd", nullptr);
	idectrl.irq_handler().set(FUNC(bebox_state::bebox_ide_interrupt));

	/* pci */
	PCI_BUS(config, m_pcibus, 0);
	m_pcibus->set_busnum(0);

	pci_connector_device &pcislot0 = add_pci_slot(config, "pcibus:0", 0, "mpc105");
	pcislot0.set_option_machine_config("mpc105", mpc105_config);
	add_pci_slot(config, "pcibus:1", 1, "cirrus");

	/*MCFG_PCI_BUS_DEVICE(12, nullptr, scsi53c810_pci_read, scsi53c810_pci_write)*/

	SMC37C78(config, m_smc37c78, 24'000'000);
	m_smc37c78->intrq_wr_callback().set(FUNC(bebox_state::fdc_interrupt));
	m_smc37c78->drq_wr_callback().set(m_dma8237[0], FUNC(am9517a_device::dreq2_w));

	floppy_connector &fdc(FLOPPY_CONNECTOR(config, "smc37c78:0"));
	fdc.option_add("35hd", FLOPPY_35_HD);
	fdc.set_default_option("35hd");
	fdc.set_formats(bebox_state::floppy_formats);

	MC146818(config, "rtc", 32.768_kHz_XTAL);

	kbdc8042_device &kbdc(KBDC8042(config, "kbdc"));
	kbdc.set_keyboard_type(kbdc8042_device::KBDC8042_STANDARD);
	kbdc.system_reset_callback().set_inputline(m_ppc[0], INPUT_LINE_RESET);
	kbdc.input_buffer_full_callback().set(FUNC(bebox_state::bebox_keyboard_interrupt));

	/* internal ram */
	RAM(config, m_ram);
	m_ram->set_default_size("32M");
	m_ram->set_extra_options("8M,16M");
}
コード例 #14
0
static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t d0, int dma_len)
{
    s->use_hdma = cmd < 0xc0;
    s->fifo = (cmd >> 1) & 1;
    s->dma_auto = (cmd >> 2) & 1;
    s->fmt_signed = (d0 >> 4) & 1;
    s->fmt_stereo = (d0 >> 5) & 1;

    switch (cmd >> 4) {
    case 11:
        s->fmt_bits = 16;
        break;

    case 12:
        s->fmt_bits = 8;
        break;
    }

    if (-1 != s->time_const) {
#if 1
        int tmp = 256 - s->time_const;
        s->freq = (1000000 + (tmp / 2)) / tmp;
#else
        /* s->freq = 1000000 / ((255 - s->time_const) << s->fmt_stereo); */
        s->freq = 1000000 / ((255 - s->time_const));
#endif
        s->time_const = -1;
    }

    s->block_size = dma_len + 1;
    s->block_size <<= (s->fmt_bits == 16);
    if (!s->dma_auto) {
        /* It is clear that for DOOM and auto-init this value
           shouldn't take stereo into account, while Miles Sound Systems
           setsound.exe with single transfer mode wouldn't work without it
           wonders of SB16 yet again */
        s->block_size <<= s->fmt_stereo;
    }

    ldebug ("freq %d, stereo %d, sign %d, bits %d, "
            "dma %d, auto %d, fifo %d, high %d\n",
            s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits,
            s->block_size, s->dma_auto, s->fifo, s->highspeed);

    if (16 == s->fmt_bits) {
        if (s->fmt_signed) {
            s->fmt = AUD_FMT_S16;
        }
        else {
            s->fmt = AUD_FMT_U16;
        }
    }
    else {
        if (s->fmt_signed) {
            s->fmt = AUD_FMT_S8;
        }
        else {
            s->fmt = AUD_FMT_U8;
        }
    }

    s->left_till_irq = s->block_size;

    s->bytes_per_second = (s->freq << s->fmt_stereo) << (s->fmt_bits == 16);
    s->highspeed = 0;
    s->align = (1 << (s->fmt_stereo + (s->fmt_bits == 16))) - 1;
    if (s->block_size & s->align) {
        dolog ("warning: misaligned block size %d, alignment %d\n",
               s->block_size, s->align + 1);
    }

    if (s->freq) {
        struct audsettings as;

        s->audio_free = 0;

        as.freq = s->freq;
        as.nchannels = 1 << s->fmt_stereo;
        as.fmt = s->fmt;
        as.endianness = 0;

        s->voice = AUD_open_out (
            &s->card,
            s->voice,
            "sb16",
            s,
            SB_audio_callback,
            &as
            );
    }

    control (s, 1);
    speaker (s, 1);
}
コード例 #15
0
//---------------------------------------------------------------------------
std::vector<boost::shared_ptr<TFormMachine> > CreateMachines(
  TFormSimStagecraftMain * const formParent,
  const int level)
{
  std::vector<boost::shared_ptr<TFormMachine> > machines;

  switch (level)
  {
    case 1:
    {
      boost::shared_ptr<TFormMachine> m1(
          new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> m2(
          new TFormPar64(0,formParent));
      machines.push_back(m1);
      machines.push_back(m2);
    }
    break;
    case 2:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> mic(new TFormShureSm58(0,formParent));
      machines.push_back(mic);
      machines.push_back(speaker);
      machines.push_back(wallSocket220);
    }
    break;
    case 3:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> speaker2(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> mic(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> triplet(new TFormTriplet(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable(new TFormSimpleSound1(0,formParent));
      machines.push_back(speaker1);
      machines.push_back(mic);
      machines.push_back(speaker2);
      machines.push_back(wallSocket220);
      machines.push_back(soundTable);
      machines.push_back(triplet);
    }
    break;
    case 4:
    {
      boost::shared_ptr<TFormMachine> dimmerpack(new TFormDimblockV3(0,formParent));
      boost::shared_ptr<TFormMachine> lighttable(new TFormSimpleShine1(0,formParent));
      boost::shared_ptr<TFormMachine> wallSocketPower(new TFormWallSocketPower(0,formParent));
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> par64_1(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_2(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_3(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_4(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_5(new TFormPar64(0,formParent));
      machines.push_back(wallSocketPower);
      machines.push_back(dimmerpack);
      machines.push_back(wallSocket220);
      machines.push_back(par64_1);
      machines.push_back(lighttable);
      machines.push_back(par64_2);
      machines.push_back(par64_3);
      machines.push_back(par64_4);
      machines.push_back(par64_5);
    }
    break;
    case 5:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> speaker2(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> mic1(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> mic2(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> triplet(new TFormTriplet(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable(new TFormSimpleSound2(0,formParent));
      machines.push_back(mic1);
      machines.push_back(triplet);
      machines.push_back(mic2);
      machines.push_back(speaker1);
      machines.push_back(soundTable);
      machines.push_back(speaker2);
      machines.push_back(wallSocket220);
    }
    break;
    case 6:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> mic1(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> triplet(new TFormTriplet(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable3(new TFormSimpleSound3(0,formParent));
      machines.push_back(mic1);
      machines.push_back(speaker1);
      machines.push_back(wallSocket220);
      machines.push_back(triplet);
      machines.push_back(soundTable3);
    }
    break;
    case 7:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> mic1(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> mic2(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> mic3(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> speaker2(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> speaker3(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> speaker4(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> octlet(new TFormOctlet(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable3(new TFormSimpleSound3(0,formParent));
      machines.push_back(mic1);
      machines.push_back(mic2);
      machines.push_back(mic3);
      machines.push_back(octlet);
      machines.push_back(speaker1);
      machines.push_back(speaker2);
      machines.push_back(speaker3);
      machines.push_back(speaker4);
      machines.push_back(wallSocket220);
      machines.push_back(soundTable3);
    }
    break;
    case 8:
    {
      //Put a CD on speakers without using a soundtable
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> octlet(new TFormOctlet(0,formParent));
      boost::shared_ptr<TFormCdPlayer> cdPlayer(new TFormCdPlayer(0,formParent));
      boost::shared_ptr<TFormTransitionPieceJackMaleTwoCinchFemale> transitionPiece(
        new TFormTransitionPieceJackMaleTwoCinchFemale(0,formParent));
      machines.push_back(octlet);
      machines.push_back(speaker1);
      machines.push_back(wallSocket220);
      machines.push_back(cdPlayer);
      machines.push_back(transitionPiece);
    }
    break;
    case 9:
    {
      //Put a CD on speakers with using a soundtable
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> octlet(new TFormOctlet(0,formParent));
      boost::shared_ptr<TFormCdPlayer> cdPlayer(new TFormCdPlayer(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable4(new TFormSimpleSound4(0,formParent));
      machines.push_back(octlet);
      machines.push_back(speaker1);
      machines.push_back(cdPlayer);
      machines.push_back(wallSocket220);
      machines.push_back(soundTable4);
    }
    break;
    case 10:
    {
      //Record a CD on MD play
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> octlet(new TFormOctlet(0,formParent));
      //boost::shared_ptr<TFormMachine> soundTable4(new TFormSimpleSound4(0,formParent));
      boost::shared_ptr<TFormMdPlayer> mdPlayer(new TFormMdPlayer(0,formParent));
      boost::shared_ptr<TFormCdPlayer> cdPlayer(new TFormCdPlayer(0,formParent));
      boost::shared_ptr<TFormTransitionPieceJackMaleTwoCinchFemale> transitionPiece(
        new TFormTransitionPieceJackMaleTwoCinchFemale(0,formParent));
      machines.push_back(octlet);
      machines.push_back(speaker1);
      machines.push_back(wallSocket220);
      //machines.push_back(soundTable4);
      machines.push_back(mdPlayer);
      machines.push_back(transitionPiece);
      machines.push_back(cdPlayer);
    }
    break;
    case 11:
    {
      //Record a CD and microphone on MD play
      boost::shared_ptr<TFormMachine> mic1(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> speaker1(new TFormRcf322A(0,formParent));
      boost::shared_ptr<TFormMachine> octlet(new TFormOctlet(0,formParent));
      boost::shared_ptr<TFormMachine> soundTable4(new TFormSimpleSound4(0,formParent));
      boost::shared_ptr<TFormMdPlayer> mdPlayer(new TFormMdPlayer(0,formParent));
      //boost::shared_ptr<TFormCdPlayer> cdPlayer(new TFormCdPlayer(0,formParent));
      boost::shared_ptr<TFormTransitionPieceJackMaleTwoCinchFemale> transitionPiece(
        new TFormTransitionPieceJackMaleTwoCinchFemale(0,formParent));
      machines.push_back(wallSocket220);
      machines.push_back(speaker1);
      machines.push_back(octlet);
      machines.push_back(mic1);
      machines.push_back(soundTable4);
      machines.push_back(transitionPiece);
      //machines.push_back(cdPlayer);
      machines.push_back(mdPlayer);
    }
    break;
    case 12:
    {
      //Level 12: Learn to use the crossfader
      boost::shared_ptr<TFormMachine> dimmerpack(new TFormDimblockV3(0,formParent));
      boost::shared_ptr<TFormMachine> lighttable(new TFormSimpleShine2(0,formParent));
      boost::shared_ptr<TFormMachine> wallSocketPower(new TFormWallSocketPower(0,formParent));
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> par64_1(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_2(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_3(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_4(new TFormPar64(0,formParent));
      boost::shared_ptr<TFormMachine> par64_5(new TFormPar64(0,formParent));
      machines.push_back(wallSocketPower);
      machines.push_back(dimmerpack);
      machines.push_back(wallSocket220);
      machines.push_back(par64_1);
      machines.push_back(lighttable);
      machines.push_back(par64_2);
      machines.push_back(par64_3);
      machines.push_back(par64_4);
      machines.push_back(par64_5);
    }
    break;
    case 13:
    {
      boost::shared_ptr<TFormMachine> wallSocket220(new TFormWallSocket220(0,formParent));
      boost::shared_ptr<TFormMachine> mic(new TFormShureSm58(0,formParent));
      boost::shared_ptr<TFormMachine> speaker(new TFormRcfEvent3000(0,formParent));
      boost::shared_ptr<TFormMachine> amplifier(new TFormEasyAmp(0,formParent));
      machines.push_back(mic);
      machines.push_back(speaker);
      machines.push_back(wallSocket220);
      machines.push_back(amplifier);
    }
    break;
    default: //Do nothing
    break;
  }

  return machines;
}
コード例 #16
0
ファイル: ViewTest.cpp プロジェクト: unapiedra/SoundRoom
//! Give speaker a frequency of 440Hz
void ViewTest::testSpeakerfrequency()
{
	Speaker speaker(QPoint(160, 150), 430.0, 100);
	speaker.setFrequency(440.0);
	QCOMPARE(speaker.getFrequency(), 440.0);
}