Community Forums Archive

Go Back

Subject:Using FourCC
Posted by: PC AT
Date:12/16/2008 10:12:11 AM

Hi there,
I'm trying to maximize the use of the FourCC implementation; however, after dissecting the SfSummaryInfo Class from the API help file and carefully combing the “Dump Summary Info.cs” sample code I cant read/write to the file. I’m successful using (the very limited) IsfFileSummaryInfo by modifying the sample code “Modify Summary Information.cs” For example:


sumy.Album = "The Album (US Vinyl, 12 inch single)";

Works well. I can read and write the info to the file.
I would like to know how to convert the previous sample to FourCC. I attempted this:

' (This code is in VB)
Public SfSummaryInfo() as object 'PC added
Public myID as string 'PC added

Public Function Begin(app as IScriptableApp) as String

'begin here

'test by grabbing the ISRC fourCC
myID = SfSummaryInfo.FourCC.ISRC

return String.Empty
End Function


I know I’m not structuring the call correctly. I’m proficient in VB and new to C#. The reason for me to use FourCC is to get the IPRD property, which is not exposed on the IsfFileSummaryInfo. Any help is greatly appreciated.
Thanks,
PC AT

Subject:RE: Using FourCC
Reply by: _TJ
Date:12/16/2008 2:02:33 PM

I"m not certain I Understand the question. But here is some C# sample code that might be helpful.



// create the fourcc code for IPRD
uint IPRD = IFileSummaryInfo.MakeFourCC('I', 'P', 'R', 'D');

// set summary value for IPRD
symy[IPRD] = "whatever";

[/CODE]





Subject:RE: Using FourCC
Reply by: PC AT
Date:12/16/2008 2:59:55 PM

Thanks TJ I'm half way there. I used the code you suggested (minor typo) and it helped me to generate the FourCC. Where is the documention for MakeFourCC?


SfSummaryInfo info = new SfSummaryInfo();

// create the fourcc code for IPRD
uint IPRD = SfSummaryInfo.MakeFourCC('I', 'P', 'R', 'D');

DPF("{0}", IPRD.ToString());

// set summary value for IPRD
info[IPRD] = "whatever";


I verified the IPRD by dumping it to the OutputText window. Unfortunately I’m not getting the new value for IPRD with the last line of code.

Subject:RE: Using FourCC
Reply by: _TJ
Date:12/16/2008 4:58:34 PM

Once again, I don't understand the question, the last line sets the value, it doesn't get
it.

sorry about the typo.

tj

Subject:RE: Using FourCC
Reply by: PC AT
Date:12/16/2008 5:18:27 PM

Sorrry Tj for the cryptic question. I’m generating the information to “stuff” in a wav file, artist, album, etc. by properly filling the wav riff header of the file, and the FourCC codes seem to do the trick. Unfortunately only the 13 that are available via the ISfFileSummaryInfo Properties are not enough. I needed to populate other wave riff codes like IPRD and IARL to name a couple. Now that I took the time to learn more about the “trick” you shared with me of MakeFourCC I was able to create what I needed.
After playing with both the SfSummaryInfo and ISfFileSummaryInfo,
this section of code will do the trick. Thanks TJ for giving me the push I needed!

using System;
using System.IO;
using System.Windows.Forms;
using SoundForge;

//Run with a file open

public class EntryPoint {
public void Begin(IScriptableApp app) {

ISfFileHost file = app.CurrentFile;
if (null != file)
{

ISfFileSummaryInfo sumy = file.Summary;

// create the fourcc codes
uint IPRD = SfSummaryInfo.MakeFourCC('I', 'P', 'R', 'D');
uint IARL = SfSummaryInfo.MakeFourCC('I', 'A', 'R', 'L');
//verify it made it ok
DPF("{0}", IPRD.ToString());
DPF("{0}", IARL.ToString());

// set summary value for All FourCCs
sumy[IPRD] = "whatever";
sumy[IARL] = "Sound Forge really Rocks";

//verify it made it ok
DPF(sumy[IPRD]);
DPF(sumy[IARL]);

//Dump all File summary codes
foreach (uint fcc in sumy)
{
DPF("fcc=" + fcc + " '" + sumy[fcc] + "'");
}
}

}

public void FromSoundForge(IScriptableApp app) {
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
Begin(app);
app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name));
}
public static IScriptableApp ForgeApp = null;
public static void DPF(string sz) { ForgeApp.OutputText(sz); }
public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); }
public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); }
public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); }
public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; }
public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); }
public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); }
} //EntryPoint


Thanks,
PC AT

Subject:RE: Using FourCC
Reply by: _TJ
Date:12/16/2008 5:58:45 PM

You seem to have it figured out. just FYI, the SfSummaryInfo class contains an enum with a pre-defined set of FourCC codes, and a separate enum with English friendly names for them.

Here's the list.


