Changeset 2452:95bb4e982e72 in roaraudio


Ignore:
Timestamp:
08/21/09 04:59:18 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added code to init a stream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/ssynth.c

    r2450 r2452  
    3131} 
    3232 
     33#define _err() streams_delete(sid); return -1 
    3334int ssynth_init (void) { 
     35 struct roar_stream_server * ss; 
     36 struct roar_stream        *  s; 
     37 int sid; 
     38 
    3439 if ( !ssynth_conf.enable ) 
    3540  return 0; 
    3641 
    37  return -1; 
     42 memset(&g_ssynth, 0, sizeof(g_ssynth)); 
     43 g_ssynth.stream = -1; 
     44 
     45 if ( (sid = streams_new()) == -1 ) 
     46  return -1; 
     47 
     48 if ( streams_set_client(sid, g_self_client) == -1 ) { 
     49  _err(); 
     50 } 
     51 
     52 if ( streams_set_dir(sid, ROAR_DIR_BRIDGE, 1) == -1 ) { 
     53  _err(); 
     54 } 
     55 
     56 if ( streams_set_flag(sid, ROAR_FLAG_PRIMARY) == -1 ) { 
     57  _err(); 
     58 } 
     59 
     60 if ( streams_set_name(sid, "Simple Synthesizer") == -1 ) { 
     61  _err(); 
     62 } 
     63 
     64 if ( streams_get(sid, &ss) == -1 ) { 
     65  _err(); 
     66 } 
     67 
     68 s = ROAR_STREAM(ss); 
     69 
     70 memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info)); 
     71 
     72 s->info.channels = 1; 
     73 s->info.codec    = ROAR_CODEC_DEFAULT; 
     74 
     75 g_ssynth.stream = sid; 
     76 
     77 return 0; 
    3878} 
    3979 
     
    4282  return 0; 
    4383 
    44  return -1; 
     84 return streams_delete(g_ssynth.stream); 
    4585} 
    4686 
Note: See TracChangeset for help on using the changeset viewer.