Changeset 5305:80ba5004e4e7 in roaraudio for roard


Ignore:
Timestamp:
11/28/11 19:02:33 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

some improvements with buffer usage (See: #126)

Location:
roard
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • roard/beep.c

    r4708 r5305  
    2525 
    2626#include "roard.h" 
     27 
     28// TODO: FIXME: can all this VIO stuff be replaced by one call to stream_add_buffer()? 
    2729 
    2830// TODO: FIXME: move them out of here into libroar: 
  • roard/include/midi.h

    r5278 r5305  
    151151 
    152152int midi_new_bufmes    (struct roar_buffer ** buf, struct midi_message ** mes); 
    153 int midi_add_buf       (int id, struct roar_buffer * buf); 
     153int midi_add_buf       (int id, struct roar_buffer ** buf); 
    154154 
    155155// bridges: 
  • roard/midi.c

    r5302 r5305  
    347347     roar_buffer_free(buf); 
    348348    } else { 
    349      midi_add_buf(id, buf); // FIXME: don't we need error handling here? 
     349     midi_add_buf(id, &buf); // FIXME: don't we need error handling here? 
    350350    } 
    351351 
     
    379379   roar_buffer_free(buf); 
    380380  } else { 
    381    midi_add_buf(id, buf); // FIXME: don't we need error handling here? 
     381   midi_add_buf(id, &buf); // FIXME: don't we need error handling here? 
    382382   cachepos = 0; 
    383383  } 
     
    683683} 
    684684 
    685 int midi_add_buf       (int id, struct roar_buffer * buf) { 
     685int midi_add_buf       (int id, struct roar_buffer ** buf) { 
    686686#ifdef DEBUG 
    687687 struct midi_message * mes; 
     
    689689#endif 
    690690 
    691  if ( id == -1 || buf == NULL ) 
     691 if ( id == -1 || buf == NULL || *buf == NULL ) 
    692692  return -1; 
    693693 
    694694#ifdef DEBUG 
    695  if ( roar_buffer_get_data(buf, &bufdata) == -1 ) 
     695 if ( roar_buffer_get_data(*buf, &bufdata) == -1 ) 
    696696  return -1; 
    697697 
     
    706706 
    707707 if ( g_midi_mess.buf == NULL ) { 
    708   g_midi_mess.buf = buf; 
     708  g_midi_mess.buf = *buf; 
    709709 } else { 
    710   if ( roar_buffer_moveinto(g_midi_mess.buf, &buf) == -1 ) { 
     710  if ( roar_buffer_moveinto(g_midi_mess.buf, buf) == -1 ) { 
    711711   ROAR_DBG("midi_add_buf(*) = -1"); 
    712712   return -1; 
     
    819819   mes->type = MIDI_TYPE_CLOCK_TICK; 
    820820 
    821    if ( midi_add_buf(g_midi_clock.stream, buf) == -1 ) { 
     821   if ( midi_add_buf(g_midi_clock.stream, &buf) == -1 ) { 
    822822    ROAR_ERR("midi_clock_tick(void): Can not add Clock-Tick-Message"); 
    823823    roar_buffer_free(buf); 
  • roard/raw.c

    r4708 r5305  
    4545  return -1; 
    4646 
     47 // TODO: do we really need a buffer object here? wouldn't space on stack be ok? 
    4748 if ( roar_buffer_new_data(&buf, RAW_READ_LEN, &data) == -1 ) 
    4849  return -1; 
     
    5657 
    5758 if ( stream_vio_write(s->pos_rel_id, data, len) != len ) { 
    58   // we are that hard here as this is needed to ensure data integrety 
     59  // we are hard here as this is needed to ensure data integrety 
    5960  streams_delete(s->pos_rel_id); 
    6061 } 
Note: See TracChangeset for help on using the changeset viewer.