Esempio n. 1
0
void sound_init(struct Main *bmain)
{
	AUD_DeviceSpecs specs;
	int device, buffersize;

	device = U.audiodevice;
	buffersize = U.mixbufsize;
	specs.channels = U.audiochannels;
	specs.format = U.audioformat;
	specs.rate = U.audiorate;

	if (force_device >= 0)
		device = force_device;

	if (buffersize < 128)
		buffersize = AUD_DEFAULT_BUFFER_SIZE;

	if (specs.rate < AUD_RATE_8000)
		specs.rate = AUD_RATE_44100;

	if (specs.format <= AUD_FORMAT_INVALID)
		specs.format = AUD_FORMAT_S16;

	if (specs.channels <= AUD_CHANNELS_INVALID)
		specs.channels = AUD_CHANNELS_STEREO;

	if (!AUD_init(device, specs, buffersize))
		AUD_init(AUD_NULL_DEVICE, specs, buffersize);

	sound_init_main(bmain);
}
Esempio n. 2
0
void BKE_sound_init(Main *bmain)
{
  /* Make sure no instance of the sound system is running, otherwise we get leaks. */
  BKE_sound_exit();

  AUD_DeviceSpecs specs;
  int device, buffersize;
  const char *device_name;

  device = U.audiodevice;
  buffersize = U.mixbufsize;
  specs.channels = U.audiochannels;
  specs.format = U.audioformat;
  specs.rate = U.audiorate;

  if (force_device == NULL) {
    int i;
    char **names = BKE_sound_get_device_names();
    device_name = names[0];

    /* make sure device is within the bounds of the array */
    for (i = 0; names[i]; i++) {
      if (i == device) {
        device_name = names[i];
      }
    }
  }
  else {
    device_name = force_device;
  }

  if (buffersize < 128) {
    buffersize = 1024;
  }

  if (specs.rate < AUD_RATE_8000) {
    specs.rate = AUD_RATE_48000;
  }

  if (specs.format <= AUD_FORMAT_INVALID) {
    specs.format = AUD_FORMAT_S16;
  }

  if (specs.channels <= AUD_CHANNELS_INVALID) {
    specs.channels = AUD_CHANNELS_STEREO;
  }

  if (!(sound_device = AUD_init(device_name, specs, buffersize, "Blender"))) {
    sound_device = AUD_init("Null", specs, buffersize, "Blender");
  }

  BKE_sound_init_main(bmain);
}
Esempio n. 3
0
void BKE_sound_init(struct Main *bmain)
{
	AUD_DeviceSpecs specs;
	int device, buffersize;
	const char *device_name;

	device = U.audiodevice;
	buffersize = U.mixbufsize;
	specs.channels = U.audiochannels;
	specs.format = U.audioformat;
	specs.rate = U.audiorate;

	if (force_device == NULL) {
		int i;
		char **names = BKE_sound_get_device_names();
		device_name = names[0];

		/* make sure device is within the bounds of the array */
		for (i = 0; names[i]; i++) {
			if (i == device) {
				device_name = names[i];
			}
		}
	}
	else
		device_name = force_device;

	if (buffersize < 128)
		buffersize = 1024;

	if (specs.rate < AUD_RATE_8000)
		specs.rate = AUD_RATE_44100;

	if (specs.format <= AUD_FORMAT_INVALID)
		specs.format = AUD_FORMAT_S16;

	if (specs.channels <= AUD_CHANNELS_INVALID)
		specs.channels = AUD_CHANNELS_STEREO;

	if (!(sound_device = AUD_init(device_name, specs, buffersize, "Blender")))
		sound_device = AUD_init("Null", specs, buffersize, "Blender");

	BKE_sound_init_main(bmain);
}
Esempio n. 4
0
File: palm.c Progetto: CPFL/gxen
static void palmte_microwire_setup(struct omap_mpu_state_s *cpu)
{
    struct uwire_slave_s *tsc;
    AudioState *audio = 0;

#ifdef HAS_AUDIO
    audio = AUD_init();
#endif

    tsc = tsc2102_init(omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO],
                    audio);

    omap_uwire_attach(cpu->microwire, tsc, 0);
    omap_mcbsp_i2s_attach(cpu->mcbsp1, tsc210x_codec(tsc));

    tsc210x_set_transform(tsc, &palmte_pointercal);
}
static void android_arm_init(ram_addr_t ram_size, int vga_ram_size,
    const char *boot_device, DisplayState *ds, 
    const char *kernel_filename, 
    const char *kernel_cmdline,
    const char *initrd_filename,
    const char *cpu_model)
{
    CPUState *env;
    qemu_irq *cpu_pic;
    qemu_irq *goldfish_pic;
    int i;
    struct arm_boot_info  info;

    if (!cpu_model)
        cpu_model = "arm926";

    env = cpu_init(cpu_model);

    register_savevm( "cpu", 0, ARM_CPU_SAVE_VERSION, cpu_save, cpu_load, env );

    cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);

    cpu_pic = arm_pic_init_cpu(env);
    goldfish_pic = goldfish_interrupt_init(0xff000000, cpu_pic[ARM_PIC_CPU_IRQ], cpu_pic[ARM_PIC_CPU_FIQ]);
    goldfish_device_init(goldfish_pic, 0xff010000, 0x7f0000, 10, 22);

    goldfish_device_bus_init(0xff001000, 1);

    goldfish_timer_and_rtc_init(0xff003000, 3);

    goldfish_tty_add(serial_hds[0], 0, 0xff002000, 4);
    for(i = 1; i < MAX_SERIAL_PORTS; i++) {
        //printf("android_arm_init serial %d %x\n", i, serial_hds[i]);
        if(serial_hds[i]) {
            goldfish_tty_add(serial_hds[i], i, 0, 0);
        }
    }

    for(i = 0; i < MAX_NICS; i++) {
        if (nd_table[i].vlan) {
            if (nd_table[i].model == NULL
                || strcmp(nd_table[i].model, "smc91c111") == 0) {
                struct goldfish_device *smc_device;
                smc_device = qemu_mallocz(sizeof(*smc_device));
                smc_device->name = "smc91x";
                smc_device->id = i;
                smc_device->size = 0x1000;
                smc_device->irq_count = 1;
                goldfish_add_device_no_io(smc_device);
                smc91c111_init(&nd_table[i], smc_device->base, goldfish_pic[smc_device->irq]);
            } else {
                fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
                exit (1);
            }
        }
    }

    goldfish_fb_init(ds, 0);
