예제 #1
0
static void correlate() {
  int buffer = 0;
  unsigned channelvisibilities = spu_arguments.ppu_visibilities + first_channel * NR_BASELINES * VISIBILITY_SIZE;
  unsigned int timeIterations = MAJOR_INTEGRATION_TIME / MINOR_INTEGRATION_TIME;

  for (unsigned channel = first_channel; channel < last_channel; channel++) {
      // load first samples
      load_samples(first_channel, 0, buffer);
      
      for (unsigned t = 0; t < timeIterations; t++) {
	// prefetch samples for the next time slot (except for the last iteration)
	if(t < timeIterations - 1) {
	  load_samples(channel, (t+1) * MINOR_INTEGRATION_TIME, !buffer);
	}

	wait_for_dma_samples(buffer);

//	printSamples(samples[buffer]);

	correlateChannel(buffer, channelvisibilities);

	buffer = !buffer;
      }

      channelvisibilities += NR_BASELINES * VISIBILITY_SIZE;
  }
}
예제 #2
0
void samples_device::device_start()
{
	// read audio samples
	load_samples();

	// allocate channels
	m_channel.resize(m_channels);
	for (int channel = 0; channel < m_channels; channel++)
	{
		// initialize channel
		channel_t &chan = m_channel[channel];
		chan.stream = stream_alloc(0, 1, machine().sample_rate());
		chan.source = NULL;
		chan.source_num = -1;
		chan.step = 0;
		chan.loop = 0;
		chan.paused = 0;

		// register with the save state system
		save_item(NAME(chan.source_length), channel);
		save_item(NAME(chan.source_num), channel);
		save_item(NAME(chan.pos), channel);
		save_item(NAME(chan.frac), channel);
		save_item(NAME(chan.step), channel);
		save_item(NAME(chan.loop), channel);
		save_item(NAME(chan.paused), channel);
	}

	// initialize any custom handlers
	if (m_start != NULL)
		(*m_start)(*this);
}
예제 #3
0
파일: samples.cpp 프로젝트: dhinged/mame
void samples_device::device_start()
{
	// read audio samples
	load_samples();

	// allocate channels
	m_channel.resize(m_channels);
	for (int channel = 0; channel < m_channels; channel++)
	{
		// initialize channel
		channel_t &chan = m_channel[channel];
		chan.stream = stream_alloc(0, 1, machine().sample_rate());
		chan.source = nullptr;
		chan.source_num = -1;
		chan.step = 0;
		chan.loop = 0;
		chan.paused = 0;

		// register with the save state system
		save_item(NAME(chan.source_length), channel);
		save_item(NAME(chan.source_num), channel);
		save_item(NAME(chan.pos), channel);
		save_item(NAME(chan.frac), channel);
		save_item(NAME(chan.step), channel);
		save_item(NAME(chan.loop), channel);
		save_item(NAME(chan.paused), channel);
	}

	// initialize any custom handlers
	m_samples_start_cb.bind_relative_to(*owner());

	if (!m_samples_start_cb.isnull())
		m_samples_start_cb();
}
예제 #4
0
파일: irspec.c 프로젝트: kitnic/sdr
int main (int argc, char * const argv[])
{
    // Slurp a truckload of data.
    size_t bytes;
    size_t num_samples = 22;
    unsigned char * buffer = slurp_getopt(
        argc, argv, SLURP_OPTS, NULL, XMIT_IR|1, &num_samples, &bytes);

    float * samples = xmalloc(num_samples * sizeof * samples);
    load_samples(samples, buffer, bytes, num_samples);
    free(buffer);

    spectrum(optind < argc ? argv[optind] : NULL, samples, num_samples, false);
    free(samples);

    return 0;
}
예제 #5
0
파일: setup.c 프로젝트: rj76/kq
/*! \brief Initialize sound system
 * \author JB
 * \date ????????
 * \remark On entry is_sound=1 to initialise,
 *         on exit is_sound=0 (failure) or 2 (success),
 *         is_sound=2 to shutdown,
 *         on exit is_sound=0
 * \remark 20020914 - 05:28 RB : Updated
 *  20020922 - ML : updated to use DUMB
 *  20020922 - ML : Changed to only reserving 8 voices. (32 seemed over-kill?)
 */
void sound_init (void)
{
   if (!sound_avail) {
      is_sound = 0;
      return;
   }
   switch (is_sound) {
   case 1:
      /* set_volume_per_voice (2); */
      init_music ();
      is_sound = load_samples ()? 0 : 2;        /* load the wav files */
      break;
   case 2:
      /* TT: We forgot to add this line, causing phantom music to loop */
      stop_music ();
      free_samples ();
      is_sound = 0;
      break;
   }
}
예제 #6
0
int main()
{
    //shell vars
    bool render = false;

    //allegro vars
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer = NULL;

    //allegro init functions
    printf ("Initializing allegro\n");
    if (!al_init())
    {
        al_show_native_message_box(NULL, NULL, NULL, "failed", NULL, 0);
        return -1;
    }

    printf("Creating display\n");
    display = al_create_display(WIDTH, HEIGHT);
    if (!display)
    {
        al_show_native_message_box(NULL, NULL, NULL, "failed", NULL, 0);
        return -1;
    }

    printf("Installing addons\n");
    al_init_font_addon();
    al_init_ttf_addon();
    al_init_primitives_addon();
    al_init_image_addon();
    al_install_keyboard();
    al_install_mouse();
    al_install_audio();
    al_init_acodec_addon();
    al_reserve_samples(10);

    //project inits
    srand(time(NULL));

    printf("Initializing timer\n");
    event_queue = al_create_event_queue();
    timer = al_create_timer(1.0 / FPS);

    printf("Registering event sources\n");
    al_register_event_source(event_queue, al_get_display_event_source(display));
    al_register_event_source(event_queue, al_get_keyboard_event_source());
    al_register_event_source(event_queue, al_get_timer_event_source(timer));
    al_start_timer(timer);

    printf("Init mouse and keyboard\n");
    init_keyboard();
    init_mouse();

    printf("Loading assets\n");
    load_bitmaps();
    load_fonts();
    load_samples();

    printf ("Creating manager\n");
    push_state(new TitleMenu());
    
    printf("Beginning game\n");
    while (!is_game_over())
    {
        //declare an event
        ALLEGRO_EVENT event;

        //monitor event sources
        al_wait_for_event(event_queue, &event);
        if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
        {
            end_game();
        }
        else if (event.type == ALLEGRO_EVENT_TIMER)
        {
            render = true;

            update_mouse();
            update_keyboard();

            handle_key();
            update_game();
        }

        // Render screen
        if (render && al_event_queue_is_empty(event_queue))
        {
            render = false;
            render_game();
            al_flip_display();
        }
    }

    unload_assets();
    al_destroy_event_queue(event_queue);
    al_destroy_display(display);
    al_destroy_timer(timer);

    return 0;
}