Пример #1
0
int main (void)
{
  fprintf(stdout, "### testing normal logging\n");
  AUBIO_ERR("testing normal AUBIO_LOG_ERR\n");
  AUBIO_WRN("testing normal AUBIO_LOG_WRN\n");
  AUBIO_MSG("testing normal AUBIO_LOG_MSG\n");
  AUBIO_DBG("testing normal AUBIO_LOG_DBG\n");

  fprintf(stdout, "### testing with one custom function\n");
  aubio_log_set_function(logging, (void *)hdr);
  AUBIO_ERR("testing recustom AUBIO_LOG_ERR\n");
  AUBIO_WRN("testing recustom AUBIO_LOG_WRN\n");
  AUBIO_MSG("testing recustom AUBIO_LOG_MSG\n");
  AUBIO_DBG("testing recustom AUBIO_LOG_DBG\n");

  fprintf(stdout, "### testing resetted logging\n");
  aubio_log_reset();
  AUBIO_ERR("testing uncustom AUBIO_LOG_ERR\n");
  AUBIO_WRN("testing uncustom AUBIO_LOG_WRN\n");
  AUBIO_MSG("testing uncustom AUBIO_LOG_MSG\n");
  AUBIO_DBG("testing uncustom AUBIO_LOG_DBG\n");

  fprintf(stdout, "### testing per level customization\n");
  aubio_log_set_level_function(AUBIO_LOG_ERR, logging, (void *)hdr2);
  aubio_log_set_level_function(AUBIO_LOG_WRN, logging, NULL);
  aubio_log_set_level_function(AUBIO_LOG_MSG, logging, (void *)hdr);
  AUBIO_ERR("testing custom AUBIO_LOG_ERR\n");
  AUBIO_WRN("testing custom AUBIO_LOG_WRN with data=NULL\n");
  AUBIO_MSG("testing custom AUBIO_LOG_MSG\n");
  AUBIO_DBG("testing uncustomized AUBIO_LOG_DBG\n");

  return 0;
}
Пример #2
0
OSStatus audio_unit_set_audio_session_category(bool has_input, bool verbose)
{
  //if we have input, set the session category accordingly
  OSStatus err = 0;
  UInt32 category;
  if (has_input) {
    category = kAudioSessionCategory_PlayAndRecord;
    if (verbose) AUBIO_MSG("audio_unit: setting category to PlayAndRecord\n");
  } else {
    category = kAudioSessionCategory_MediaPlayback;
    if (verbose) AUBIO_MSG("audio_unit: setting category to MediaPlayback\n");
  }
  err = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
      sizeof(category), &category);
  if (err) {
    AUBIO_ERR("audio_unit: could not set audio category\n");
  }

  // Audiob.us style
  UInt32 allowMixing = 1;
  AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers,
      sizeof (allowMixing), &allowMixing);
  if (err) {
    AUBIO_ERR("audio_unit: could not set audio session to mix with others\n");
  }

  return err;
}
Пример #3
0
Файл: fvec.c Проект: aubio/aubio
void fvec_print(const fvec_t *s) {
  uint_t j;
  for (j=0; j< s->length; j++) {
    AUBIO_MSG(AUBIO_SMPL_FMT " ", s->data[j]);
  }
  AUBIO_MSG("\n");
}
Пример #4
0
void lvec_print(lvec_t *s) {
  uint_t j;
  for (j=0; j< s->length; j++) {
    AUBIO_MSG(AUBIO_LSMP_FMT " ", s->data[j]);
  }
  AUBIO_MSG("\n");
}
Пример #5
0
void audio_unit_check_audio_route(aubio_audio_unit_t *o) {
  CFStringRef currentRoute;
  UInt32 val, thissize = sizeof(currentRoute);
  OSStatus err = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &thissize, &currentRoute);
  if (err) { AUBIO_ERR("audio_unit: could not get current route\n"); goto fail; }
  else {
    char *route = (char *)CFStringGetCStringPtr ( currentRoute, kCFStringEncodingUTF8);
    if (route == NULL) {
      int bufferSize = 25;
      route = calloc(bufferSize, sizeof(char));
      CFStringGetCString ( currentRoute, route, bufferSize,
          kCFStringEncodingUTF8);
    }
    if (o->verbose) {
      AUBIO_MSG ("audio_unit: current route is %s\n", route);
    }
    //free(route);
  }
  if( currentRoute ) {
    if( CFStringCompare( currentRoute, CFSTR("Headset"), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_None;
    } else if( CFStringCompare( currentRoute, CFSTR("Receiver" ), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_Speaker;
    } else if( CFStringCompare( currentRoute, CFSTR("ReceiverAndMicrophone" ), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_Speaker;
    } else if( CFStringCompare( currentRoute, CFSTR("SpeakerAndMicrophone" ), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_Speaker;
    } else if( CFStringCompare( currentRoute, CFSTR("HeadphonesAndMicrophone" ), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_None;
    } else if( CFStringCompare( currentRoute, CFSTR("HeadsetInOut" ), 0 ) == kCFCompareEqualTo ) {
      val = kAudioSessionOverrideAudioRoute_None;
    } else {
      val = kAudioSessionOverrideAudioRoute_None;
    }

    o->input_enabled = true;
    if (val == kAudioSessionOverrideAudioRoute_Speaker) {
      if (o->prevent_feedback) {
        o->input_enabled = false;
        if (o->verbose) {
          AUBIO_MSG ("audio_unit: disabling input to avoid feedback\n");
        }
      } else {
        AUBIO_WRN ("audio_unit: input not disabled as prevent_feedback set to 0, risking feedback\n");
      }
    }

    err = AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
        sizeof(UInt32), &val);
    if (err) { AUBIO_ERR("audio_unit: could not set session OverrideAudioRoute to Speaker\n"); }

  }

fail:
  if ( currentRoute ) free((void*)currentRoute);
  return;

}
Пример #6
0
void fmat_print(fmat_t *s) {
  uint_t i,j;
  for (i=0; i< s->height; i++) {
    for (j=0; j< s->length; j++) {
      AUBIO_MSG(AUBIO_SMPL_FMT " ", s->data[i][j]);
    }
    AUBIO_MSG("\n");
  }
}
Пример #7
0
aubio_jack_t * new_aubio_jack(uint_t ichan, uint_t ochan, 
    aubio_process_func_t callback) {
  aubio_jack_t * jack_setup = aubio_jack_alloc (ichan, ochan);
  uint_t i;
  char * client_name = "aubio";
  char name[64];
  /* initial jack client setup */
  if ((jack_setup->client = jack_client_new (client_name)) == 0) {
    AUBIO_ERR ("jack server not running?\n");
    AUBIO_QUIT(AUBIO_FAIL);
  }

  /* set callbacks */
  jack_set_process_callback (jack_setup->client, aubio_jack_process, 
      (void*) jack_setup);
  jack_on_shutdown (jack_setup->client, aubio_jack_shutdown, 
      (void*) jack_setup);

  /* register jack output ports */
  for (i = 0; i < ochan; i++) 
  {
    AUBIO_SPRINTF(name, "out_%d", i+1);
    AUBIO_MSG("%s\n", name);
    if ((jack_setup->oports[i] = 
          jack_port_register (jack_setup->client, name, 
            JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0)) == 0) 
    {
      AUBIO_ERR("failed registering output port \"%s\"!\n", name);
      jack_client_close (jack_setup->client);
      AUBIO_QUIT(AUBIO_FAIL);
    }
  }

  /* register jack input ports */
  for (i = 0; i < ichan; i++) 
  {
    AUBIO_SPRINTF(name, "in_%d", i+1);
    AUBIO_MSG("%s\n", name);
    if ((jack_setup->iports[i] = 
          jack_port_register (jack_setup->client, name, 
            JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0)) == 0)
    {
      AUBIO_ERR("failed registering input port \"%s\"!\n", name);
      jack_client_close (jack_setup->client);
      AUBIO_QUIT(AUBIO_FAIL);
    }
  }

  /* set processing callback */
  jack_setup->callback = callback;
  return jack_setup;
}
Пример #8
0
aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) {
  aubio_source_t * s = AUBIO_NEW(aubio_source_t);
  AUBIO_MSG("new aubio source");

#if HAVE_LIBAV
  AUBIO_MSG("libav");
  s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);
  if (s->source) {
    s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do);
    s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_avcodec_do_multi);
    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_avcodec_get_channels);
    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_avcodec_get_samplerate);
    s->s_seek = (aubio_source_seek_t)(aubio_source_avcodec_seek);
    s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);
    return s;
  }
