DeckLinkOutputAdapter(unsigned int card_index = 0, unsigned int norm_ = 0, RawFrame::PixelFormat pf_ = RawFrame::CbYCrY8422, bool enable_audio = false) : deckLink(NULL), deckLinkOutput(NULL), frame_counter(0), last_frame(NULL), in_pipe(OUT_PIPE_SIZE), audio_in_pipe(NULL) { norm = norm_; assert(norm < sizeof(norms) / sizeof(struct decklink_norm)); time_base = norms[norm].time_base; frame_duration = norms[norm].frame_duration; pf = pf_; bpf = convert_pf(pf_); deckLink = find_card(card_index); configure_card( ); open_card( ); preroll_video_frames(16); if (enable_audio) { setup_audio( ); } start_video( ); thread_priority_hack( ); fprintf(stderr, "DeckLink: initialized using norm %s\n", norms[norm].name); }
int run_emu(const char *path) { SceCtrlData pad; unsigned int joypad1, joypad2; setup_audio(); emu->set_sample_rate(44100); emu->set_equalizer(Nes_Emu::nes_eq); emu->set_palette_range(0); vita2d_texture *tex = vita2d_create_empty_texture(Nes_Emu::image_width, Nes_Emu::image_height); void *tex_data = vita2d_texture_get_datap(tex); static uint32_t video_buffer[Nes_Emu::image_width * Nes_Emu::image_height]; emu->set_pixels(video_buffer, Nes_Emu::image_width); Auto_File_Reader freader(path); emu->load_ines(freader); int scale = 2; int pos_x = SCREEN_W/2 - (Nes_Emu::image_width/2)*scale; int pos_y = SCREEN_H/2 - (Nes_Emu::image_height/2)*scale; while (1) { sceCtrlPeekBufferPositive(0, &pad, 1); if ((pad.buttons & CHANGE_GAME_MASK) == CHANGE_GAME_MASK) break; joypad1 = joypad2 = update_input(&pad); emu->emulate_frame(joypad1, joypad2); const Nes_Emu::frame_t &frame = emu->frame(); const uint8_t *in_pixels = frame.pixels; uint32_t *out_pixels = (uint32_t *)tex_data; for (unsigned h = 0; h < Nes_Emu::image_height; h++, in_pixels += frame.pitch, out_pixels += Nes_Emu::image_width) { for (unsigned w = 0; w < Nes_Emu::image_width; w++) { unsigned col = frame.palette[in_pixels[w]]; const Nes_Emu::rgb_t& rgb = emu->nes_colors[col]; unsigned r = rgb.red; unsigned g = rgb.green; unsigned b = rgb.blue; out_pixels[w] = 0xFF000000 | (r << 0) | (g << 8) | (b << 16); } } vita2d_start_drawing(); vita2d_clear_screen(); vita2d_draw_texture_scale(tex, pos_x, pos_y, scale, scale); show_fps(); vita2d_end_drawing(); vita2d_swap_buffers(); } return 0; }
int btstack_main(int argc, const char * argv[]){ hci_set_sco_voice_setting(0x0060); // PCM, 16 bit, 2's complement, MSB Position 0, setup_audio(); hci_register_sco_packet_handler(&sco_packet_handler); memset((uint8_t *)hsp_service_buffer, 0, sizeof(hsp_service_buffer)); hsp_hs_create_service((uint8_t *)hsp_service_buffer, rfcomm_channel_nr, hsp_hs_service_name, 0); hsp_hs_init(rfcomm_channel_nr); hsp_hs_register_packet_handler(packet_handler); sdp_init(); sdp_register_service_internal(NULL, (uint8_t *)hsp_service_buffer); hci_discoverable_control(1); hci_set_class_of_device(0x200418); btstack_stdin_setup(stdin_process); // turn on! hci_power_control(HCI_POWER_ON); return 0; }
/*** * Main entrypoint of the emulator */ int main() { // first, initialize Vita2D printf("Starting CATSFC-libretro-VITA"); vita2d_init_advanced(8 * 1024 * 1024); // do some setup setup_input(); setup_callbacks(); setup_audio(); pl_psp_init("ux0:/data/CATSFC-libretro-VITA/"); // get the game ready if (InitMenu()) { DisplayMenu(); TrashMenu(); } // once emulation is complete, shut down and exit vita_cleanup(); sceKernelExitProcess(0); return 0; }
static void mainboard_init(device_t dev) { soc_configure_pads(padcfgs, ARRAY_SIZE(padcfgs)); soc_configure_funits(funitcfgs, ARRAY_SIZE(funitcfgs)); i2c_init(I2C1_BUS); setup_audio(); }
static void mainboard_init(device_t dev) { soc_configure_pads(padcfgs, ARRAY_SIZE(padcfgs)); soc_configure_funits(funitcfgs, ARRAY_SIZE(funitcfgs)); setup_ec_spi(); setup_usb(); setup_audio(); i2c_init(I2C1_BUS); /* for max98090 codec */ }
static void mainboard_init(device_t dev) { soc_configure_pads(padcfgs, ARRAY_SIZE(padcfgs)); soc_configure_funits(funits, ARRAY_SIZE(funits)); /* I2C6 bus (audio, etc.) */ soc_configure_i2c6pad(); i2c_init(I2C6_BUS); setup_audio(); /* if panel needs to bringup */ #if IS_ENABLED(CONFIG_CHROMEOS) if (!vboot_skip_display_init()) #endif configure_display_blocks(); powergate_unused_partitions(); }
static void mainboard_init(device_t dev) { soc_configure_funits(funits, ARRAY_SIZE(funits)); /* I2C6 bus (audio, etc.) */ soc_configure_i2c6pad(); i2c_init(I2C6_BUS); setup_audio(); /* Temp hack for P1 board: Enable speaker amp (powerup, etc.) */ enable_ad4567_spkr_amp(); elog_init(); elog_add_boot_reason(); fix_ec_sw_sync(); /* configure panel gpio pads */ soc_configure_pads(lcd_gpio_padcfgs, ARRAY_SIZE(lcd_gpio_padcfgs)); /* if panel needs to bringup */ if (!vboot_skip_display_init()) configure_display_blocks(); }
static int route_call(iapplication_t *ap, bchannel_t *bc) { bchannel_t *newbc = NULL; int ret; if (bc) { display_NR_IE(bc->msn, __FUNCTION__, ": msn"); display_NR_IE(bc->nr, __FUNCTION__, ": nr"); } ap->data1 = bc; if (!bc) return(-EINVAL); read_rec_ctrlfile(); if (bc->usednr->typ == NR_TYPE_INTERN) { ap->mode = AP_MODE_INTERN_CALL; ret = ap->mgr->app_bc(ap->mgr, PR_APP_OCHANNEL, &newbc); if (0 >= ret) dprint(DBGM_TOPLEVEL, -1, "%s: no free channel ret(%d)\n", __FUNCTION__, ret); if (!newbc) { bc->cause_loc = CAUSE_LOC_PNET_LOCUSER; bc->cause_val = CAUSE_USER_BUSY; ap->mgr->app_bc(ap->mgr, PR_APP_HANGUP, bc); return(0); } newbc->app = ap; ap->data2 = newbc; newbc->Flags |= FLG_BC_APPLICATION; newbc->msn[0] = bc->usednr->len +1; newbc->msn[1] = 0x81; memcpy(&newbc->msn[2], bc->usednr->nr, bc->usednr->len); if (bc->msn[0]) memcpy(newbc->nr, bc->msn, bc->msn[0] + 1); newbc->l1_prot = ISDN_PID_L1_B_64TRANS; ap->mgr->app_bc(ap->mgr, PR_APP_OCALL, newbc); } else if (bc->usednr->typ == NR_TYPE_AUDIO) { if (ap->vapp->flags & AP_FLG_AUDIO_USED) { bc->cause_loc = CAUSE_LOC_PNET_LOCUSER; bc->cause_val = CAUSE_USER_BUSY; ap->mgr->app_bc(ap->mgr, PR_APP_HANGUP, bc); return(0); } else ap->vapp->flags |= AP_FLG_AUDIO_USED; ap->mode = AP_MODE_AUDIO_CALL; bc->Flags |= FLG_BC_PROGRESS; ap->mgr->app_bc(ap->mgr, PR_APP_ALERT, bc); ret = setup_audio(ap, bc); if (ret) { ap->vapp->flags &= ~AP_FLG_AUDIO_USED; bc->cause_loc = CAUSE_LOC_PNET_LOCUSER; bc->cause_val = CAUSE_INCOMPATIBLE_DEST; ap->mgr->app_bc(ap->mgr, PR_APP_HANGUP, bc); return(0); } ap->Flags |= AP_FLG_AUDIO_ACTIV; strcpy(bc->display,"connect to AUDIO"); ap->mgr->app_bc(ap->mgr, PR_APP_CONNECT, bc); } else if (bc->usednr->typ == NR_TYPE_VOIP) { ap->mode = AP_MODE_VOIP_OCALL; ret = setup_voip_ocall(ap, bc); } return(0); }
/* * TODO: add some kind of error reporting here */ void play(char *inFileStr) { char *f; long totalframes = 0; long tseconds = 0; struct AUDIO_HEADER header; int bitrate, fs, g, cnt = 0; while ((f = new_next_arg(inFileStr, &inFileStr))) { if (!f || !*f) return; if ((in_file=fopen(f,"r"))==NULL) { if (!do_hook(MODULE_LIST, "AMP ERROR open %s", f)) put_it("Could not open file: %s\n", f); continue; } filesize = file_size(f); initialise_globals(); if ((g=gethdr(&header))!=0) { report_header_error(g); continue; } if (header.protection_bit==0) getcrc(); if (setup_audio(&header)!=0) { yell("Cannot set up audio. Exiting"); continue; } filesize -= sizeof(header); switch (header.layer) { case 1: { if (layer3_frame(&header,cnt)) { yell(" error. blip."); continue; } break; } case 2: { if (layer2_frame(&header,cnt)) { yell(" error. blip."); continue; } break; } default: continue; } bitrate=t_bitrate[header.ID][3-header.layer][header.bitrate_index]; fs=t_sampling_frequency[header.ID][header.sampling_frequency]; if (header.ID) framesize=144000*bitrate/fs; else framesize=72000*bitrate/fs; totalframes = (filesize / (framesize + 1)) - 1; tseconds = (totalframes * 1152/ t_sampling_frequency[header.ID][header.sampling_frequency]); if (A_AUDIO_PLAY) { char *p = strrchr(f, '/'); if (!p) p = f; else p++; if (!do_hook(MODULE_LIST, "AMP PLAY %lu %lu %s", tseconds, filesize, p)) bitchsay("Playing: %s\n", p); } /* * */ if (!(fseek(in_file, 0, SEEK_END))) { char id3_tag[256]; if (!fseek(in_file, -128, SEEK_END) && (fread(id3_tag,128, 1, in_file) == 1)) { if (!strncmp(id3_tag, "TAG", 3)) print_id3_tag(in_file, id3_tag); } fseek(in_file,0,SEEK_SET); } decodeMPEG(&header); do_hook(MODULE_LIST, "AMP CLOSE %s", f); close_audio(); fclose(in_file); } }
void setup_status() { #ifdef INFO char buffer[256]; sprintf(buffer, "Setup Status: draw Memory %s", sbar_status_symbols[DrawMemory].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); sprintf(buffer, "Setup Status: draw Battery %s", sbar_status_symbols[DrawBattery].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); sprintf(buffer, "Setup Status: draw Uptime %s", sbar_status_symbols[DrawUptime].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); sprintf(buffer, "Setup Status: draw Termal %s", sbar_status_symbols[DrawTermal].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); #ifdef NF310_A01 sprintf(buffer, "Setup Status: draw Backlight %s", sbar_status_symbols[DrawBacklight].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); #endif sprintf(buffer, "Setup Status: draw Net %s", sbar_status_symbols[DrawNet].active ? "yes" : "no"); log_str(buffer, LOG_DEBUG); #endif // setup disks setup_disk(); #ifdef INFO log_str("Setup Status Disk", LOG_INFO); #endif // setup uptime if(sbar_status_symbols[DrawUptime].active) { setup_uptime(); #ifdef INFO log_str("Setup Status Uptime", LOG_INFO); #endif } // setup net if(sbar_status_symbols[DrawNet].active) { setup_net(); #ifdef INFO log_str("Setup Status Net", LOG_INFO); #endif } // setup audio if(sbar_status_symbols[DrawAudio].active) { setup_audio(); #ifdef INFO log_str("Setup Status Audio", LOG_INFO); #endif } #ifdef NF310_A01 // setup backlight if(sbar_status_symbols[DrawBacklight].active) { backlight.on = True; #ifdef INFO log_str("Setup Status Backlight", LOG_INFO); #endif } #endif // setup cpu setup_cpu(); #ifdef INFO log_str("Setup Status CPU", LOG_INFO); #endif }