Title =FourCC.INAM, // File title, usually Song Name
Artist =FourCC.IART, // Primary Artist
Album =FourCC.ISRC, // Album/Source
TrackNumber =FourCC.TRCK, // one based track number
AlbumArtist =FourCC.TPE1, // Lead performer(s)/Soloist(s)
Orchestra =FourCC.TPE2, // Band/orchestra/accompaniment
Conductor =FourCC.TPE3, // Conductor/performer refinement
InterpretedBy =FourCC.TPE4, // Interpreted, remixed, or otherwise modified by

Description =FourCC.ISBJ, // general description of the file
Comments =FourCC.ICMT, // general comments
Text =FourCC.TXXX, // generic user text
Owner =FourCC.TOWN, // File owner/licensee

Genre =FourCC.IGNR, // one or more genre names
Language =FourCC.TLAN, // language(s) of the audio in 3 letter codes [ISO-639-2]
Period =FourCC.TPER, // e.g. Baroque
Year =FourCC.ICRD, // Year - or Creation Date in YYYY-MM-DD format
Mood =FourCC.TMOO,
Keywords =FourCC.IKEY, // keywords

Copyright =FourCC.ICOP,
SharedUserRating =FourCC.MRAT, // Media Manager rating
Rating =FourCC.RATE, // VidCap rating & obsolete WMV rating
ParentalRating =FourCC.VCHP, // TV rating system rating, e.g. TV-PG
ParentalRatingReason =FourCC.VREA, // reason for the rating (e.g. Harsh Language)

Picture =FourCC.APIC, // Attached picture - filename of image to imbed
MCDI =FourCC.MCDI, // Music CD identifier (TOC for CDDB lookup)
DVDID =FourCC.IDVD, // ID extracted from DVD
UniqueFileIdentifier =FourCC.UFID,
ISRC =FourCC.TSRC, // ISRC (international standard recording code)

Composer =FourCC.TCOM,
Writer =FourCC.TEXT, // Lyricist/Text writer
Lyrics =FourCC.USLT, // lyrics in text form
Lyrics_Synchronised =FourCC.SYLT, // lyrics in binary form including timing information
Engineer =FourCC.IENG, // Engineer - Forge stuffs this by default.
Producer =FourCC.TPRO, // Produced notice
Director =FourCC.TDIR,
MediaCredits =FourCC.TMCL, // Musician/Actors credits list
Publisher =FourCC.TPUB, // Label/Publisher

ContentGroupDescription =FourCC.TIT1, // (use INAM instead)
SubTitle =FourCC.TIT2, // TV Episode name
SubTitleDescription =FourCC.TIT3, // TV Episode description
PartOfSet =FourCC.TPOS, // DiscNo of multidisc set
SetSubtitle =FourCC.TSST, // Set subtitle
AlbumTitle =FourCC.TALB, // Album/Movie/Show title (see also INAM)

OriginalLyricist =FourCC.TOLY, // Original lyricist(s)/text writer(s)
OriginalArtist =FourCC.TOPE, // Original artist(s)/performer(s)
OriginalAlbumTitle =FourCC.TOAL,
OriginalReleaseYear =FourCC.TDOR, // Original release date
OriginalReleaseTime =FourCC.TTOR,
OriginalFilename =FourCC.TOFN, // Original filename

CopyrightURL =FourCC.WCOP,
PromotionURL =FourCC.TURL,
AlbumCoverURL =FourCC.WOAS,
CommercialURL =FourCC.WCOM,
RadioStationURL =FourCC.WORS,
PaymentURL =FourCC.WPAY,
PublishersURL =FourCC.WPUB,
AuthorURL =FourCC.WOAR,
UserWebURL =FourCC.WXXX,
AudioFileURL =FourCC.WOAF,
AudioSourceURL =FourCC.WOAS,

BeatsPerMinute =FourCC.TBPM, // BPM (beats per minute)
InitialKey =FourCC.TKEY, // Initial key (e.g. 'D-flat')
PlaylistDelay =FourCC.TDLY, // Playlist delay (pre-delay?)

ModifiedBy =FourCC.ITCH, // Technician
ToolName =FourCC.ISFT, // Software (e.g. 'Sound Forge')
ToolVersion =FourCC.ISFV, // Software Version

EncodedBy =FourCC.TENC, // Encoded by
EncodingSettings =FourCC.TSSE, // Software/Hardware and settings used for encoding
EncodingTime =FourCC.TDEN, // Encoding time (see also IDIT)

RadioStationName =FourCC.TRSN,
RadioStationOwner =FourCC.TRSO,
MediaStationCallSign =FourCC.TVCS, // Media Station Call Sign (e.g. 'SCIFI')
MediaStationName =FourCC.TVNM, // Media Station Name (e.g. 'Sci-Fi Channel')
MediaNetworkAffiliation =FourCC.TVNA, // Media Network Affiliate (e.g. 'Satellite')
MediaOriginalChannel =FourCC.TVCH, // Media Station Channel Number (e.g. '51')
MediaOriginalBroadcastDateTime =FourCC.TOBD, // OriginalBroadcastDateTime (e.g. '2006-02-10T00:00:00.0000000-06:00')

