Changeset 190
- Timestamp:
- 01/16/08 13:28:21 (4 years ago)
- Location:
- fm_server/trunk/src
- Files:
-
- 2 modified
-
fm_buffer.c (modified) (7 diffs)
-
fm_buffer.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fm_server/trunk/src/fm_buffer.c
r32 r190 1 1 /* 2 2 * FreeMix - sound server 3 * Copyright (C) 2004 Alberto Botti <ath9@libero.it>3 * Copyright (C) 2004-2008 Alberto Botti <alberto.botti@yoda2000.net> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify … … 19 19 * 20 20 * fm_buffer.c - object used to store and pass around audio data 21 *22 21 */ 23 22 … … 35 34 FmBuffer * 36 35 fm_buffer_new (guint n_samples, 37 /* FmSamplesType type,*/38 /* FmSamplesInterleaving interleaving,*/39 36 guint n_channels) 40 37 { … … 49 46 buffer = g_new0 (FmBuffer, 1); 50 47 buffer->data = g_malloc0 (size_bytes); 48 buffer->discont = FALSE; 49 buffer->silence = FALSE; 51 50 52 51 for (i = 0; i < n_channels; i++) … … 59 58 60 59 buffer->requested_samples = 0; 60 61 buffer->timestamp = 0; 62 buffer->duration = 0; 61 63 62 64 return buffer; … … 91 93 92 94 memset (buffer->data, 0, samples_to_bytes(buffer->allocated_samples, buffer->n_channels)); 95 FM_BUFFER_USED_SAMPLES (buffer) = FM_BUFFER_REQUESTED (buffer); 96 buffer->silence = TRUE; 93 97 } 94 98 … … 108 112 buffer->channel_data[l][i] = *(data++); 109 113 } 114 115 116 void 117 fm_buffer_reset_flags (FmBuffer *buffer) 118 { 119 buffer->discont = FALSE; 120 buffer->silence = FALSE; 121 buffer->timestamp = 0; 122 buffer->duration = 0; 123 } -
fm_server/trunk/src/fm_buffer.h
r186 r190 1 1 /* 2 2 * FreeMix - sound server 3 * Copyright (C) 2004 Alberto Botti <ath9@libero.it>3 * Copyright (C) 2004-2008 Alberto Botti <alberto.botti@yoda2000.net> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify … … 19 19 * 20 20 * fm_buffer.h - object used to store and pass around audio data 21 *22 21 */ 23 22 24 23 25 24 typedef struct _FmBuffer FmBuffer; 26 27 //#define MAX_SAMPLES 1024 // ?28 25 29 26 … … 43 40 gfloat *data; 44 41 gfloat * channel_data[FM_CHANNELS_LAST]; 42 gboolean discont; // the buffer is a start of a discontinuous section 43 gboolean silence; // the whole buffer contains silence 45 44 46 45 guint n_channels; … … 48 47 guint allocated_samples; 49 48 guint used_samples; 49 50 50 guint requested_samples; 51 51 52 guint64 timestamp; 52 guint64 timestamp; // real timestamp from start of the song 53 guint64 duration; // real duration of AUDIO (not silence) in the buffer 53 54 }; 54 55 … … 75 76 guint n_samples); 76 77 78 void 79 fm_buffer_reset_flags (FmBuffer *buffer); 80 81 77 82 #define FM_BUFFER_DATA(x) (x)->data 78 83 #define FM_BUFFER_CHANNEL_DATA(x,y) (x)->channel_data[(y)] 84 #define FM_BUFFER_DISCONT(x) (x)->discont 79 85 80 86 #define FM_BUFFER_ALLOCATED_SAMPLES(x) (x)->allocated_samples … … 86 92 87 93 #define FM_BUFFER_TIMESTAMP(x) (x)->timestamp 94 #define FM_BUFFER_DURATION(x) (x)->duration