#ifdef HAS_AUDIO
    AUD_init();
    goldfish_audio_init(0xff004000, 0, audio_input_source);
#endif
    {
        int  idx = drive_get_index( IF_IDE, 0, 0 );
        if (idx >= 0)
            goldfish_mmc_init(0xff005000, 0, drives_table[idx].bdrv);
    }

    goldfish_memlog_init(0xff006000);

    if (android_hw->hw_battery)
        goldfish_battery_init();

    goldfish_add_device_no_io(&event0_device);
    events_dev_init(event0_device.base, goldfish_pic[event0_device.irq]);

#ifdef CONFIG_NAND
    goldfish_add_device_no_io(&nand_device);
    nand_dev_init(nand_device.base);
#endif
#ifdef CONFIG_TRACE
    extern const char *trace_filename;
    if(trace_filename != NULL) {
        goldfish_add_device_no_io(&trace_device);
        trace_dev_init(trace_device.base);
    }
#endif

#if TEST_SWITCH
    {
        void *sw;
        sw = goldfish_switch_add("test", NULL, NULL, 0);
        goldfish_switch_set_state(sw, 1);
        goldfish_switch_add("test2", switch_test_write, sw, 1);
    }
#endif

    memset(&info, 0, sizeof info);
    info.ram_size        = ram_size;
    info.kernel_filename = kernel_filename;
    info.kernel_cmdline  = kernel_cmdline;
    info.initrd_filename = initrd_filename;
    info.nb_cpus         = 1;
    info.board_id        = 1441;

    arm_load_kernel(env, &info);
}