Provider =FourCC.PVDR, // metadata provider 'Zap2it'
ProviderRating =FourCC.PVRT, // metadata provider copyright
ProviderStyle =FourCC.PVST, // metadata provider supplied rating
ProviderCopyright =FourCC.PVCR, // metadata provider supplied style

TitleSortOrder =FourCC.TSOT, // alternative title text, not displayed but used for sorting.
ArtistSortOrder =FourCC.TSOP, // artist text used for sorting
AlbumSortOrder =FourCC.TSOA, // album text used for sorting

// wave specific tags
ArchivalLocation =FourCC.IARL, // Archival Location - Indicates where the subject of the file is archived.
Commissioned =FourCC.ICMS, // Commissioned - Lists the name of the person or organization that commissioned the subject of the file. For example, XYZZY Records.
Cropped =FourCC.ICRP, // Cropped - Describes whether an image has been cropped and, if so, how it was cropped. For example, lower right corner.
Dimensions =FourCC.IDIM, // Dimensions - Specifies the size of the original subject of the file. For example, 8.5 in h, 11 in w.
DigitizationTime =FourCC.IDIT, // Digitization Time
DotsPerInch =FourCC.IDPI, // Dots Per Inch - Stores dots per inch setting of the digitizer used to produce the file, such as 300.
Lightness =FourCC.ILGT, // Lightness - Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
Medium =FourCC.IMED, // Medium - Describes the original subject of the file, such as, computer image, drawing, lithograph, and so forth.
PaletteSetting =FourCC.IPLT, // Palette Setting - Specifies the number of colors requested when digitizing an image, such as 256.
Product =FourCC.IPRD, // Product - Specifies the name of the title the file was originally intended for, such as 1001 Ways to Kill Bugs: CD-ROM Edition.
Sharpness =FourCC.ISHP, // Sharpness - Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
SMPTETimeCode =FourCC.ISMP, // SMPTE Time Code
SourceForm =FourCC.ISRF, // Source Form - the original form of the material that was digitized, such as slide, paper, map, and so forth. This is not necessarily the same as IMED.
TextLength =FourCC.TLEN, // Text Length (ms) - Shows the length of the file in milliseconds
SoundSchemeTitle =FourCC.DISP, // Sound Scheme Title - used by Windows Sound System software and Windows 95 sound schemes.
TrackVersion =FourCC.TVER, // Track versioning (e.g. remix info)
Location =FourCC.LOCA, // Location - where track was recorded
Origin =FourCC.TORG, // Name of the organization producing the track (i.e. the 'record label')

// vidcap specific tags
VidcapTapeName =FourCC.TAPE,
VidcapStartTimecode =FourCC.TCOD,
VidcapEndTimecode =FourCC.TCDO,
VidcapMajorVersion =FourCC.VMAJ,
VidcapMinorVersion =FourCC.VMIN,
VidcapComment =FourCC.CMNT,
VidcapStats =FourCC.STAT,
VidcapRecordedDateTime =FourCC.DTIM,
MMThumbIndex =FourCC.MTIX,

// mp3 specific tags
//
Mp3TermsOfUse =FourCC.USER,
Mp3Comments =FourCC.COMM, // Comments (see also ICMT & CMNT)
Mp3PlayCounter =FourCC.PCNT, // Play counter (how many times the file has been played)
Mp3Popularimeter =FourCC.POPM, // Popularimeter
Mp3ContentType =FourCC.TCON, // this is genre??
Mp3Copyright =FourCC.TCOP, // Copyright message (see also ICOP)
Mp3RecordingTime =FourCC.TDRC, // Recording time
Mp3ReleaseTime =FourCC.TDRL, // Release time
Mp3TaggingTime =FourCC.TDTG, // Tagging time
Mp3FileType =FourCC.TFLT, // File type (like a mime type)
Mp3InvolvedPeople =FourCC.TIPL, // Involved people list (credits?)
Mp3MediaType =FourCC.TMED, // Media type

// GraceNote special tags
TitleThe =FourCC.The, // The non-sorted article The in a title name



and here's how you use them


ISfFileSummaryInfo sumy = file.Summary;
sumy[SfSummaryInfo.FourCC.IPRD] = "whatever";
sumy[SfSummaryInfo.FourCC.IARL] = "Sound Forge really Rocks";


Thanks for the kind words.
tj




Subject:RE: Using FourCC
Reply by: PC AT
Date:12/16/2008 6:20:43 PM

Great! That will simplify my code.
Thanks,
PC AT

Go Back