FreeburnDisc.h
上传用户:cnxinhai
上传日期:2013-08-06
资源大小:265k
文件大小:21k
- /* The Disc class for FreeBurn. This class is used
- * to represent the basic disc structure in FreeBurn.
- *
- * Copyright (C) 2001, 2002 Adam Schlag
- */
- /*
- * FreeBurn Software License
- * (based on the Apache Software License)
- *
- * Version 1.1
- *
- * Copyright (c) 2001, 2002 The FreeBurn Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any, must
- * include the following acknowledgment:
- *
- * "This product includes software developed by the FreeBurn
- * Project (http://freeburn.sourceforge.net/)."
- *
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "FreeBurn" and "FreeBurn Project" must not be
- * used to endorse or promote products derived from this software
- * without prior written permission. For written permission, please
- * contact aschlag@users.sourceforge.net.
- *
- * 5. Products derived from this software may not be called "FreeBurn",
- * nor may "FreeBurn" appear in their name, without prior written
- * permission of the FreeBurn Project.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE FREEBURN PROJECT OR ITS
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the FreeBurn Project. For more
- * information on the FreeBurn Project and FreeBurn, please see
- * <http://freeburn.sourceforge.net/>.
- *
- * This software is distributed with software that is released under the GNU
- * General Public License (GPL). You can find the terms of this license in the
- * file GPL.txt distributed in this package. You can find information on the
- * software distributed with this package in the file PROGRAMS.txt.
- */
- // struct for handling a CD TEXT language map.
- // The data types are for the struct and a struct pointer.
- typedef struct _CdTextLanguageMap
- {
- FXint mapNumber; // Map number of the language to use
- FXint languageType; // Language to use for the map number
- FXString description; // Description of the Language
- } CdTextLanguageMap;
- // struct for handling the CD TEXT that can be placed in the
- // global CD TEXT area of a disc.
- typedef struct _CdTextGlobal
- {
- FXint map_number; // language map number to use for the text
- FXString title; // disc title
- FXString performer; // performer (or artist)
- FXString songwriter; // songwriter
- FXString composer; // composer
- FXString arranger; // arranger
- FXString message; // any message the user wishes to include
- FXString discid; // a Disc ID, format is usually XY12345...
- FXString genre; // the genre of the music on the disc
- } CdTextGlobal;
- class CFreeburnDisc
- {
- public:
- // set the size type of the disc that will be burned.
- // Possible values are 74_650_DISC and 80_700_DISC,
- // which represent a 74 min/650 MB disc and an 80 min/
- // 700 MB disc, respectively.
- // Returns:
- // TRUE if set, FALSE if not
- FXbool discSizeType(FXint sizeType);
- // Get the value of the disc size type
- FXint discSizeType() { return m_discSizeType; }
- // get the size used and remaining information
- FXint discCurrentSize() { return m_discCurrentSize; }
- FXint discFreeSpace() { return m_discFreeSpace; }
- // set the type of disc this class represents
- // Returns:
- // TRUE if type is set
- // FALSE if the input was invalid
- FXbool discType(FXint newType);
- // Get the value of the disc type
- FXint discType() { return m_discType; }
- // Set the value of the catalog number
- // Returns:
- // TRUE if set okay
- // FALSE if there was an error with the value
- FXbool catalogNumber(FXString newNumber);
- // Get the value of the catalog number
- FXString catalogNumber() { return m_catalogNumber; }
- // set usingCdText
- void usingCdText(FXbool cdText) { m_usingCdText = cdText; }
- // get the value of usingCdText
- FXbool usingCdText() { return m_usingCdText; }
- // get the value of cdTextCount
- FXuint cdTextMapCount() { return m_cdTextMapCount; }
- // Insert a new CD Text Language Mapping at the specified position
- // (the default position is zero).
- // Returns:
- // TRUE if the map was inserted successfully
- // FALSE if the map was not inserted
- FXbool insertCdTextLanguageMap(CdTextLanguageMap* insertMap, FXuint position = 0);
- FXbool insertCdTextLanguageMap(FXint insertMapNumber, FXint insertLanguageType,
- FXString description, FXint position = 0);
- // Append a new CD Text Language Mapping at the end of the array
- // Returns:
- // TRUE if the map was appended successfully
- // FALSE if the map was not appended
- FXbool appendCdTextLanguageMap(CdTextLanguageMap* appendMap);
- FXbool appendCdTextLanguageMap(FXint appendMapNumber, FXint appendLanguageType,
- FXString description);
- // This version of appendCdTextLanguageMap appends a new language type and
- // automatically gives the type the next map number not used.
- FXbool appendCdTextLanguageMap(FXint appendLanguageType, FXString description);
- // Get the map number for a specified language type (or array position)
- // Returns:
- // FXint of the map number
- // If the return value is negative, the mapping was not found.
- FXint mapNumber(FXint langType);
- FXint mapNumberPosition(FXuint position);
- // Get the description for a specified language type (or array position)
- // Returns:
- // FXString of the map description
- // If the string is null (""), no value was found
- FXString mapDescription(FXint langType);
- FXString mapDescriptionPosition(FXuint position);
-
- // Set the global (disc) CD Text Information, either by values
- // or by a global CD Text Struct.
- // Returns:
- // TRUE is set, FALSE if not
- FXbool setGlobalCdTextInfo(FXint mapNum = 0, FXString title = "", FXString performer = "",
- FXString songwriter = "", FXString composer = "", FXString arranger = "",
- FXString message = "", FXString discid = "", FXString genre = "");
- FXbool setGlobalCdTextInfo(CdTextGlobal* globalText);
- // Basic methods to set and get the global cd text values one by one
- // The method names are given to correspond to the property they
- // are going to assign or return the value of
- void discTextMapNumber(FXint num);
- FXint discTextMapNumber();
- void discTitle(FXString title);
- FXString discTitle();
- void discPerformer(FXString performer);
- FXString discPerformer();
- void discSongWriter(FXString songwriter);
- FXString discSongWriter();
- void discComposer(FXString composer);
- FXString discComposer();
- void discArranger(FXString arranger);
- FXString discArranger();
- void discMessage(FXString message);
- FXString discMessage();
- void discId(FXString id);
- FXString discId();
- void discGenre(FXString genre);
- FXString discGenre();
- // Get the current track count for the disc
- FXuint trackCount() { return m_trackCount; }
- // Create a new track at the end of the disc and make it active
- // Returns:
- // TRUE if the track is added
- // FALSE if the track was not added (i.e., the disc is full)
- FXbool createTrack(FXint trackMode = AUDIO, FXint copyProperties = COPY,
- FXint preEmphProperties = NO_PRE_EMPHASIS, FXbool twoChannelAudio = FALSE,
- FXbool fourChannelAudio = FALSE, FXint initialDataArraySize = INITIAL_TRACK_PROP_ARRAY_SIZE);
- // Like the above, but inserts a new track at the specified position
- // and set the active track to the new one. If the array is full, it
- // will not insert.
- FXbool insertTrack(FXuint pos, FXint trackMode = AUDIO, FXint copyProperties = COPY,
- FXint preEmphProperties = NO_PRE_EMPHASIS, FXbool twoChannelAudio = FALSE,
- FXbool fourChannelAudio = FALSE, FXint initialDataArraySize = INITIAL_TRACK_PROP_ARRAY_SIZE);
- // set the active track to manipulate. If the trackNumber given
- // is not a valid track number (it isn't 1..99 or the track number
- // doesn't exist yet), then the number won't change
- // Returns: TRUE on set, FALSE on not set
- FXbool setActiveTrack(FXuint trackNumber);
- // get the active track number (1..99)
- FXint getActiveTrack();
- // Delete the track at the given position. If the track
- // is not the last track on the disc, other tracks will
- // be moved up to fill the gap.
- // Returns:
- // TRUE if the track was deleted
- // FALSE if the track was not deleted
- FXbool deleteTrack(FXuint pos);
-
- // Get/set the track mode for the active track number
- // Returns: TRUE/track mode if there is an active track
- // FALSE/-1 if there isn't an active track
- FXbool activeTrackMode(FXint newMode);
- FXint activeTrackMode();
-
- // Get/set the track copy properties for the active track number
- // Returns: TRUE/track copy mode if there is an active track
- // FALSE/-1 if there isn't an active track
- FXbool activeTrackCopyMode(FXint copyMode);
- FXint activeTrackCopyMode();
-
- // Get/set the track pre-emphasis mode for the active track number
- // Returns: TRUE/track pre-emphasis mode if there is an active track
- // FALSE/-1 if there isn't an active track
- FXbool activeTrackPreEmphMode(FXint newMode);
- FXint activeTrackPreEmphMode();
-
- // Get/set the track 2 channel and 4 channel audio properties
- void activeTrackTwoChannelAudio(FXbool mode);
- FXbool activeTrackTwoChannelAudio();
- void activeTrackFourChannelAudio(FXbool mode);
- FXbool activeTrackFourChannelAudio();
-
- // methods to get/set the active track's CD Text properties
- void activeTrackTextMapNumber(FXint num);
- FXint activeTrackTextMapNumber();
- void activeTrackTitle(FXString title);
- FXString activeTrackTitle();
- void activeTrackPerformer(FXString performer);
- FXString activeTrackPerformer();
- void activeTrackSongWriter(FXString songwriter);
- FXString activeTrackSongWriter();
- void activeTrackComposer(FXString composer);
- FXString activeTrackComposer();
- void activeTrackArranger(FXString arranger);
- FXString activeTrackArranger();
- void activeTrackMessage(FXString message);
- FXString activeTrackMessage();
- // this sets both the CD Text ISRC and the regular track ISRC
- void activeTrackIsrc(FXString isrc);
- FXString activeTrackIsrc();
- // adds a new generic track data item to the
- // end of the track data array, and sets the
- // active array index to the newly added item
- // Returns: True on add, False on no add
- FXbool activeTrackAddData();
- // adds a track data item to the end of the track data array of the
- // data type AUDIOFILE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddAudioData(FXString filename, DiscTime start, DiscTime length);
- // adds a track data item to the end of the track data array of the
- // data type DATAFILE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddDataData(FXString filename, FXuint length);
- // adds a track data item to the end of the track data array of the
- // data type SILENCE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddSilenceData(DiscTime length);
- // adds a track data item to the end of the track data array of the
- // data type ZERO, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddZeroData(FXuint length);
- // adds a track data item to the end of the track data array of the
- // data type START, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddStartData(DiscTime length);
- // adds a track data item to the end of the track data array of the
- // data type PREGAP, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddPregapData(DiscTime length);
- // adds a track data item to the end of the track data array of the
- // data type INDEX, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackAddIndexData(DiscTime length);
-
- // inserts a new generic track data item at the
- // position specified in the data array, and sets the
- // active array index to the newly added item
- // Returns: True on add, False on no add
- FXbool activeTrackInsertData(FXint pos);
- // inserts a track data item to the track data array at (pos) of the
- // data type AUDIOFILE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertAudioData(FXint pos, FXString filename, DiscTime start, DiscTime length);
- // inserts a track data item to the track data array at (pos) of the
- // data type DATAFILE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertDataData(FXint pos, FXString filename, FXuint length);
- // inserts a track data item to the track data array at (pos) of the
- // data type SILENCE, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertSilenceData(FXint pos, DiscTime length);
- // inserts a track data item to the track data array at (pos) of the
- // data type ZERO, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertZeroData(FXint pos, FXuint length);
- // inserts a track data item to the track data array at (pos) of the
- // data type START, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertStartData(FXint pos, DiscTime length);
- // inserts a track data item to the track data array at (pos) of the
- // data type PREGAP, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertPregapData(FXint pos, DiscTime length);
- // inserts a track data item to the track data array at (pos) of the
- // data type INDEX, and set the properties corresponding to this type
- // Also set the active array index to this new item.
- // Returns: True on add, False on no add
- FXbool activeTrackInsertIndexData(FXint pos, DiscTime length);
-
- // Delete the active track data from the track data array. If the item isn't
- // at the end of the array, bump the rest of the items down to fill the gap
- // Returns: True on delete, False on a fail
- FXbool activeTrackDeleteData(FXint pos);
-
- // change the index of the track data item
- FXbool activeTrackActiveDataIndex(FXint pos);
- // get the index of the active track data item
- FXint activeTrackActiveDataIndex();
-
- // Get the elements of the currently indexed track data item
- FXint activeTrackActiveDataType();
- FXString activeTrackActiveFileName();
- FXint activeTrackActiveStartTimeMinutes();
- FXint activeTrackActiveStartTimeSeconds();
- FXint activeTrackActiveStartTimeFrames();
- FXint activeTrackActiveTimeLengthMinutes();
- FXint activeTrackActiveTimeLengthSeconds();
- FXint activeTrackActiveTimeLengthFrames();
- FXint activeTrackActiveDataLength();
-
- // Set the currently indexed track data item to the new data type
- // Returns: True on change, False if not
- FXbool activeTrackDataSetAudio(FXString filename, DiscTime start, DiscTime length);
- FXbool activeTrackDataSetData(FXString filename, FXuint length);
- FXbool activeTrackDataSetSilence(DiscTime length);
- FXbool activeTrackDataSetZero(FXuint length);
- FXbool activeTrackDataSetStart(DiscTime length);
- FXbool activeTrackDataSetPregap(DiscTime length);
- FXbool activeTrackDataSetIndex(DiscTime length);
-
- // CFreeburnDisc Constructor
- // The constructor initializes any class variables that need to be initialized
- CFreeburnDisc(FXint sizeType = _74_650_DISC, FXint discType = CD_DA);
- // CFreeburnDisc Destructor
- ~CFreeburnDisc();
- protected:
-
- // This method will double the size of the active tracks
- // data array, in case the size of the array is too small
- FXbool activeTrackGrowDataArray();
- private:
- // The type of disc that will be burned.
- // By types we mean the size of the CD-R or CD-RW.
- // The type will either be 74/650 or 80/700, and are
- // represented by the defines 74_650_DISC and
- // 80_700_DISC. A 74/650 disc holds 74 minutes of audio
- // or 650 MB of data. An 80/700 disc holds 80 minutes
- // of audio or 700 MB of data. We need to keep track of
- // this so we know how much space is on the disc that
- // will be burned.
- FXint m_discSizeType;
-
- // These keep track of the current size of the disc,
- // and the amount of blocks left. The maximum size
- // will depend on the size of the current disc
- FXuint m_discCurrentSize;
- FXuint m_discFreeSpace;
-
- // type of disc we're going to burn.
- FXint m_discType;
-
- // a string specifying the catalog number
- // Max size is 13 characters
- FXString m_catalogNumber;
-
- // specifies if the disc will use CD TEXT or not.
- // This will help to force CD TEXT for tracks to be
- // defined if the disc CD TEXT is defined.
- FXbool m_usingCdText;
- // the number of CD TEXT language mappings we have
- FXuint m_cdTextMapCount;
- // An array of CD TEXT language mapping definitions
- // to possibly use if we'll use CD TEXT.
- CdTextLanguageMap* m_languageMapArray[CD_TEXT_LANG_ARRAY_LENGTH];
- // Pointer to a Global CD TEXT struct.
- // Will only point to data if we're using CD TEXT.
- CdTextGlobal* m_pGlobalCdText;
- // Count of how many tracks are on this disc.
- // The number can't be any higher than 99.
- FXuint m_trackCount;
-
- // Also keep track of the current track the user
- // is working with.
- FXuint m_currentTrackIndex;
- // Array of Track Class pointers. Each pointer
- // only points to data if the track is defined.
- CFreeburnTrack* m_trackArray[MAX_CD_TRACKS];
- };