void cb_synth(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance, synth_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_SYNTH, synth_rec); }
void cb_cd(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance, cd_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_CD, cd_rec); }
void cb_pcm(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance, pcm_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_PCM, pcm_rec); }
void cb_ogain(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance, ogain_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_OGAIN, ogain_rec); }
void cb_bass(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance, bass_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_BASS, bass_rec); }
void cb_speaker(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance, speaker_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_SPEAKER, speaker_rec); }
void cb_imix(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance, imix_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_IMIX, imix_rec); }
void cb_line(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance, line_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_LINE, line_rec); }
void cb_mic(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance, mic_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_MIC, mic_rec); }
void cb_treble(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance, treble_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_TREBLE, treble_rec); }
void cb_volume(Fl_Widget*, long x) { if (x == 1) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance); if (x == 2) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance); if (x == 3) set_mute(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance, volume_mute); if (x == 4) set_rec(mixer_device, SOUND_MIXER_VOLUME, volume_rec); }
void ChannelEditEditThread::set_freqtable(int value) { new_channel.freqtable = value; if(new_channel.entry > chanlists[new_channel.freqtable].count - 1) new_channel.entry = 0; source_text->update(chanlists[new_channel.freqtable].list[new_channel.entry].name); set_device(); }
/* * We just call the parser to get commands from the user. We quit when * parser returns. */ int main (int argc, char **argv) { int write_priv = 0; int c; char *buf; if (!init ()) return (1); while ((c = getopt (argc, argv, "w")) != EOF) { switch (c) { case 'w': write_priv++; break; } } if (optind < argc) { buf = malloc(strlen(argv[optind]) + 32); if (!buf) { fprintf(stderr, "Couldn't allocate filename buffer\n"); exit(1); } strcpy(buf, "set_device "); strcat(buf, argv[optind]); set_device(buf); free(buf); if (write_priv) { wprintw (command_win,"\n"); enable_write("enable_write"); } } parser (); /* Get and parse user commands */ prepare_to_close(); /* Do some cleanup */ printf("Quitting ...\n"); return(0); }
void ChannelEditEditThread::source_down() { new_channel.entry--; if(new_channel.entry < 0) new_channel.entry = chanlists[new_channel.freqtable].count - 1; source_text->update(chanlists[new_channel.freqtable].list[new_channel.entry].name); set_device(); }
bool Trace::begin(IOStream::Device* dev, const char* banner) { set_device(dev); if (banner != NULL) { print_P(banner); println(); } return (true); }
/* set the tape server and device (deprecated version) */ void set_tape( char * tape) { char *uqtape = unquote_string(tape); char *tapedev = strchr(uqtape, ':'); char *host = NULL; g_printf(_("NOTE: 'settape' is deprecated; use setdevice instead.\n")); if (tapedev) { /* This command is deprecated because this parsing is going to fall * behind the list of available device names at some point, or to shadow * an interesting hostname (wouldn't 'tape' be a good name for a * tape server?) */ if (tapedev != uqtape) { if((strchr(tapedev+1, ':') == NULL) && (strncmp_const(uqtape, "null:") == 0 || strncmp_const(uqtape, "rait:") == 0 || strncmp_const(uqtape, "file:") == 0 || strncmp_const(uqtape, "s3:") == 0 || strncmp_const(uqtape, "tape:") == 0)) { tapedev = uqtape; } else { *tapedev = '\0'; host = stralloc(uqtape); ++tapedev; } } else { ++tapedev; } } else tapedev = uqtape; if (tapedev[0]) { if (strcmp(tapedev, "default") == 0) tapedev = NULL; } /* call out to the new version */ set_device(host, tapedev); amfree(host); amfree(uqtape); }
static int motefs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { (void) data; (void) outargs; switch (key) { case FUSE_OPT_KEY_NONOPT: /* serial device (or sf host) is already set, pass the arg on to fuse */ if (device[0]) return 1; set_device(arg); return 0; } /* key unknown */ return 1; }
void ChannelEditEditThread::change_source(const char *source_name) { for(int i = 0; i < chanlists[new_channel.freqtable].count; i++) { if(!strcasecmp(chanlists[new_channel.freqtable].list[i].name, source_name)) { new_channel.entry = i; i = chanlists[new_channel.freqtable].count; set_device(); } } if(!user_title) { strcpy(new_channel.title, source_name); if(edit_window->title_text) { edit_window->title_text->update(source_name); } } }
u8 decode_voicetime_file() { u8 key; u8 cnt =0; u8 flag; get_time_tobuf(); //获取需要报时的文件 _play_voicetime: voicetime_on = 1; dsp_hi_pro(); decodeint_hi_pro(); f_init(win_buffer, (u16)code_otp_read, 1); f_open((u8 *)&fat_file, 0); f_open_dummy_file(0x200); mad_control(0,(u16)buffer); set_eq(0); //必须在每首歌曲播放前初始化EQ music_type = musice_format_check(buffer); set_max_vol(MAX_ANALOG_VOL, MAX_DIGITAL_VOL); my_memset(win_buffer, 0, 512); //解码前,必须清除buffer main_vol_set(0, SET_USE_CURRENT_VOL); flush_low_msg(); play_status = MUSIC_PLAY; decode_cmd = 0; decode_user_exit(0); enable_softint(); enable_decode_isr(); set_device(0); while(1) { key = get_msg(); switch (key) { case DECODE_MSG_DISK_ERR: case DECODE_MSG_FILE_END: otp_music_addr = play_buf[cnt]; cnt++; delay_10ms(20); if(cnt > play_len) { cnt= 0; otp_music_addr =0; stop_decode(); return 0; } else { goto _play_voicetime; } default : #if 0 flag = alm_bell_key(key); if(flag) { otp_music_addr =0; stop_decode(); close_alm_bell(); return flag; } #endif break; } } }
thread(size_t device = 0) { set_device(device); }
int main (int argc, char *argv[]) { int numbytes; static char buf[MAXBUFLEN]; //int c; //int ret = 0; prog = strdup( base_name(argv[0]) ); /* program header */ std::cout << prog << " - a communication radio based on VoIP with IAX/Asterisk" << std::endl; std::cout << "Original (c) 2007-2011 by H. Wirtz <*****@*****.**>" << std::endl; std::cout << "OSX and Windows ports 2012 by Yves Sablonier and Geoff R. McLane, respectively." << std::endl; std::cout << "Version " << FGCOM_VERSION << " build " << SVN_REV << " date " << __DATE__ << ", at " << __TIME__ << std::endl; std::cout << "Using iaxclient library Version " << iaxc_version (tmp) << std::endl; std::cout << std::endl; /* init values */ voipserver = DEFAULT_VOIP_SERVER; fgserver = DEFAULT_FG_SERVER; port = DEFAULT_FG_PORT; username = DEFAULT_USER; password = DEFAULT_PASSWORD; codec_option = DEFAULT_CODEC; mode = 0; /* 0 = ATC mode, 1 = FG mode */ positions_file = (char *) DEFAULT_POSITIONS_FILE; frequency_file = (char *) SPECIAL_FREQUENCIES_FILE; #ifndef _WIN32 /* catch signals */ signal (SIGINT, quit); signal (SIGQUIT, quit); signal (SIGTERM, quit); #endif /* setup iax */ #ifdef HAVE_IAX12 if (iaxc_initialize (DEFAULT_MAX_CALLS)) #else if (iaxc_initialize (DEFAULT_IAX_AUDIO, DEFAULT_MAX_CALLS)) #endif fatal_error ("cannot initialize iaxclient!\nHINT: Have you checked the mic and speakers?"); initialized = 1; // option parser fgcomInitOptions (fgcomOptionArray, argc, argv); // codec if (codec_option) { switch (codec_option) { case 'u': codec = IAXC_FORMAT_ULAW; break; case 'a': codec = IAXC_FORMAT_ALAW; break; case 'g': codec = IAXC_FORMAT_GSM; break; case '7': codec = IAXC_FORMAT_G726; break; case 's': codec = IAXC_FORMAT_SPEEX; break; } } // airport if (airport_option) { strtoupper (airport_option, airport, sizeof (airport)); } // input level if (level_in > 1.0) { level_in = 1.0; } if (level_in < 0.0) { level_in = 0.0; } // output level if (level_out > 1.0) { level_out = 1.0; } if (level_out < 0.0) { level_out = 0.0; } // microphone boost if (mic_boost) { iaxc_mic_boost_set (1); } if (list_audio) { std::cout << "Input audio devices:" << std::endl; std::cout << report_devices (IAXC_AD_INPUT) << std::endl; std::cout << "Output audio devices:" << std::endl; std::cout << report_devices (IAXC_AD_OUTPUT) << std::endl; iaxc_shutdown (); exit (1); } if (audio_in) { set_device (audio_in, 0); } if (audio_out) { set_device (audio_out, 1); } //#ifdef DEBUG /* Print any remaining command line arguments (not options). */ //if (optind < argc) { // printf ("non-option ARGV-elements: "); // while (optind < argc) // printf ("%s ", argv[optind++]); // putchar ('\n'); //} //#endif /* checking consistency of arguments */ if (frequency > 0.0 && frequency < 1000.0) { if (strlen (airport) == 0 || strlen (airport) > 4) { strcpy (airport, "ZZZZ"); } /* airport and frequency are given => ATC mode */ mode = 0; } else { /* no airport => FG mode */ mode = 1; } /* Read special frequencies file (if exists). * If no file $(INSTALL_DIR)/special_frequencies.txt exists, then default frequencies * are used and are hard coded. */ if (fix_input_files()) { /* adjust default input per OS */ fatal_error ("cannot adjust default input files per OS!\nHINT: Maybe recompile with larger buffer."); } if((special_frequencies = read_special_frequencies(frequency_file)) == 0) { std::cout << "Failed to load file [" << frequency_file << "]!\nUsing internal defaults." << std::endl; special_frequencies = special_frq; } else { std::cout << "Loaded file [" << frequency_file << "]." << std::endl; } /* read airport frequencies and positions */ airportlist = read_airports (positions_file); /* never returns if fail! */ /* preconfigure iax */ std::cout << "Initializing IAX client as " << username << ":" << "xxxxxxxxxxx@" << voipserver << std::endl; iaxc_set_callerid (const_cast < char *>(username), const_cast < char *>("0125252525122750")); iaxc_set_formats (codec, IAXC_FORMAT_ULAW | IAXC_FORMAT_GSM | IAXC_FORMAT_SPEEX); iaxc_set_event_callback (iaxc_callback); iaxc_start_processing_thread (); if (username && password && voipserver) { reg_id = iaxc_register (const_cast < char *>(username), const_cast < char *>(password), const_cast < char *>(voipserver)); #ifdef DEBUG std::cout << "DEBUG: Registered as '" << username << "' at '" << voipserver << "'." << std::endl; #endif } else { std::cout << "Failed iaxc_register!\nHINT: Check user name, pwd and ip of server." << std::endl; exitcode = 130; quit (0); } iaxc_millisleep (DEFAULT_MILLISLEEP); /* main loop */ #ifdef DEBUG std::cout << "Entering main loop in mode " << mode_map[mode] << "." << std::endl; #endif if (mode == 1) { /* only in FG mode */ netInit (); netSocket fgsocket; fgsocket.open (false); fgsocket.bind (fgserver, port); /* mute mic, speaker on */ iaxc_input_level_set (0); iaxc_output_level_set (level_out); ulClock clock; clock.update (); double next_update = clock.getAbsTime () + DEFAULT_ALARM_TIMER; /* get data from flightgear */ while (1) { clock.update (); double wait = next_update - clock.getAbsTime (); if (wait > 0.001) { netSocket *readsockets[2] = { &fgsocket, 0 }; if (fgsocket.select (readsockets, readsockets + 1, (int) (wait * 1000)) == 1) { netAddress their_addr; if ((numbytes = fgsocket.recvfrom (buf, MAXBUFLEN - 1, 0, &their_addr)) == -1) { perror ("recvfrom"); exit (1); } buf[numbytes] = '\0'; #ifdef DEBUG std:: cout << "DEBUG: got packet from " << their_addr.getHost () << ":" << their_addr.getPort () << std::endl; std::cout << "packet is " << numbytes << " bytes long" << std::endl; std:: cout << "packet contains \"" << buf << "\"" << std::endl; #endif process_packet (buf); } } else { alarm_handler (0); clock.update (); next_update = clock.getAbsTime () + DEFAULT_ALARM_TIMER; } } } else { /* only in ATC mode */ struct pos p; /* mic on, speaker on */ iaxc_input_level_set (level_in); iaxc_output_level_set (level_out); /* get geo positions of the airport */ p = posbyicao (airportlist, airport); icao2number (airport, frequency, tmp); #ifdef DEBUG printf ("DEBUG: dialing %s %3.3f MHz: %s\n", airport, frequency, tmp); #endif do_iaxc_call (username, password, voipserver, tmp); /* iaxc_select_call (0); */ while (1) { /* sleep endless */ ulSleep (3600); } } /* should never be reached */ exitcode = 999; quit (0); }
void ChannelEditEditThread::set_input(int value) { new_channel.input = value; set_device(); }
void ChannelEditEditThread::set_norm(int value) { new_channel.norm = value; set_device(); }
/* * Enable DASD device */ void dt_device_enable(void) { io_irq_enable(); set_device(IPL_SC, ENABLED); }