Example #1
0
gc_int32 gauX_data_source_memory_read(void* in_context, void* in_dst, gc_int32 in_size, gc_int32 in_count)
{
  gau_DataSourceMemoryContext* ctx = (gau_DataSourceMemoryContext*)in_context;
  gc_int32 ret = 0;
  gc_int32 dataSize = ga_memory_size(ctx->memory);
  gc_int32 toRead = in_size * in_count;
  gc_int32 remaining;

  gc_mutex_lock(ctx->memMutex);
  remaining = dataSize - ctx->pos;
  toRead = toRead < remaining ? toRead : remaining;
  toRead = toRead - (toRead % in_size);
  if(toRead)
  {
    memcpy(in_dst, (char*)ga_memory_data(ctx->memory) + ctx->pos, toRead);
    ctx->pos += toRead;
    ret = toRead / in_size;
  }
  gc_mutex_unlock(ctx->memMutex);
  return ret;
}
Example #2
0
File: ga.c Project: Botyto/Core
void* ga_sound_data(ga_Sound* in_sound)
{
  return ga_memory_data(in_sound->memory);
}