add recorded samples to samplebank

git-svn-id: svn://code.dyne.org/veejay/trunk@589 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2006-08-14 17:30:35 +00:00
parent b1912ad175
commit a52c9bf974
3 changed files with 31 additions and 3 deletions

View File

@@ -541,11 +541,26 @@ void performer_save_frame( veejay_t *info )
performer_t *p = (performer_t*) info->performer; performer_t *p = (performer_t*) info->performer;
if(sample_is_recording( info->current_sample )) if(sample_is_recording( info->current_sample ))
sample_record_frame( if(sample_record_frame(
info->current_sample, info->current_sample,
p->display, p->display,
NULL, NULL,
0 ); 0 )==2)
{
char *file = sample_get_recorded_file( info->current_sample );
//@ open and add to samplelist
void *sample = sample_new( 0 );
if( sample_open( sample, file ,0, info->video_info ) <= 0 )
{
veejay_msg(0, "Unable to add recorded file '%s' to samplebank", file );
}
else
{
int id = samplebank_add_sample(sample);
veejay_msg(0, "Added '%s' to samplebank as Sample %d", file, id );
}
free(file);
}
} }

View File

@@ -2693,6 +2693,7 @@ int sample_start_recorder( void *sample , sample_video_info_t *ps)
ps->w, ps->h, ps->inter, ps->fps, ps->w, ps->h, ps->inter, ps->fps,
ps->bps, ps->chans, ps->rate ); ps->bps, ps->chans, ps->rate );
if(!rec->fd ) if(!rec->fd )
{ {
veejay_msg(VEEJAY_MSG_ERROR, "Unable to record to '%s'. Please (re)configure recorder", destination ); veejay_msg(VEEJAY_MSG_ERROR, "Unable to record to '%s'. Please (re)configure recorder", destination );
@@ -2704,6 +2705,8 @@ int sample_start_recorder( void *sample , sample_video_info_t *ps)
rec->nf = 0; rec->nf = 0;
rec->rec = 1; rec->rec = 1;
free(destination);
return VEVO_NO_ERROR; return VEVO_NO_ERROR;
} }
@@ -2716,6 +2719,13 @@ int sample_is_recording( void *sample )
return 0; return 0;
} }
char * sample_get_recorded_file( void *sample )
{
sample_runtime_data *srd = (sample_runtime_data*) sample;
char *destination = get_str_vevo( srd->info_port,"filename");
return destination;
}
int sample_stop_recorder( void *sample ) int sample_stop_recorder( void *sample )
{ {
sample_runtime_data *srd = (sample_runtime_data*) sample; sample_runtime_data *srd = (sample_runtime_data*) sample;
@@ -2784,7 +2794,7 @@ int sample_record_frame( void *sample, VJFrame *frame, uint8_t *audio_buffer, in
{ {
veejay_msg(VEEJAY_MSG_INFO, "Done recording"); veejay_msg(VEEJAY_MSG_INFO, "Done recording");
sample_stop_recorder(sample); sample_stop_recorder(sample);
return 1; return 2;
} }
sit->rec = (double) (1.0/rec->tf) * rec->nf; sit->rec = (double) (1.0/rec->tf) * rec->nf;

View File

@@ -131,4 +131,7 @@ int sample_stop_recorder( void *sample );
int sample_record_frame( void *sample, VJFrame *frame, uint8_t *audio_buffer, int a_len ); int sample_record_frame( void *sample, VJFrame *frame, uint8_t *audio_buffer, int a_len );
char * sample_get_recorded_file( void *sample );
#endif #endif