|
From: Martin R. <ru...@us...> - 2005-01-26 23:20:01
|
Update of /cvsroot/foo/foo/elkfoo/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20459/src Modified Files: snd.m soundfile.m Log Message: pedrezuela edition: finally removed comment support. will always cause problems. better implement a sndfile-medadata-base in scheme. Index: soundfile.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/soundfile.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** soundfile.m 30 Aug 2004 15:58:59 -0000 1.6 --- soundfile.m 26 Jan 2005 23:19:51 -0000 1.7 *************** *** 50,54 **** ! enum { SND_LENGTH, SND_FORMAT, SND_CHANNELS, SND_SRATE, SND_FILETYPE, SND_COMMENT, SND_COMMENT_SIZE, SND_SET_COMMENT }; --- 50,54 ---- ! enum { SND_LENGTH, SND_FORMAT, SND_CHANNELS, SND_SRATE, SND_FILETYPE }; *************** *** 60,64 **** SNDFILE *sfd; SchemeObject name = General_File_Operation(argv[0], 0); - char *comment = NULL; char buffer[PATH_MAX + 1], *n; int filetype, sampleformat; --- 60,63 ---- *************** *** 66,70 **** int dmode = 0755; /* fd, l, m; */ struct stat st; - // double sr = [GlobalsManager getDefaultSamplingRate]; s.format = 0; --- 65,68 ---- *************** *** 185,194 **** } - /* comment string */ - if (argc > 5) - { - comment = Get_String(argv[5]); - } - /* creating a soundfile with header using libsndfile: * simply open a file for write with an appropriate SF_INFO struct --- 183,186 ---- *************** *** 199,211 **** } - /* write comment */ - if (comment) - { - if (sf_set_string(sfd, SF_STR_COMMENT, comment)) - { - [FOOGlobalsManager schemeOutput: @"WARNING: writing the comment failed. maybe not supported by filetype\n"]; - } - } - if (sf_close(sfd)) { --- 191,194 ---- *************** *** 342,370 **** } break; - case SND_SET_COMMENT: - { - NSString *comment = [NSString stringWithCString: Get_String(params[0])]; - ret = Make_String([[snd getFileComment] cString], - [[snd getFileComment] length]); - - if ([snd reopenWithMode: SND_WRITE] == NO) - { - RELEASE(snd); - Primitive_Error("reopening sndfile for writing comment failed."); - } - if ([snd setFileCommentFromString: comment]) - { - RELEASE(snd); - Primitive_Error("setting the comment failed. maybe not supported by file format."); - } - } - break; - case SND_COMMENT: - ret = Make_String([[snd getFileComment] cString], - [[snd getFileComment] length]); - break; - case SND_COMMENT_SIZE: - ret = Make_Integer([[snd getFileComment] length]); - break; default: RELEASE(snd); --- 325,328 ---- *************** *** 388,401 **** SND_FUNC(P_Soundfile_Length, SND_LENGTH) SND_FUNC(P_Soundfile_Channels, SND_CHANNELS) - SND_FUNC(P_Soundfile_Comment, SND_COMMENT) - SND_FUNC(P_Soundfile_Comment_Size, SND_COMMENT_SIZE) - - - static SchemeObject - P_Set_Soundfile_Comment (SchemeObject soundfile, - SchemeObject comment) - { - return General_Soundfile_Operation(soundfile, SND_SET_COMMENT, &comment); - } --- 346,349 ---- *************** *** 524,530 **** DP(P_Soundfile_Channels, "foo:soundfile-channels", 1, 1, EVAL); DP(P_Soundfile_Filetype, "foo:soundfile-filetype", 1, 1, EVAL); - DP(P_Set_Soundfile_Comment, "foo:set-soundfile-comment!", 2, 2, EVAL); - DP(P_Soundfile_Comment, "foo:soundfile-comment", 1, 1, EVAL); - DP(P_Soundfile_Comment_Size,"foo:soundfile-comment-size", 1, 1, EVAL); DP(P_Soundfile_Play, "foo:soundfile-play", 1, 5, VARARGS); --- 472,475 ---- Index: snd.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/snd.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** snd.m 30 Aug 2004 15:58:59 -0000 1.4 --- snd.m 26 Jan 2005 23:19:51 -0000 1.5 *************** *** 115,119 **** SND_T(snd)->filetype = Null; SND_T(snd)->format = Null; - SND_T(snd)->comment = Null; SND_T(snd)->type = Null; GC_Link(snd); --- 115,118 ---- *************** *** 139,143 **** int incr; NSString *filename; - NSString *comment; GC_Node2; --- 138,141 ---- *************** *** 183,188 **** SND_T(s)->name = Make_String(STRING(n)->data, STRING(n)->size); - comment = [IdOf(s) getFileComment]; - SND_T(s)->comment = Make_String([comment cString], [comment length]); GC_Unlink; --- 181,184 ---- *************** *** 351,365 **** static SchemeObject - P_Snd_Comment (SchemeObject snd) - { - SchemeObject comment; - - Check_Type(snd, T_Snd); - comment = SND_T(snd)->comment; - return Make_String (STRING(comment)->data, STRING(comment)->size); - } - - - static SchemeObject P_Snd_Reversedp (SchemeObject snd) { --- 347,350 ---- *************** *** 474,478 **** [IdOf(region) initWithSubstrate:p offset:o size:l rev:NO]; SND_T(region)->name = SND_T(snd)->name; - SND_T(region)->comment = SND_T(snd)->comment; SND_T(region)->filetype = SND_T(snd)->filetype; SND_T(region)->format = SND_T(snd)->format; --- 459,462 ---- *************** *** 505,509 **** [IdOf(region) initWithSubstrate:p offset:0. size:l rev:YES]; SND_T(region)->name = SND_T(snd)->name; - SND_T(region)->comment = SND_T(snd)->comment; SND_T(region)->filetype = SND_T(snd)->filetype; SND_T(region)->format = SND_T(snd)->format; --- 489,492 ---- *************** *** 543,547 **** [IdOf(region) initWithSubstrate:p channel:c]; SND_T(region)->name = SND_T(snd)->name; - SND_T(region)->comment = SND_T(snd)->comment; SND_T(region)->filetype = SND_T(snd)->filetype; SND_T(region)->format = SND_T(snd)->format; --- 526,529 ---- *************** *** 668,672 **** (*f)(&(SND_T(*x)->type)); (*f)(&(SND_T(*x)->name)); - (*f)(&(SND_T(*x)->comment)); (*f)(&(SND_T(*x)->filetype)); (*f)(&(SND_T(*x)->format)); --- 650,653 ---- *************** *** 694,698 **** DP(P_Snd_Offset, "foo:snd-offset", 1, 1, EVAL); DP(P_Snd_Length, "foo:snd-length", 1, 1, EVAL); - DP(P_Snd_Comment, "foo:snd-comment", 1, 1, EVAL); DP(P_Snd_Reversedp, "foo:snd-reversed?", 1, 1, EVAL); DP(P_Snd_Type, "foo:snd-type", 1, 1, EVAL); --- 675,678 ---- |