mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-15 12:20:03 +01:00
fix sample list load (create sample after assigning id)
This commit is contained in:
@@ -1928,6 +1928,8 @@ int sample_get_audio_volume(int s1)
|
|||||||
int sample_set_audio_volume(int s1, int volume)
|
int sample_set_audio_volume(int s1, int volume)
|
||||||
{
|
{
|
||||||
sample_info *sample = sample_get(s1);
|
sample_info *sample = sample_get(s1);
|
||||||
|
if(sample == NULL)
|
||||||
|
return -1;
|
||||||
if (volume < 0)
|
if (volume < 0)
|
||||||
volume = 0;
|
volume = 0;
|
||||||
if (volume > 100)
|
if (volume > 100)
|
||||||
@@ -3011,11 +3013,14 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
int marker_start = 0, marker_end = 0;
|
int marker_start = 0, marker_end = 0;
|
||||||
|
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
|
|
||||||
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLEID)) {
|
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLEID)) {
|
||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
skel->sample_id = ( atoi(chTemp) ) + start_at;
|
skel->sample_id = ( atoi(chTemp) ) + start_at;
|
||||||
|
sample_store(skel);
|
||||||
|
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3051,7 +3056,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
}
|
}
|
||||||
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLEDESCR)) {
|
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLEDESCR) && start_at == 0) {
|
||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
@@ -3065,7 +3070,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_startframe(skel->sample_id, atol(chTemp));
|
skel->first_frame = atol(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3074,7 +3079,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_audio_volume(skel->sample_id, atoi(chTemp));
|
skel->audio_volume = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3084,7 +3089,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_endframe(skel->sample_id, atol(chTemp));
|
skel->first_frame = atol(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3093,7 +3098,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_speed(skel->sample_id, atoi(chTemp));
|
skel->speed = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3103,7 +3108,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if(chTemp)
|
if(chTemp)
|
||||||
{
|
{
|
||||||
sample_set_framedup(skel->sample_id, atoi(chTemp));
|
skel->dup = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3112,7 +3117,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_looptype(skel->sample_id, atoi(chTemp));
|
skel->looptype = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3122,7 +3127,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_subrender(skel->sample_id, atoi(chTemp));
|
skel->subrender = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3132,7 +3137,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_loops(skel->sample_id, atoi(chTemp));
|
skel->max_loops = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3141,7 +3146,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_next(skel->sample_id, atoi(chTemp));
|
skel->next_sample_id = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3150,7 +3155,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_depth(skel->sample_id, atoi(chTemp));
|
skel->depth = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3159,7 +3164,7 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
xmlTemp = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||||
chTemp = UTF8toLAT1(xmlTemp);
|
chTemp = UTF8toLAT1(xmlTemp);
|
||||||
if (chTemp) {
|
if (chTemp) {
|
||||||
sample_set_playmode(skel->sample_id, atoi(chTemp));
|
skel->playmode = atoi(chTemp);
|
||||||
free(chTemp);
|
free(chTemp);
|
||||||
}
|
}
|
||||||
if(xmlTemp) xmlFree(xmlTemp);
|
if(xmlTemp) xmlFree(xmlTemp);
|
||||||
@@ -3258,8 +3263,6 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
ParseCalibration( doc, cur->xmlChildrenNode, skel ,vp);
|
ParseCalibration( doc, cur->xmlChildrenNode, skel ,vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// xmlTemp and chTemp should be freed after use
|
// xmlTemp and chTemp should be freed after use
|
||||||
xmlTemp = NULL;
|
xmlTemp = NULL;
|
||||||
chTemp = NULL;
|
chTemp = NULL;
|
||||||
@@ -3276,14 +3279,10 @@ xmlNodePtr ParseSample(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel,void *e
|
|||||||
marker_end = tmp;
|
marker_end = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
sample_set_marker( skel->sample_id, marker_start, marker_end );
|
skel->marker_start = marker_start;
|
||||||
|
skel->marker_end = marker_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!sample_read_edl( skel ))
|
|
||||||
// veejay_msg(VEEJAY_MSG_ERROR, "No EDL '%s' for sample %d", skel->edit_list_file, skel->sample_id );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return subs;
|
return subs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3387,14 +3386,12 @@ int sample_readFromFile(char *sampleFile, void *vp, void *seq, void *font, void
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int start_at = sample_size()-1;
|
int start_at = sample_size()-1;
|
||||||
if( start_at != 0 )
|
|
||||||
veejay_msg(VEEJAY_MSG_INFO, "Merging %s into current samplelist, auto number starts at %d", sampleFile, start_at );
|
|
||||||
if( vj_tag_size()-1 > 0 )
|
|
||||||
veejay_msg(VEEJAY_MSG_INFO, "Existing streams will be deleted (samplelist overrides active streams)");
|
|
||||||
|
|
||||||
if( start_at <= 0 )
|
if( start_at <= 0 )
|
||||||
start_at = 0;
|
start_at = 0;
|
||||||
|
|
||||||
|
if( start_at != 0 )
|
||||||
|
veejay_msg(VEEJAY_MSG_INFO, "Merging %s into current samplelist, auto number starts at %d", sampleFile, start_at );
|
||||||
|
|
||||||
cur = xmlDocGetRootElement(doc);
|
cur = xmlDocGetRootElement(doc);
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
veejay_msg(VEEJAY_MSG_ERROR,"Empty samplelist. Nothing to do.\n");
|
veejay_msg(VEEJAY_MSG_ERROR,"Empty samplelist. Nothing to do.\n");
|
||||||
@@ -3413,8 +3410,9 @@ int sample_readFromFile(char *sampleFile, void *vp, void *seq, void *font, void
|
|||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLE)) {
|
if (!xmlStrcmp(cur->name, (const xmlChar *) XMLTAG_SAMPLE)) {
|
||||||
skel = sample_skeleton_new(0, 1);
|
skel = sample_skeleton_new(0, 1);
|
||||||
sample_store(skel);
|
if( skel == NULL )
|
||||||
if (skel != NULL) {
|
continue;
|
||||||
|
|
||||||
void *d = vj_font_get_dict(font);
|
void *d = vj_font_get_dict(font);
|
||||||
|
|
||||||
xmlNodePtr subs = ParseSample( doc, cur->xmlChildrenNode, skel, el, font, start_at ,vp );
|
xmlNodePtr subs = ParseSample( doc, cur->xmlChildrenNode, skel, el, font, start_at ,vp );
|
||||||
@@ -3425,9 +3423,8 @@ int sample_readFromFile(char *sampleFile, void *vp, void *seq, void *font, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
vj_font_set_dict(font,d);
|
vj_font_set_dict(font,d);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( !xmlStrcmp( cur->name, (const xmlChar*) "CURRENT" )) {
|
if( !xmlStrcmp( cur->name, (const xmlChar*) "CURRENT" )) {
|
||||||
LoadCurrentPlaying( doc, cur->xmlChildrenNode, id, mode );
|
LoadCurrentPlaying( doc, cur->xmlChildrenNode, id, mode );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user