Cinema::Cinema(AbstractApp* app) : Scene(app, "cinema"){ sceneID = "cinema"; fbo.allocate(WIDTH, HEIGHT, GL_RGB); // remanentFbo.allocate(WIDTH, HEIGHT2, GL_RGB); copyFbo.allocate(WIDTH,HEIGHT, GL_RGB); // circleMask.loadImage("assets/maskCircle1280x720.png"); // circleMask.resize(WIDTH,HEIGHT); stillFbo = new ofFbo(); stillFbo->allocate(WIDTH,HEIGHT, GL_RGB); load(); circleShader.load("../shaders/circle"); alphaShader.load("../shaders/alphaBlack"); alphaWhiteShader.load("../shaders/alphawhite"); alphaScreenShader.load("../shaders/alphascreen"); contourShader.load("../shaders/contour"); for(int i=0;i<4;i++){ players.push_back(new ofVideoPlayer()); loadLaterMoviePosition.push_back(0); setMixer(i,0); } loadMovie(0, 0, 0, true); setMixer(0,1); //need to load for(int i=0;i<players.size();i++) if(players[i]!=0) players[i]->stop(); // vlt.stzartThread(); }
static int setVolumeCommand(long *volumeInternal, char serial_command[200]) { if(*volumeInternal < 0 || *volumeInternal > 100) { syslog(LOG_WARNING, "Value for command \"volume\" is not valid: %ld", *volumeInternal); return EXIT_FAILURE; } if(common_data.discrete_volume || common_data.volume_timeout) { if(common_data.volume_timeout) { smoothVolume.process(volumeInternal); return EXIT_FAILURE; } else { double volumeExternal; common_data.volume->convertInternal2External(volumeInternal, &volumeExternal); common_data.volume_level_status = volumeExternal; compileDescreteVolumeCommand(&volumeExternal, serial_command); } } else { if(common_data.volume_level_status == *volumeInternal) return EXIT_FAILURE; if(*volumeInternal > common_data.volume_level_status) strcpy(serial_command, ascii_data.volumeMutationPositive); else strcpy(serial_command, ascii_data.volumeMutationNegative); if(*volumeInternal < 25 || *volumeInternal > 75) { int status = -1; if((setMixer((common_data.alsa_volume_range/2)+common_data.alsa_volume_min)) == EXIT_FAILURE) return EXIT_FAILURE; syslog(LOG_INFO, "Mixer volume level: %ld", *volumeInternal); *volumeInternal = 50; //common_data.volume_out_timeout = 1; } common_data.volume_level_status = *volumeInternal; } return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { /***** * boolean value indicates when to break main loop * (and thus finish this configuration tool) *****/ int request_finish = 0; int current = 0; /***** menu related variables */ int menu_items = 7; enum state status[] = {invalid, invalid, inactive, inactive, inactive, inactive, invalid}; WINDOW *mainscr; /***** ncurses related variables */ int i, j; /* ***** detect available mixer devices */ mixer_devices = scanMixerDevices(); if (mixer_devices == NULL || mixer_devices->count == 0) { /* ***** no mixer devices available -> exit! */ fprintf(stderr, "No mixer devices available!\n"); fprintf(stderr, "Please purchase a sound card and install it!\n"); exit(-1); } else { if (mixer_devices->count == 1) /***** exactly one mixer device available */ { setMixer(mixer_devices->name[0]); /***** set this mixer */ if (initMixer() == MIXER_OK) /***** if mixer is ok, keep it */ { status[0] = ok; status[2] = invalid; } else /***** otherwise, exit!*/ { fprintf(stderr, "Couldn't init the only available mixer device: /dev/%s\n", mixer_devices->name[0]); exit(-1); } } else /* ***** more than one device available! */ { /* ***** use /dev/mixer as default if it exists */ for (i = 0; i < mixer_devices->count; i++) { if (strcmp(mixer_devices->name[i], "mixer") == 0) { setMixer("mixer"); if (initMixer() == MIXER_OK) { status[0] = ok; status[2] = invalid; } else noMixer(); break; } } } } /* ***** detect available audio devices */ audio_devices = scanAudioDevices(); if (audio_devices == NULL || audio_devices->count == 0) { /* ***** no audio devices available! */ fprintf(stderr, "No audio device available that\n"); fprintf(stderr, "supports 16bit recording!\n"); fprintf(stderr, "Please purchase a sound card and install it!\n"); exit(-1); } else { if (audio_devices->count == 1) /***** exactly one audio device available */ { setAudio(audio_devices->name[0]); /***** set this audio device */ if (initAudio() == AUDIO_OK) /***** if audio device is ok, keep it */ { status[1] = ok; } else /***** otherwise, exit!*/ { fprintf(stderr, "Couldn't init the only available audio device: /dev/%s\n", audio_devices->name[0]); exit(-1); } } else /* ***** more than one device available! */ { /* ***** use /dev/dspW as default if it exists */ for (i = 0; i < audio_devices->count; i++) { if (strcmp(audio_devices->name[i], "dspW") == 0) { setAudio("dspW"); if (initAudio() == AUDIO_OK) status[1] = ok; else noAudio(); break; } } } } /***** * if mixer and audio device have been selected successfully, * set menu cursor to next available menu item *****/ if (status[0] == ok && status[1] == ok) current = 2; /***** ignore Ctrl-C */ signal(SIGINT, SIG_IGN); /* ***** ncurses stuff */ initscr(); /* initialize the curses library */ if (color_term != -1) /***** define dialog color pairs if terminal supports colors */ { start_color (); if ((color_term = has_colors ())) { color_term = 1; init_pair (1, COLOR_WHITE, COLOR_BLUE); init_pair (2, COLOR_YELLOW, COLOR_BLUE); init_pair (3, COLOR_BLUE, COLOR_YELLOW); init_pair (4, COLOR_YELLOW, COLOR_CYAN); } } else color_term = 0; keypad(stdscr, TRUE); /* enable keyboard mapping */ scrollok (stdscr, FALSE); cbreak(); /* take input chars one at a time, no wait for \n */ noecho(); /* don't echo input */ refresh(); mainscr = popupWindow(COLS, LINES); /***** dialog window that contains the main menu */ leaveok (mainscr, FALSE); while (!request_finish) { wattrset (mainscr, color_term ? COLOR_PAIR(2) | A_BOLD : A_NORMAL); /***** set bg color of the dialog */ /***** * draw a box around the dialog window * and empty it. *****/ box(mainscr, 0, 0); for (i = 1; i < COLS-1; i++) for (j = 1; j < LINES-1; j++) mvwaddch(mainscr, j, i, ' '); /***** dialog header */ mvwaddstr(mainscr, 1, 2, "CVoiceControl"); mvwaddstr(mainscr, 1, COLS - strlen("(c) 2000 Daniel Kiecza") - 2, "(c) 2000 Daniel Kiecza"); mvwaddseparator(mainscr, 2, COLS); mvwaddstr(mainscr, 3, (COLS / 2) - (strlen ("Recording Device Configuration Tool") / 2), "Recording Device Configuration Tool"); mvwaddseparator(mainscr, 4, COLS); /***** main menu */ mvwaddstr(mainscr, 5, 2, "Please Select:"); setHighlight(mainscr, status[0], current == 0); mvwaddstr(mainscr, 7,5,"Select Mixer Device"); if (mixerOK() == MIXER_OK) { mvwaddstr(mainscr, 7,24," ("); waddstr(mainscr, getMixer()); waddstr(mainscr, ")"); } else mvwaddstr(mainscr, 7,24," (none selected!)"); setHighlight(mainscr, status[1], current == 1); mvwaddstr(mainscr, 8,5,"Select Audio Device"); if (audioOK() == AUDIO_OK) { mvwaddstr(mainscr, 8,24," ("); waddstr(mainscr, getAudio()); waddstr(mainscr, ")"); } else mvwaddstr(mainscr, 8,24," (none selected!)"); setHighlight(mainscr, status[2], current == 2); mvwaddstr(mainscr, 9,5,"Adjust Mixer Levels"); setHighlight(mainscr, status[3], current == 3); mvwaddstr(mainscr, 10,5,"Calculate Recording Thresholds"); setHighlight(mainscr, status[4], current == 4); mvwaddstr(mainscr, 11,5,"Estimate Characteristics of Recording Channel"); setHighlight(mainscr, status[5], current == 5); mvwaddstr(mainscr, 12,5,"Write Configuration"); setHighlight(mainscr, status[6], current == 6); mvwaddstr(mainscr, 13,5,"Exit"); wmove(mainscr, 5, 17); /***** set cursor to an appropriate location */ wrefresh(mainscr); /***** refresh the dialog */ /* process the command keystroke */ switch(getch()) { case KEY_UP: /***** cursor up */ current = (current == 0 ? menu_items - 1 : current - 1); while(status[current] == inactive) current = (current == 0 ? menu_items - 1 : current - 1); break; case KEY_DOWN: /***** cursor down */ current = (current == menu_items-1 ? 0 : current + 1); while(status[current] == inactive) current = (current == menu_items-1 ? 0 : current + 1); break; case ENTER: /***** handle menu selections */ case BLANK: switch (current) { case 0: /***** select mixer device */ status[0] = invalid; status[2] = inactive; status[3] = inactive; status[4] = inactive; status[5] = inactive; noMixer(); if (selectMixer() == MIXER_OK) { status[0] = ok; status[2] = invalid; } break; case 1: /***** select audio device */ status[1] = invalid; status[3] = inactive; status[4] = inactive; status[5] = inactive; noAudio(); if (selectAudio() == AUDIO_OK) status[1] = ok; break; case 2: /***** adjust mixer levels */ if (adjustMixerLevels()) { status[2] = ok; status[3] = invalid; status[4] = invalid; } break; case 3: /***** calculate recording thresholds */ if (calculateThresholds()) status[3] = ok; else status[3] = invalid; break; case 4: /***** estimate the characteristics of the recording channel */ if (estimateChannelMean()) status[4] = ok; else status[4] = invalid; break; case 5: /***** save configuration! */ if (saveConfiguration()) { status[5] = ok; status[6] = ok; } break; case 6: /***** leave program */ if (status[6] == ok || (status[6] != ok && safeExit())) { wrefresh(mainscr); /***** refresh the dialog */ request_finish = 1; delwin(mainscr); /***** delete ncurses dialog window */ } break; } break; } /***** if the configuration is done, activate the menu item "Save Configuration" */ if (status[0] != ok || status[1] != ok || status[2] != ok || status[3] != ok || status[4] != ok) status[5] = inactive; else if (status[5] != ok) status[5] = invalid; } endwin(); /* we're done */ /***** free memory used by the list of mixer and audio devices */ if (mixer_devices != NULL) { for (i = 0; i < mixer_devices->count; i++) free(mixer_devices->name[i]); free(mixer_devices->name); free(mixer_devices); } if (audio_devices != NULL) { for (i = 0; i < audio_devices->count; i++) free(audio_devices->name[i]); free(audio_devices->name); free(audio_devices); } exit(0); }
int selectMixer() { int top = 0, current = 0; /***** selection menu related variables */ int max_view = 9; int retval = 0; /***** return value */ int request_finish = 0; /***** leave current dialog, if request_finish is set to 1 */ int width = 45, height = 15, i, j; /***** ncurses related variables */ WINDOW *mixerscr = popupWindow (width, height); while (!request_finish) { wattrset (mixerscr, color_term ? COLOR_PAIR(2) | A_BOLD : A_NORMAL); /***** set bg color of the dialog */ /***** * draw a box around the dialog window * and empty it. *****/ werase (mixerscr); box (mixerscr, 0, 0); for (i = 1; i < width-1; i++) for (j = 1; j < height-1; j++) mvwaddch(mixerscr, j, i, ' '); /***** dialog header */ mvwaddstr(mixerscr, 1, 2, "Select Mixer Device:"); mvwaddseparator(mixerscr, 2, width); /***** selection area */ for (i = 0; i < MIN2(mixer_devices->count, max_view); i++) { setHighlight(mixerscr, ok, i == current); mvwaddstr(mixerscr, 4+i, 4, "/dev/"); waddstr(mixerscr, mixer_devices->name[top+i]); } wattroff(mixerscr, A_REVERSE); /***** * show up/down arrow to the left, if more items are available * than can be displayed *****/ if (top > 0) { mvwaddch(mixerscr,4, 2, ACS_UARROW); mvwaddch(mixerscr,4+1, 2, ACS_VLINE); } if (mixer_devices->count > max_view && top+max_view <= mixer_devices->count-1) { mvwaddch(mixerscr,4+max_view-2, 2, ACS_VLINE); mvwaddch(mixerscr,4+max_view-1, 2, ACS_DARROW); } wmove(mixerscr, 1, 23); /***** set cursor to an appropriate location */ wrefresh (mixerscr); /***** refresh the dialog */ /* process the command keystroke */ switch(getch()) { case KEY_UP: /***** cursor up */ if (current > 0) current--; else top = (top > 0 ? top-1 : 0); break; case KEY_DOWN: /***** cursor down */ if (top+current < mixer_devices->count-1) { if (current < max_view-1) current++; else top++; } break; case ESCAPE: /***** press Escape to leave dialog */ retval = MIXER_ERR; request_finish = 1; break; case ENTER: /***** make selection with Enter or Space bar */ case BLANK: setMixer(mixer_devices->name[top+current]); /***** set mixer device to highlighted item */ retval = initMixer(); /***** retval is ok, if initMixer() returned ok */ request_finish = 1; /***** leave dialog */ break; } } delwin(mixerscr); /***** delete ncurses dialog window */ return(retval); }
void OBSAdvAudioCtrl::mixer6Changed(bool checked) { setMixer(source, 5, checked); }