#endif /* HAVE_LIBAV */
#ifdef __APPLE__
  AUBIO_MSG("apple");
  s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size);
  if (s->source) {
    s->s_do = (aubio_source_do_t)(aubio_source_apple_audio_do);
    s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_apple_audio_do_multi);
    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_apple_audio_get_channels);
    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_apple_audio_get_samplerate);
    s->s_seek = (aubio_source_seek_t)(aubio_source_apple_audio_seek);
    s->s_del = (del_aubio_source_t)(del_aubio_source_apple_audio);
    return s;
  }
#endif /* __APPLE__ */
#if HAVE_SNDFILE
  AUBIO_MSG("sndfile");
  s->source = (void *)new_aubio_source_sndfile(uri, samplerate, hop_size);
  if (s->source) {
    s->s_do = (aubio_source_do_t)(aubio_source_sndfile_do);
    s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_sndfile_do_multi);
    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_sndfile_get_channels);
    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_sndfile_get_samplerate);
    s->s_seek = (aubio_source_seek_t)(aubio_source_sndfile_seek);
    s->s_del = (del_aubio_source_t)(del_aubio_source_sndfile);
    return s;
  }
#endif /* HAVE_SNDFILE */
  AUBIO_ERROR("failed creating aubio source with %s\n", uri);
  AUBIO_FREE(s);
  return NULL;
}
Пример #9
0
SInt32
audio_unit_get_route_change_reason(CFDictionaryRef routeChangeDic) {
  CFNumberRef routeChangeReasonRef = (CFNumberRef)CFDictionaryGetValue(routeChangeDic,
      CFSTR(kAudioSession_AudioRouteChangeKey_Reason));
  SInt32 change_reason_number;
  CFNumberGetValue ( routeChangeReasonRef, kCFNumberSInt32Type, &change_reason_number);
  switch (change_reason_number) {
    case kAudioSessionRouteChangeReason_NewDeviceAvailable:
      AUBIO_MSG("audio_unit: route changed to NewDeviceAvailable\n");
      break;
    case kAudioSessionRouteChangeReason_OldDeviceUnavailable:
      AUBIO_MSG("audio_unit: route changed to OldDeviceUnavailable\n");
      break;
    case kAudioSessionRouteChangeReason_CategoryChange:
      AUBIO_MSG("audio_unit: route changed to CategoryChange\n");
      audio_unit_get_audio_session_category();
      break;
    case kAudioSessionRouteChangeReason_Override:
      AUBIO_MSG("audio_unit: route changed to Override\n");
      break;
    case kAudioSessionRouteChangeReason_WakeFromSleep:
      AUBIO_MSG("audio_unit: route changed to WakeFromSleep\n");
      break;
    case kAudioSessionRouteChangeReason_NoSuitableRouteForCategory:
      AUBIO_MSG("audio_unit: route changed to NoSuitableRouteForCategory\n");
      break;
    case kAudioSessionRouteChangeReason_Unknown:
    default:
      AUBIO_ERR("audio_unit: route changed for an unknown reason!?\n");
      break;
  }
  return change_reason_number;
}
Пример #10
0
void cvec_print(const cvec_t *s) {
  uint_t j;
  AUBIO_MSG("norm: ");
  for (j=0; j< s->length; j++) {
    AUBIO_MSG(AUBIO_SMPL_FMT " ", s->norm[j]);
  }
  AUBIO_MSG("\n");
  AUBIO_MSG("phas: ");
  for (j=0; j< s->length; j++) {
    AUBIO_MSG(AUBIO_SMPL_FMT " ", s->phas[j]);
  }
  AUBIO_MSG("\n");
}
Пример #11
0
UInt32 audio_unit_get_audio_session_category () {
  UInt32 category, thissize;
  thissize = sizeof(category);
  OSStatus err = AudioSessionGetProperty(kAudioSessionProperty_AudioCategory,
      &thissize, &category);
  if (err) {
    AUBIO_ERR("audio_unit: could not get audio category (%d)\n", (int)err);
    return err;
  }
  if (category == kAudioSessionCategory_AmbientSound) {
    AUBIO_MSG("audio_unit: session category is AmbiantSound\n");
  } else if (category == kAudioSessionCategory_SoloAmbientSound) {
    AUBIO_MSG("audio_unit: session category is SoloAmbiantSound\n");
  } else if (category == kAudioSessionCategory_MediaPlayback) {
    AUBIO_MSG("audio_unit: session category is MediaPlayback\n");
  } else if (category == kAudioSessionCategory_RecordAudio) {
    AUBIO_MSG("audio_unit: session category is RecordAudio\n");
  } else if (category == kAudioSessionCategory_PlayAndRecord) {
    AUBIO_MSG("audio_unit: session category is PlayAndRecord\n");
  } else if (category == kAudioSessionCategory_AudioProcessing) {
    AUBIO_MSG("audio_unit: session category is AudioProcessing\n");
  }
  return category;
}
Пример #12
0
sint_t aubio_audio_unit_get_info (aubio_audio_unit_t *o)
{
  UInt32 thissize, input_hw_channels, output_hw_channels, max_fps;
  Float32 latency, input_latency, output_latency, input_hw_volume, output_hw_volume;
  Float64 samplerate;
  OSStatus err = 0;

  // Show some info about the opened unit

  /* get sampling rate */
  thissize = sizeof(samplerate);
  err = AudioUnitGetProperty (o->audio_unit, kAudioUnitProperty_SampleRate,
      kAudioUnitScope_Output, 1, &samplerate, &thissize);
  if (err) { AUBIO_ERR("audio_unit: could not get audio unit sample rate (%d)\n",
      (int)err); goto fail; }

  /* get hardware input channels */
  thissize = sizeof(input_hw_channels);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputNumberChannels,
      &thissize, &input_hw_channels);
  if (err) { AUBIO_ERR("audio_unit: could not get hardware input channels (%d)\n",
      (int)err); goto fail; }

  /* get hardware output channels */
  thissize = sizeof(output_hw_channels);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputNumberChannels,
      &thissize, &output_hw_channels);
  if (err) { AUBIO_ERR("audio_unit: could not get hardware output channels (%d)\n",
      (int)err); goto fail; }

  /* get hardware input volume */
  thissize = sizeof(input_hw_volume);
  err = AudioSessionGetProperty(kAudioSessionProperty_InputGainScalar,
      &thissize, &input_hw_volume);
  if (err) { AUBIO_ERR("audio_unit: could not get hardware input volume (%d)\n",
      (int)err); goto fail; }

  /* get hardware output volume */
  thissize = sizeof(output_hw_volume);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume,
      &thissize, &output_hw_volume);
  if (err) { AUBIO_ERR("audio_unit: could not get hardware output volume (%d)\n",
      (int)err); goto fail; }

  AUBIO_MSG("audio_unit: opened at %.0fHz, sw channels %din/%dout, hw channels %din/%dout, hw vol %.2fin/%.2fout\n",
      samplerate,
      o->sw_input_channels, o->sw_output_channels,
      (unsigned int)input_hw_channels, (unsigned int)output_hw_channels,
      input_hw_volume, output_hw_volume);

  /* get max frames per slice */
  thissize = sizeof(max_fps);
  err = AudioUnitGetProperty (o->audio_unit, kAudioUnitProperty_MaximumFramesPerSlice,
      kAudioUnitScope_Global, 0, &max_fps, &thissize);
  if (err) { AUBIO_ERR("audio_unit: could not get maximum frames per slice property %d\n",
      (int)err); goto fail; }

  /* get hardware latency */
  thissize = sizeof(latency);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration,
      &thissize, &latency);
  if (err) { AUBIO_ERR("audio_unit: could not get hardware latency %d\n",
      (int)err); goto fail; }

  /* get input latency */
  thissize = sizeof(input_latency);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputLatency,
      &thissize, &input_latency);
  if (err) { AUBIO_ERR("audio_unit: could not get input latency %d\n",
      (int)err); goto fail; }

  /* get output harlatency */
  thissize = sizeof(output_latency);
  err = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputLatency,
      &thissize, &output_latency);
  if (err) { AUBIO_ERR("audio_unit: could not get output latency %d\n",
      (int)err); goto fail; }

  AUBIO_MSG("audio_unit: I/O latency: %.2fms, %d frames, (%.2fms, %d frames in, %.2fms %d frames out)\n",
      latency*1000., (sint_t)round(latency*samplerate),
      input_latency*1000., (sint_t)ROUND(input_latency*samplerate),
      output_latency*1000., (sint_t)ROUND(output_latency*samplerate));

