Show
Ignore:
Timestamp:
01/16/08 13:40:24 (4 years ago)
Author:
ath
Message:

New sync API.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • fm_server/trunk/src/fm_sync.h

    r143 r195  
    2424typedef struct _FmBeatSection FmBeatSection; 
    2525typedef struct _FmBeatInfo FmBeatInfo; 
    26 typedef struct _FmSync FmSync; 
    2726 
    2827 
     
    3837}; 
    3938 
     39/* 
     40struct _FmBufferRequest { 
     41        gboolean        cont; 
     42        guint64         pos; 
     43        guint           req_samples; 
     44}; 
    4045 
    41 struct _FmSync { 
    42         FmElement       *master; 
     46enum FmBufferReturn { 
     47        FM_BUFFER_RETURN_OK, 
     48        FM_BUFFER_RETURN_DISCONT 
    4349 
    44         /* written from fm_element_beacome_sync_master */ 
    45         gdouble         bpm; 
    46         gint            beat_per_bar; 
    47  
    48         /* automatically generated */ 
    49         gdouble         ns_per_sample; 
    50         gdouble         ns_per_beat; 
    51  
    52         /* automatically updated at the beginning of each cycle */ 
    53         gint            bar; 
    54         gint            beat; 
    55         gfloat          beat_offset_ns; 
    56  
    57         /* can be updated with the functions below */ 
    58         gdouble         bpm_new; 
    59         guint           played_samples_new; 
    60 }; 
     50};*/ 
    6151 
    6252 
     
    6454fm_sync_new                             (void); 
    6555 
    66 /* Every output element must call this after get_buffer */ 
     56/* The sync reference has to call this after calling fm_get_buffer() on its peer_sync_master port */ 
    6757void 
    6858fm_sync_update_cycle                    (FmSync         *sync); 
     
    7060/* Callable from get_buffer, takes effect from next cycle */ 
    7161void 
    72 fm_sync_master_played_samples           (FmSync         *sync, 
     62fm_sync_master_played_ns                (FmSync         *sync, 
    7363                                         guint          samples); 
    7464 
     
    7868                                         gdouble        bpm); 
    7969 
     70void 
     71fm_sync_set                             (FmSync         *sync, 
     72                                         guint64        offset, 
     73                                         guint64        timestamp); 
     74 
    8075/* Callable from get_buffer */ 
    8176gdouble 
     
    8378 
    8479gint 
    85 fm_sync_samples_to_next_beat            (FmSync         *sync); 
     80fm_sync_next_beat_is                    (FmSync         *sync); 
    8681 
    87 gint 
    88 fm_sync_next_beat_is                    (FmSync         *sync); 
     82void 
     83fm_sync_show_pos                        (FmSync         *sync);