+void handledefinesound(TAG*tag)
+{
+ U8 flags;
+ U32 samples;
+ char buf[128];
+ char*filename = buf;
+ FILE*fi;
+ U16 id;
+ id = swf_GetU16(tag); //id
+ sprintf(buf, "sound%d.mp3", id);
+
+ if(numextracts==1) {
+ filename = destfilename;
+ if(!strcmp(filename,"output.swf"))
+ filename = "output.mp3";
+ }
+ flags = swf_GetU8(tag);
+ if((flags>>4)!=2) {
+ printf("Sorry, can only extract MP3 sounds. Sound %d is ADPCM or RAW.\n", id);
+ /* not mp3 */
+ return;
+ }
+ samples = swf_GetU32(tag);
+
+ swf_GetU16(tag); //(only for mp3) numsamples_seek
+
+ fi = save_fopen(filename, "wb");
+ fwrite(&tag->data[tag->pos], tag->len - tag->pos, 1, fi);
+ fclose(fi);
+}
+