fail:
  return err;
}
Пример #13
0
/** new_aubio_alsa_seq_driver */
aubio_midi_driver_t*  new_aubio_alsa_seq_driver(//aubio_settings_t* settings, 
        handle_midi_event_func_t handler, void* data)
{
    int i, err;                     
    aubio_alsa_seq_driver_t* dev;   /**< object to return */
    pthread_attr_t attr;            /**< sequencer thread */
    int sched = SCHED_FIFO;         /**< default scheduling policy */
    struct sched_param priority;    /**< scheduling priority settings */
    int count;                      /**< number of MIDI file descriptors */
    struct pollfd *pfd = NULL;      /**< poll file descriptor array (copied in dev->pfd) */
    char* device = NULL;            /**< the device name */
    char* id = NULL;
    char full_id[64];
    char full_name[64];

    /* not much use doing anything */
    if (handler == NULL) {
        AUBIO_ERR( "Invalid argument");
        return NULL;
    }

    /* allocate the device */
    dev = AUBIO_NEW(aubio_alsa_seq_driver_t);
    if (dev == NULL) {
        AUBIO_ERR( "Out of memory");
        return NULL;
    }
    AUBIO_MEMSET(dev, 0, sizeof(aubio_alsa_seq_driver_t));
    dev->seq_port = -1;
    dev->driver.data = data;
    dev->driver.handler = handler;

    /* get the device name. if none is specified, use the default device. */
    //aubio_settings_getstr(settings, "midi.alsa_seq.device", &device);
    if (device == NULL) {
        device = "default";
    }

    /* open the sequencer INPUT only, non-blocking */
    //if ((err = snd_seq_open(&dev->seq_handle, device, SND_SEQ_OPEN_INPUT,
    if ((err = snd_seq_open(&dev->seq_handle, device, SND_SEQ_OPEN_DUPLEX,
                    SND_SEQ_NONBLOCK)) < 0) {
        AUBIO_ERR( "Error opening ALSA sequencer");
        goto error_recovery;
    }

    /* get # of MIDI file descriptors */
    count = snd_seq_poll_descriptors_count(dev->seq_handle, POLLIN);
    if (count > 0) {        /* make sure there are some */
        pfd = AUBIO_MALLOC(sizeof (struct pollfd) * count);
        dev->pfd = AUBIO_MALLOC(sizeof (struct pollfd) * count);
        /* grab file descriptor POLL info structures */
        count = snd_seq_poll_descriptors(dev->seq_handle, pfd, count, POLLIN);
    }

    for (i = 0; i < count; i++) {        /* loop over file descriptors */
        /* copy the input FDs */
        if (pfd[i].events & POLLIN) { /* use only the input FDs */
            dev->pfd[dev->npfd].fd = pfd[i].fd;
            dev->pfd[dev->npfd].events = POLLIN; 
            dev->pfd[dev->npfd].revents = 0; 
            dev->npfd++;
        }
    }
    AUBIO_FREE(pfd);

    //aubio_settings_getstr(settings, "midi.alsa_seq.id", &id);

    if (id != NULL) {
        if (AUBIO_STRCMP(id, "pid") == 0) {
            snprintf(full_id, 64, "aubio (%d)", getpid());
            snprintf(full_name, 64, "aubio_port (%d)", getpid());
        } else {
            snprintf(full_id, 64, "aubio (%s)", id);
            snprintf(full_name, 64, "aubio_port (%s)", id);
        }
    } else {
        snprintf(full_id, 64, "aubio");
        snprintf(full_name, 64, "aubio_port");
    }

    /* set the client name */
    snd_seq_set_client_name (dev->seq_handle, full_id);

    if ((dev->seq_port = snd_seq_create_simple_port (dev->seq_handle,
                    full_name,
                    SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE |
                    SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ | 
                    SND_SEQ_PORT_CAP_DUPLEX,
                    SND_SEQ_PORT_TYPE_APPLICATION)) < 0)
    {
        AUBIO_ERR( "Error creating ALSA sequencer port");
        goto error_recovery;
    }

    dev->status = AUBIO_MIDI_READY;

    /* create the midi thread */
    if (pthread_attr_init(&attr)) {
        AUBIO_ERR( "Couldn't initialize midi thread attributes");
        goto error_recovery;
    }

    /* use fifo scheduling. if it fails, use default scheduling. */
    while (1) {
        err = pthread_attr_setschedpolicy(&attr, sched);
        if (err) {
            AUBIO_MSG( "Couldn't set high priority scheduling for the MIDI input");
            if (sched == SCHED_FIFO) {
                sched = SCHED_OTHER;
                continue;
            } else {
                AUBIO_ERR( "Couldn't set scheduling policy.");
                goto error_recovery;
            }
        }

        /* SCHED_FIFO will not be active without setting the priority */
        priority.sched_priority = (sched == SCHED_FIFO) ? ALSA_SEQ_SCHED_PRIORITY : 0;
        pthread_attr_setschedparam (&attr, &priority);

        err = pthread_create(&dev->thread, &attr, aubio_alsa_seq_run, (void*) dev);
        if (err) {
            AUBIO_ERR( "Couldn't set high priority scheduling for the MIDI input");
            if (sched == SCHED_FIFO) {
                sched = SCHED_OTHER;
                continue;
            } else {
                //AUBIO_LOG(AUBIO_PANIC, "Couldn't create the midi thread.");
                AUBIO_ERR( "Couldn't create the midi thread.");
                goto error_recovery;
            }
        }
        break;
    }
    return (aubio_midi_driver_t*) dev;


error_recovery:
    del_aubio_alsa_seq_driver((aubio_midi_driver_t*) dev);
    return NULL;
}