ALAudio::ALAudio(char const* const dev_name) { dev_.reset(alcOpenDevice(dev_name), &alcCloseDevice); BOOST_ASSERT(dev_); ctx_.reset(alcCreateContext(dev_.get(), NULL), &alcDestroyContext); BOOST_ASSERT(ctx_); alcMakeContextCurrent(ctx_.get()); SET_CONTEXT(ctx_); bgm_src_ = create_source(); bgs_src_ = create_source(); me_src_ = create_source(); }
static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_surface_t *source; cairo_pattern_t *pattern; cairo_paint (cr); source = create_source (cairo_get_target (cr), 2560, 1280); pattern = cairo_pattern_create_for_surface (source); cairo_surface_destroy (source); cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE); draw_grid (cr, pattern, 50, 0); draw_grid (cr, pattern, 130, 0); draw_grid (cr, pattern, 210, 0); draw_grid (cr, pattern, 290, 0); draw_grid (cr, pattern, 50, 230); draw_grid (cr, pattern, 130, 230); draw_grid (cr, pattern, 210, 230); draw_grid (cr, pattern, 290, 230); cairo_pattern_destroy (pattern); return CAIRO_TEST_SUCCESS; }
static void initialize_sources(directory_t *dir, unsigned depth) { unsigned i; for (i = 0; i < dir->n_sources; ++i) { dir->sources[i].depth = depth; create_source(&dir->sources[i], i, dir->pathname); } }
void call_execlp() { char *const file = "execlp.c"; char *const compiler = "cc"; expected_out(file); create_source(file); FORK(execlp(compiler, compiler, "-c", file, (char *)0);) }
void call_execl() { char *const file = "execl.c"; char *const compiler = "/usr/bin/cc"; expected_out(file); create_source(file); FORK(execl(compiler, "cc", "-c", file, (char *)0);) }
int main (int argc, char *argv[]) { SourceAppData data; data.port = 7236; GOptionEntry main_entries[] = { { "rtsp_port", 0, 0, G_OPTION_ARG_INT, &(data.port), "Specify optional RTSP port number, 7236 by default", "rtsp_port"}, { NULL } }; GOptionContext* context = g_option_context_new ("- WFD desktop source demo application\n"); g_option_context_add_main_entries (context, main_entries, NULL); g_option_context_add_group (context, gst_init_get_option_group ()); GError* error = NULL; if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print ("option parsing failed: %s\n", error->message); g_option_context_free(context); exit (1); } g_option_context_free(context); GMainLoop *main_loop = g_main_loop_new(NULL, TRUE); g_unix_signal_add(SIGINT, _sig_handler, main_loop); g_unix_signal_add(SIGTERM, _sig_handler, main_loop); GIOChannel* io_channel = g_io_channel_unix_new (STDIN_FILENO); g_io_add_watch(io_channel, G_IO_IN, _user_input_handler, &data); g_io_channel_unref(io_channel); // Create a information element for a simple WFD Source // FIXME: is this correct? maybe we're supposed to actively scan for // WFD sinks instead P2P::InformationElement ie; auto sub_element = P2P::new_subelement(P2P::DEVICE_INFORMATION); auto dev_info = (P2P::DeviceInformationSubelement*)sub_element; dev_info->session_management_control_port = htons(data.port); dev_info->maximum_throughput = htons(50); dev_info->field1.device_type = P2P::SOURCE; dev_info->field1.session_availability = true; ie.add_subelement (sub_element); std::cout << "Registering Wifi Source on port with IE " << ie.to_string() << std::endl; // register the P2P service with connman auto array = ie.serialize (); data.connman.reset(new ConnmanClient (array)); if (create_source(&data)) g_main_loop_run (main_loop); g_main_loop_unref (main_loop); return 0; }
void call_execvP() { char *const file = "execv_p.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); FORK(execvP(compiler, _PATH_DEFPATH, argv);) }
void call_execv() { char *const file = "execv.c"; char *const compiler = "/usr/bin/cc"; char *const argv[] = {"cc", "-c", file, 0}; expected_out(file); create_source(file); FORK(execv(compiler, argv);) }
explicit streaming_source_voice(Load &&loader) : end_flag_(false), loader_(std::forward<Load>(loader)), buffers_(create_buffers(kBufferSize_)), source_(create_source()) { for (int i = 0; i < kBufferSize_; ++i) { read(buffers_[i]); } alSourceQueueBuffers(*source_, kBufferSize_, &buffers_[0]); }
ALAudio::ALAudio(char const *const dev_name) { dev_.reset(alcOpenDevice(dev_name), &alcCloseDevice); BOOST_ASSERT(dev_); ctx_.reset(alcCreateContext(dev_.get(), NULL), &alcDestroyContext); BOOST_ASSERT(ctx_); alcMakeContextCurrent(ctx_.get()); SET_CONTEXT(ctx_); bgm_src_ = create_source(true); bgs_src_ = create_source(true); me_src_ = create_source(false); if (not getenv("DEFAULT_SOUNDFONT")) { Output::Error("Default sound font not found."); } }
void Audio::Init() { device_.reset(alcOpenDevice(NULL), &alcCloseDevice); assert(device_); context_.reset(alcCreateContext(device_.get(), NULL), &alcDestroyContext); assert(context_); alcMakeContextCurrent(context_.get()); bgmSource_ = create_source(); }
void call_execle() { char *const file = "execle.c"; char *const compiler = "/usr/bin/cc"; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(execle(compiler, compiler, "-c", file, (char *)0, envp);) }
void call_execvpe() { char *const file = "execvpe.c"; char *const compiler = "cc"; char *const argv[] = {"/usr/bin/cc", "-c", file, 0}; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(execvpe(compiler, argv, envp);) }
void ALAudio::SE_Play(std::string const &file, int volume, int pitch) { SET_CONTEXT(ctx_); EASYRPG_SHARED_PTR<source> src = create_source(false); alSourcef(src->get(), AL_PITCH, pitch * 0.01f); src->set_volume(volume * 0.01f); src->set_buffer_loader(getSound(*src, file)); se_src_.push_back(src); }
void Audio::SE_Play(std::string const& file, int volume, int pitch) { eraseStopped(seSource_); boost::shared_ptr<ALuint> src = create_source(); alSourcei(*src, AL_BUFFER, getSound(file)); alSourcef(*src, AL_GAIN, volume * 0.01f); alSourcei(*src, AL_PITCH, pitch * 0.01f); alSourcei(*src, AL_LOOPING, AL_FALSE); alSourcePlay(*src); seSource_.push_back(src); }
int server_handle_ondemand(server_t * s, int * fd, const char * method, const char * path_orig, const gavl_metadata_t * req) { int i; client_t * source = NULL; client_t * sink; int64_t id; gavl_metadata_t res; if(strcmp(method, "GET") || strncmp(path_orig, "/ondemand/", 10)) return 0; gavl_metadata_init(&res); path_orig += 10; id = strtoll(path_orig, NULL, 10); for(i = 0; i < s->num_clients; i++) { if((s->clients[i]->type == CLIENT_TYPE_SOURCE_ONDEMAND) && s->clients[i]->id == id) { source = s->clients[i]; break; } } if(!source) { /* Create ondemand source */ source = create_source(s, id, &res); if(!source) goto fail; source->id = id; server_attach_client(s, source); } sink = sink_create_from_source(s, fd, source, req); server_attach_client(s, sink); fail: return 1; }
/* * radclock process specific init of the clock_handle */ static int init_handle(struct radclock_handle *handle) { /* Input source */ struct stampsource *stamp_source; int err; JDEBUG /* Clock has been init', set the pointer to the clock */ set_verbose(handle, handle->conf->verbose_level, 1); set_logger(logger_verbose_bridge); if (handle->run_mode == RADCLOCK_SYNC_LIVE) { /* Initial status words */ // TODO there should be more of them set in here, some are for live and // dead runs, but not all! ADD_STATUS(handle, STARAD_STARVING); /* * Initialise IPC shared memory segment */ if (handle->conf->server_ipc == BOOL_ON) { err = shm_init_writer(handle->clock); if (err) return (1); verbose(LOG_NOTICE, "IPC Shared Memory ready"); } } /* Open input file from which to read TS data */ if (!VM_SLAVE(handle)) { stamp_source = create_source(handle); if (!stamp_source) { verbose(LOG_ERR, "Error creating stamp source, exiting"); exit(EXIT_FAILURE); } /* Hang stamp source on the handler */ handle->stamp_source = (void *) stamp_source; } /* Open output files */ open_output_stamp(handle); open_output_matlab(handle); return (0); }
void call_posix_spawnp() { char *const file = "posix_spawnp.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); pid_t child; if (0 != posix_spawnp(&child, "cc", 0, 0, argv, get_environ())) { perror("posix_spawnp"); exit(EXIT_FAILURE); } wait_for(child); }
static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_surface_t *source; cairo_set_source_rgb (cr, 1, 1, 1); cairo_paint (cr); source = create_source (cairo_get_target (cr), width, height); cairo_set_source_surface (cr, source, 0, 0); cairo_surface_destroy (source); cairo_paint (cr); return CAIRO_TEST_SUCCESS; }
explicit openal_voice(const Device &device, Loader &&loader, bool loop) : buffer_(create_buffer()), source_(create_source()) { const auto format_data = loader.format(); ALenum format; if (format_data.channels == 1) { format = format_data.bits_per_sample == 8 ? AL_FORMAT_MONO8 : AL_FORMAT_MONO16; } else { format = format_data.bits_per_sample == 8 ? AL_FORMAT_STEREO8 : AL_FORMAT_STEREO16; } alBufferData(*buffer_, format, &(*loader.buffer()), loader.size(), format_data.samples_per_sec); alSourcei(*source_, AL_BUFFER, *buffer_); alSourcei(*source_, AL_LOOPING, loop ? AL_TRUE : AL_FALSE); }
static DBusMessage *new_connection(DBusConnection *conn, DBusMessage *msg, void *user_data) { const char *path, *device; int fd; g_print("New connection\n"); path = dbus_message_get_path(msg); dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &device, DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID); g_print(" from %s\n", path); g_print(" for device %s with fd %d\n", device, fd); if (iap_source == 0) iap_source = create_source(fd, iap_handler); else close(fd); return dbus_message_new_method_return(msg); }
void test_texture_fbo (TestConformSimpleFixture *fixture, gconstpointer data) { TestState state; guint idle_source; gulong paint_handler; ClutterActor *actor; int ypos = 0; state.frame = 0; state.stage = clutter_stage_get_default (); clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color); /* Onscreen source with clone next to it */ actor = create_source (); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE); actor = clutter_texture_new_from_actor (actor); clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); ypos++; /* Offscreen source with clone */ #if 0 /* this doesn't work */ actor = create_source (); actor = clutter_texture_new_from_actor (actor); clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); #endif ypos++; /* Source clipped to the top left division */ actor = create_source (); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE); clutter_actor_set_clip (actor, 0, 0, DIVISION_WIDTH, DIVISION_HEIGHT); actor = clutter_texture_new_from_actor (actor); clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); ypos++; /* Source clipped to everything but top left division using a path */ actor = create_source (); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE); g_signal_connect (actor, "paint", G_CALLBACK (pre_paint_clip_cb), NULL); g_signal_connect_after (actor, "paint", G_CALLBACK (post_paint_clip_cb), NULL); actor = clutter_texture_new_from_actor (actor); clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE); clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL); ypos++; /* We force continuous redrawing of the stage, since we need to skip * the first few frames, and we wont be doing anything else that * will trigger redrawing. */ idle_source = g_idle_add (queue_redraw, state.stage); paint_handler = g_signal_connect_after (state.stage, "paint", G_CALLBACK (on_paint), &state); clutter_actor_show_all (state.stage); clutter_main (); g_signal_handler_disconnect (state.stage, paint_handler); g_source_remove (idle_source); /* Remove all of the actors from the stage */ clutter_container_foreach (CLUTTER_CONTAINER (state.stage), (ClutterCallback) clutter_actor_destroy, NULL); if (g_test_verbose ()) g_print ("OK\n"); }