Changeset 109
- Timestamp:
- 09/02/06 23:16:15 (5 years ago)
- Location:
- fm_server/trunk/src
- Files:
-
- 10 modified
-
fm_effect.c (modified) (4 diffs)
-
fm_effect_gain.c (modified) (5 diffs)
-
fm_effect_gain.h (modified) (2 diffs)
-
fm_effect_pan.c (modified) (3 diffs)
-
fm_effect_rate.c (modified) (1 diff)
-
fm_input_gst/fm_input_gst.c (modified) (5 diffs)
-
fm_input_gst/gstfmsink.c (modified) (1 diff)
-
fm_input_test.c (modified) (1 diff)
-
fm_pipeline.c (modified) (4 diffs)
-
main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
fm_server/trunk/src/fm_effect.c
r58 r109 46 46 static void fm_effect_class_init (FmEffectClass *class); 47 47 static void fm_effect_init (FmEffect *effect); 48 static void fm_effect_set_property (GObject *object,49 guint prop_id,50 const GValue *value,51 GParamSpec *pspec);52 static void fm_effect_get_property (GObject *object,53 guint prop_id,54 GValue *value,55 GParamSpec *pspec);56 48 57 49 static FmElementClass *parent_class = NULL; … … 94 86 fm_effect_class_init (FmEffectClass *class) 95 87 { 96 GObjectClass *gobject_class = G_OBJECT_CLASS (class);88 //GObjectClass *gobject_class = G_OBJECT_CLASS (class); 97 89 //FmElementClass *element_class = FM_ELEMENT_CLASS (class); 98 90 //FmEffectClass *effect_class; … … 100 92 parent_class = g_type_class_peek_parent (class); 101 93 102 gobject_class->set_property = fm_effect_set_property;103 gobject_class->get_property = fm_effect_get_property;104 105 94 /*element_class->get_buffer = fm_effect_get_buffer; 106 95 element_class->start = fm_effect_start;*/ 107 108 g_object_class_install_property (gobject_class,109 PROP_FILENAME,110 g_param_spec_string ("filename",111 _("Filename"),112 _("The name of the file to play"),113 NULL,114 G_PARAM_READWRITE));115 116 117 96 } 118 97 … … 136 115 sink_port->peer = NULL; 137 116 element->sink_ports = g_list_append (element->sink_ports, sink_port); 138 }139 140 141 static void142 fm_effect_set_property (GObject *object,143 guint prop_id,144 const GValue *value,145 GParamSpec *pspec)146 {147 // FmEffect *effect = FM_EFFECT (object);148 149 switch (prop_id) {150 case PROP_FILENAME:151 break;152 default:153 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);154 break;155 }156 }157 158 159 static void160 fm_effect_get_property (GObject *object,161 guint prop_id,162 GValue *value,163 GParamSpec *pspec)164 {165 // FmEffect *effect = FM_EFFECT (object);166 167 switch (prop_id) {168 case PROP_FILENAME:169 break;170 default:171 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);172 break;173 }174 117 } 175 118 -
fm_server/trunk/src/fm_effect_gain.c
r95 r109 87 87 { 88 88 rgc_class_register (FM_TYPE_EFFECT_GAIN); 89 90 /* rgc_method_register ("connect_src",91 FM_TYPE_EFFECT_GAIN,92 G_CALLBACK (fm_element_connect_src),93 rgc_marshal_VOID__ELEMENT,94 1, G_TYPE_STRING);*/95 89 } 96 90 … … 116 110 g_object_class_install_property (gobject_class, 117 111 PROP_GAIN, 118 g_param_spec_ float("gain",112 g_param_spec_double ("gain", 119 113 _("Gain"), 120 114 _("Gain to apply to the buffer"), … … 129 123 { 130 124 /* Why the default value isn't set correctly? */ 131 effect_gain->gain = 1 ;125 effect_gain->gain = 1.0; 132 126 133 127 /* do nothing */ … … 210 204 return; 211 205 212 gfloat *ptr = FM_BUFFER_DATA(buffer);213 214 206 gint i, m; 215 207 for (i = 0; i < buffer->n_channels; i++) { … … 221 213 void 222 214 fm_effect_gain_set_gain (FmEffectGain *effect_gain, 223 g floatgain)215 gdouble gain) 224 216 { 225 217 g_return_if_fail ((gain >= 0) && (gain < 10)); -
fm_server/trunk/src/fm_effect_gain.h
r10 r109 37 37 FmEffect effect; 38 38 39 g floatgain;39 gdouble gain; 40 40 41 41 }; … … 66 66 void 67 67 fm_effect_gain_set_gain (FmEffectGain *effect_gain, 68 g floatgain);68 gdouble gain); 69 69 70 70 gfloat -
fm_server/trunk/src/fm_effect_pan.c
r95 r109 202 202 return; 203 203 204 gfloat *ptr = FM_BUFFER_DATA(buffer);205 206 204 gint m; 207 208 205 gdouble left, right; 209 206 … … 221 218 for (m = 0; m < FM_BUFFER_REQUESTED (buffer); m++) 222 219 buffer->channel_data[1][m] *= right; 223 224 225 /* gfloat pan = effect_pan->pan; 226 guint i; 227 gfloat *our_buffer; 228 guint n_samples; 229 230 g_assert (element->src_list); 231 fm_element_get_buffer (FM_ELEMENT (element->src_list->data), buffer); 232 233 our_buffer = (gfloat *) FM_BUFFER_DATA (buffer); 234 n_samples = FM_BUFFER_USED_SAMPLES (buffer) * FM_BUFFER_N_CHANNELS (buffer); 235 236 g_return_if_fail ((pan > -1.0) || (pan < 1.0)); 237 238 if (pan == 0) { 239 return; 240 } else if (pan < 0) { // left 241 for (i = 1; i < n_samples; i = i + 2) 242 if (pan == -1.0) 243 our_buffer[i] = 0; 244 else 245 our_buffer[i] = our_buffer[i] * (1.0 + pan); 246 } else if (pan > 0) { // right 247 for (i = 0; i < n_samples; i = i + 2) 248 our_buffer[i] = our_buffer[i] * (1.0 - pan); 249 } 250 251 return;*/ 252 } 220 } 221 253 222 254 223 void … … 256 225 gdouble pan) 257 226 { 258 //g_print ("Pan changed to %f\n", pan);259 227 effect_pan->pan = pan; 260 228 } 229 261 230 262 231 gint -
fm_server/trunk/src/fm_effect_rate.c
r107 r109 272 272 273 273 for (c = 0; c < FM_CHANNELS_STEREO; c++) { 274 guint test = buffer->requested_samples - buffer_pos;275 276 274 effect_rate->src_data[c]->data_in = effect_rate->temp_buffer->channel_data[c] + effect_rate->temp_pos; 277 275 effect_rate->src_data[c]->data_out = buffer->channel_data[c] + buffer_pos; -
fm_server/trunk/src/fm_input_gst/fm_input_gst.c
r108 r109 15 15 #include "gstfmsink.h" 16 16 #include "fm_input_gst.h" 17 18 //#define USE_AUDIORESAMPLE 17 19 18 20 extern int temp_fd; … … 369 371 370 372 common->converter = gst_element_factory_make ("audioconvert", "converter"); 371 // common->resampler = gst_element_factory_make ("audioresample", "resampler"); 373 #ifdef USE_AUDIORESAMPLE 374 common->resampler = gst_element_factory_make ("audioresample", "resampler"); 375 #endif 372 376 common->output_pad = gst_element_get_pad (common->converter, "sink"); 373 377 common->sink = gst_element_factory_make ("fm_sink", "sink"); 374 378 375 379 gst_bin_add_many (GST_BIN (common->output_bin), common->converter, 376 /*common->resampler,*/ common->sink, NULL); 377 378 gst_element_link_many (common->converter, /*common->resampler,*/ common->sink, NULL); 380 #ifdef USE_AUDIORESAMPLE 381 common->resampler, 382 #endif 383 common->sink, NULL); 384 385 gst_element_link_many (common->converter, 386 #ifdef USE_AUDIORESAMPLE 387 common->resampler, 388 #endif 389 common->sink, NULL); 379 390 380 391 gst_element_add_pad (common->output_bin, gst_ghost_pad_new ("sink", common->output_pad)); … … 450 461 } 451 462 452 if (input_gst->seek_at_sample > -1) { 463 if ((input_gst->seek_at_sample > -1) && chk){ 464 453 465 glong first_avail_sample = input_gst->current_pos_samples - BYTES_TO_SAMPLES(chk->bytes_behind_us); 454 466 glong last_avail_sample = input_gst->current_pos_samples + BYTES_TO_SAMPLES(jack_ringbuffer_read_space(chk->ring)); // we need an offset … … 485 497 // bytes da scartare 486 498 guint bytes_from_ring = chk->bytes_behind_us + SAMPLES_TO_BYTES(FM_BUFFER_REQUESTED(buffer)); 499 if ((chk->eos_offset_samples > 0) && 500 ((input_gst->current_pos_samples + FM_BUFFER_REQUESTED (buffer)) > chk->eos_offset_samples)) 501 bytes_from_ring = SAMPLES_TO_BYTES (chk->eos_offset_samples - input_gst->current_pos_samples); 502 487 503 size_t read_bytes = jack_ringbuffer_peek(chk->ring, (gchar *) input_gst->interleaved_buffer, bytes_from_ring); 488 504 … … 503 519 504 520 if ((chk->eos_offset_samples) && (input_gst->current_pos_samples >= chk->eos_offset_samples)) { 505 g_print ("We're at % d samples - end of file!\n", input_gst->current_pos_samples);521 g_print ("We're at %lld samples - end of file!\n", input_gst->current_pos_samples); 506 522 common->read_chunk = NULL; 507 523 } -
fm_server/trunk/src/fm_input_gst/gstfmsink.c
r108 r109 295 295 FmInputGstCommon *common = sink->common; 296 296 297 gst_element_seek(common->sink, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH & GST_SEEK_FLAG_ACCURATE, 297 gboolean ret; 298 ret = gst_element_seek(common->sink, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH & GST_SEEK_FLAG_ACCURATE, 298 299 GST_SEEK_TYPE_SET, common->seek_nsec, 299 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);300 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); 300 301 301 sink->seek_completed = TRUE; 302 g_print(" trying to seek to %lld ns...\n", common->seek_nsec); 302 if (ret) { 303 sink->seek_completed = TRUE; 304 g_print(" trying to seek to %lld ns...\n", common->seek_nsec); 305 } else { 306 sink->seek_in_progress = FALSE; 307 sink->seek_target = -1; 308 g_print(" seek to %lld ns failed!\n", common->seek_nsec); 309 } 303 310 304 311 return FALSE; -
fm_server/trunk/src/fm_input_test.c
r89 r109 251 251 gfloat y = 0; 252 252 gdouble freq = (gdouble) input_test->frequency / 22050; 253 guint chan;254 253 255 254 while (x < FM_BUFFER_REQUESTED(buffer)) { 256 255 y = sin ((gdouble) (x + input_test->last_value) * freq); 257 /*for(chan = 0; chan < FM_BUFFER_N_CHANNELS(buffer); chan++) 258 *((gfloat *)FM_BUFFER_CHANNEL_DATA(buffer, chan) + x) = y;*/ 259 *((gfloat *)FM_BUFFER_CHANNEL_DATA(buffer, 0) + x) = y; 260 *((gfloat *)FM_BUFFER_CHANNEL_DATA(buffer, 1) + x) = y / 2; 256 *((gfloat *)FM_BUFFER_CHANNEL_DATA(buffer, 0) + x) = y; 257 *((gfloat *)FM_BUFFER_CHANNEL_DATA(buffer, 1) + x) = y / 2; 261 258 x++; 262 259 } 263 260 264 /* old code */265 /*while (x < FM_BUFFER_REQUESTED (buffer) * 2) { // we're in stereo, right?266 y = sin ((gdouble) (x + input_test->last_value) * freq);267 data[x] = (gfloat) y;268 data[x + 1] = (gfloat) y;269 x = x + 2;270 }*/271 272 261 input_test->last_value = input_test->last_value + x; 273 262 274 263 FM_BUFFER_USED_SAMPLES (buffer) = FM_BUFFER_REQUESTED (buffer); 275 /* FM_BUFFER_USED_BYTES (buffer) = fm_buffer_calculate_bytes_size (FM_BUFFER_REQUESTED (buffer), 276 FM_SAMPLES_FLOAT, 277 FM_CHANNELS_STEREO);*/ 278 } 264 } -
fm_server/trunk/src/fm_pipeline.c
r29 r109 44 44 static void fm_pipeline_class_init (FmPipelineClass *class); 45 45 static void fm_pipeline_init (FmPipeline *pipeline); 46 //static void fm_pipeline_destroy (FmPipeline *pipeline);47 static void fm_pipeline_set_property (GObject *object,48 guint prop_id,49 const GValue *value,50 GParamSpec *pspec);51 static void fm_pipeline_get_property (GObject *object,52 guint prop_id,53 GValue *value,54 GParamSpec *pspec);55 46 56 47 //static gpointer parent_class = NULL; … … 119 110 120 111 static void 121 fm_pipeline_class_init (FmPipelineClass *class) 122 { 123 GObjectClass *gobject_class = G_OBJECT_CLASS (class); 124 125 gobject_class = G_OBJECT_CLASS (class); 112 fm_pipeline_class_init (FmPipelineClass *klass) 113 { 114 /*GObjectClass *gobject_class = G_OBJECT_CLASS (klass); 126 115 127 116 gobject_class->set_property = fm_pipeline_set_property; 128 gobject_class->get_property = fm_pipeline_get_property; 129 130 return; 131 } 117 gobject_class->get_property = fm_pipeline_get_property;*/ 118 } 119 132 120 133 121 static void … … 154 142 } 155 143 156 /*static void157 fm_pipeline_destroy (FmPipeline *pipeline)158 {159 g_return_if_fail (pipeline != NULL);160 g_return_if_fail (G_IS_OBJECT (pipeline));161 162 // Free src and sink lists163 164 return;165 }*/166 167 static void168 fm_pipeline_set_property (GObject *object,169 guint prop_id,170 const GValue *value,171 GParamSpec *pspec)172 {173 // FmOutput *output = FM_OUTPUT (object);174 175 switch (prop_id) {176 case PROP_1:177 break;178 default:179 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);180 break;181 }182 }183 184 static void185 fm_pipeline_get_property (GObject *object,186 guint prop_id,187 GValue *value,188 GParamSpec *pspec)189 {190 // FmOutput *output = FM_OUTPUT (object);191 192 switch (prop_id) {193 case PROP_1:194 break;195 default:196 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);197 break;198 }199 }200 144 201 145 FmPipeline * … … 207 151 return (g_object_new (FM_TYPE_PIPELINE, NULL)); 208 152 } 153 209 154 210 155 void -
fm_server/trunk/src/main.c
r106 r109 121 121 signal (65, fakehandler); 122 122 if (!global_debug) 123 g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, null_log_func, NULL);123 g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, (GLogFunc) null_log_func, NULL); 124 124 if (write_to_disk) { 125 125 temp_fd = creat ("/tmp/fmraw.raw", O_CREAT);
