Changeset 4908:1268f8d7b740 in roaraudio


Ignore:
Timestamp:
05/07/11 16:37:01 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

upgraded to VS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarfish/play.c

    r4708 r4908  
    2727 
    2828struct roarfish_play_inst { 
    29  int roarfh; 
    30  int begun; 
     29 roar_vs_t * vss; 
     30 int _roarfh; 
     31 int _begun; 
    3132 FishSoundInfo fsinfo; 
    3233 FishSound * fsound; 
     
    3738 int16_t * data; 
    3839 int i; 
    39  double s; 
     40 float s; 
    4041 
    41  if (!inst->begun) { 
     42 if (inst->vss == NULL) { 
    4243   fish_sound_command (fsound, FISH_SOUND_GET_INFO, &(inst->fsinfo), 
    4344                       sizeof (FishSoundInfo)); 
    44    if ( (inst->roarfh = roar_simple_play(inst->fsinfo.samplerate, inst->fsinfo.channels, 
    45                                          16, ROAR_CODEC_NATIVE, NULL, "roarfish")) == -1 ) { 
     45 
     46   if ( (inst->vss = roar_vs_new_playback(NULL, "roarfish", inst->fsinfo.samplerate, inst->fsinfo.channels, 
     47                                          ROAR_CODEC_DEFAULT, 16, NULL)) == NULL ) { 
    4648    return -1; 
    4749   } 
    48    inst->begun = 1; 
    4950 } 
    5051 
    51  if ( (data = malloc(frames*2*inst->fsinfo.channels)) == NULL ) { 
     52 if ( (data = roar_mm_malloc(frames*2*inst->fsinfo.channels)) == NULL ) { 
    5253  return -1; 
    5354 } 
     
    5758 for (i = 0; i < frames; i++) { 
    5859  s  = ((float*)pcm)[i]; 
    59   s *= 32767; 
     60  s *= 32767.f; 
    6061  data[i] = s; 
    6162 } 
    6263 
    6364 
    64  write(inst->roarfh, (char*)data, frames * 2); 
     65 roar_vs_write(inst->vss, (char*)data, frames * 2, NULL); 
    6566 
    6667 
    67  free(data); 
     68 roar_mm_free(data); 
    6869 
    6970 return 0; 
     
    8384 struct roarfish_play_inst inst; 
    8485 
    85  inst.roarfh = -1; 
    86  inst.begun  = 0; 
     86 inst.vss    = NULL; 
    8787 
    8888 inst.fsound = fish_sound_new(FISH_SOUND_DECODE, &inst.fsinfo); 
     
    105105 fish_sound_delete(inst.fsound); 
    106106 
    107  return -1; 
     107 if ( inst.vss != NULL ) 
     108  roar_vs_close(inst.vss, ROAR_VS_FALSE, NULL); 
     109 
     110 return 0; 
    108111} 
    109112 
Note: See TracChangeset for help on using the changeset viewer.