Exemplo n.º 1
0
int main()
{
  printf("Begin\n");
  struct bufferData data;
  short *array = (short*) malloc(sizeof(short)*160);
  data.data = array;
  data.length = 160;


  initialiseFileWriting();
  FileWriteHandle handle;

  handle = getNewHandle("test.wav");
  
  writeDataChunk(handle,&data);
  writeDataChunk(handle,&data);
  writeDataChunk(handle,&data);

  sleep(1);
  closeFileWriteHandle(handle);

  sleep(1);
  printf("End\n");

  return 0;
}
Exemplo n.º 2
0
uint32_t Timer_newArmed(uint32_t tout, _Bool isPeriodic, onTimerFire_t cb, void *cbData) {
	uint32_t handle = INVALID_HANDLE;
	if (!cb || !tout)
		return INVALID_HANDLE;
	do {
		handle = getNewHandle();
	} while (!isTimerHandleUnique(handle));
	timerNode_p last = s_timersListTail;
	uint32_t primask = __get_PRIMASK();
	__disable_irq();
	if (!last && (last = MEMMAN_malloc(sizeof(timerNode_t)))) {
		last->id = handle;
		last->cnt = last->timeout = tout;
		last->isPeriodic = isPeriodic;
		last->isActive = true;
		last->cb = cb;
		last->cbData = cbData;
		last->next = NULL;
		s_timersListTail = s_timersListHead = last;
	}
	if (!primask) {
		__enable_irq();
	}

	return handle;
}
Exemplo n.º 3
0
int main()
{
    printf("Begin\n");
    struct bufferData data;
    short *array = (short*) malloc(sizeof(short)*160);
    data.data = array;
    data.length = 160;

    int i;
    for(i=0; i<160; i++)
        array[i] = createData();

    initialiseFileWriting();
    FileWriteHandle handle;
    /*
    FILE *stream = fopen("test.wav","w");

    struct WavSink *sink = createWavSink(1,PCM);

    int j;
    for(j=0;j<100;j++)
    {
      for(i=0;i<160;i++)
        array[i] = createData();

      WAV_WriteData(sink,stream,&data);
    }
    closeWavSink(sink,stream);
    */

    handle = getNewHandle("test.wav");

    int j;
    for(j=0; j<200; j++)
    {
        for(i=0; i<160; i++)
        {
            array[i] = createData();
        }

        writeDataChunk(handle,&data);
    }
//  writeDataChunk(handle,&data);
//  writeDataChunk(handle,&data);

    printf("Closing handle.\n");
    closeFileWriteHandle(handle);
    printf("begin sleeps.\n");
    sleep(1);

    sleep(1);
    printf("End\n");



    return EXIT_SUCCESS;
}
Exemplo n.º 4
0
// --------------------------------------------------------------------------
// This function gains access to the ISchellLink interface. It must be
// called before any other calls can be made but after initializeCOM().
//
// I M P O R T A N T !!
// --------------------
//
// releaseInterface() must be called before terminating the application!
// --------------------------------------------------------------------------
JNIEXPORT jint JNICALL Java_com_izforge_izpack_util_os_ShellLink_getInterface (JNIEnv  *env,
                                                                               jobject  obj)
{
  HRESULT hres;
  int     handle;

  // Get a handle
  handle = getNewHandle ();
  if (handle < 0)
  {
    return (SL_OUT_OF_HANDLES);
  }

  // Store the handle on the Java side
  jclass      cls       = (env)->GetObjectClass  (obj);
  jfieldID    handleID  = (env)->GetFieldID      (cls, "nativeHandle", "I");

  (env)->SetIntField (obj, handleID, (jint)handle);

  /*
   * Note: CoCreateInstance() supports only the creation of a single instance.
   * Need to find out how to use CoGetClassObject() to create multiple instances.
   * It should be possible to have multiple instances available, got to make this work!
   */

  // Get a pointer to the IShellLink interface
  hres = CoCreateInstance (CLSID_ShellLink,
                           NULL,
                           CLSCTX_INPROC_SERVER,
                           IID_IShellLink,
                           (void **)&p_shellLink [handle]);

  // Do error handling
  if (SUCCEEDED (hres))
  {
    return (SL_OK);
  }

  return (SL_ERROR);
}