FreeburnDisc.cpp
上传用户:cnxinhai
上传日期:2013-08-06
资源大小:265k
文件大小:87k
- /* 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.
- */
-
- // The main FOX include file
- #include <fx.h>
- // the main freeburn definition class and additional
- // helper and gui classes go here
- #include "FreeburnDefs.h"
- #include "FreeburnTrack.h"
- #include "FreeburnDisc.h"
- // CFreeburnDisc Constructor
- // The constructor initializes any class variables that need to be initialized
- CFreeburnDisc::CFreeburnDisc(FXint sizeType, FXint discType)
- {
- // Initialize class variables and allocate memory for the basic stuff
- // we want to use for the class so we don't have to initialize ourselves
-
- // set the size type. It should either be 74_650_DISC (0) or 80_700_DISC (1)
- switch(sizeType)
- {
- // valid size types
- case _74_650_DISC:
- case _80_700_DISC:
- m_discSizeType = sizeType;
- break;
- // set to a valid size type.
- default:
- m_discSizeType = _74_650_DISC;
- }
-
- // set up the size count for the disc. We are counting disc size in
- // "blocks", or the smallest item of data represented on a CD.
- m_discCurrentSize = 0;
- if (m_discSizeType == _74_650_DISC)
- {
- m_discFreeSpace = MAX_CD_SPACE_BLOCKS;
- }
- else if (m_discSizeType == _80_700_DISC)
- {
- m_discFreeSpace = MAX_CD_LARGE_SPACE_BLOCKS;
- }
-
- // set up the kind of disc we are going to burn
- switch (discType)
- {
- case CD_DA:
- case CD_ROM:
- case CDROM_XA:
- m_discType = discType;
- break;
- default: // default to CD_DA if not one of the above
- m_discType = CD_DA;
- break;
- }
-
- // fill the catalog strings to the catalog string capacity
- // with a space (" ") character
- m_catalogNumber.size(CD_CATALOG_STRING_LENGTH);
- m_catalogNumber.fill(' ', CD_CATALOG_STRING_LENGTH);
-
- // by default we won't use CD Text, so set this to false
- m_usingCdText = FALSE;
-
- // set the default CD Text Language Map for the default CD Text
- // Language (English), in case the user decides to use CD Text
- m_languageMapArray[0] = new CdTextLanguageMap;
- m_languageMapArray[0]->mapNumber = 0;
- m_languageMapArray[0]->languageType = CD_TEXT_ENGLISH_NUM;
- m_languageMapArray[0]->description = CD_TEXT_ENG_LONGSTR;
- m_cdTextMapCount = 1;
-
- // set up the defaults for the global CD Text block,
- // in case the user decides to use the global CD Text
- // (The strings are automatically initialized to be empty)
- m_pGlobalCdText = new CdTextGlobal;
- m_pGlobalCdText->map_number = 0;
-
- // initialize the track count to zero, since we're creating a new disc
- m_trackCount = 0;
- }
- // CFreeburnDisc Destructor. Now we'll delete everything that needs
- // to be deleted, and clear everything that doesn't
- CFreeburnDisc::~CFreeburnDisc()
- {
- // delete the pointer to the global CD Text struct
- delete m_pGlobalCdText;
-
- // clear the language map and language map count
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- delete m_languageMapArray[i];
- }
- }
- // 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 CFreeburnDisc::discSizeType(FXint sizeType)
- {
- // set the size type. It should either be 74_650_DISC (0) or 80_700_DISC (1)
- if ((sizeType != _74_650_DISC) && (sizeType != _80_700_DISC)) // invalid sizeType
- {
- return FALSE;
- }
- else // valid sizeType
- {
- m_discSizeType = sizeType;
- }
-
- return TRUE;
- }
- // set the type of disc this class represents
- // Returns:
- // TRUE if type is set
- // FALSE if the input was invalid
- FXbool CFreeburnDisc::discType(FXint newType)
- {
- switch (newType)
- {
- case CD_DA:
- m_discType = CD_DA;
- break;
- case CD_ROM:
- m_discType = CD_ROM;
- break;
- case CDROM_XA:
- m_discType = CDROM_XA;
- break;
- default: // no good value
- return FALSE;
- }
-
- return TRUE;
- }
-
- // Set the value of the catalog number
- // Returns:
- // TRUE if set okay
- // FALSE if there was an error with the value
- FXbool CFreeburnDisc::catalogNumber(FXString newNumber)
- {
- if (newNumber.length() > CD_CATALOG_STRING_LENGTH) // bad catalog string
- {
- return FALSE;
- }
- else
- {
- m_catalogNumber = newNumber;
- }
-
- return TRUE;
- }
-
- // 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 CFreeburnDisc::insertCdTextLanguageMap(CdTextLanguageMap* insertMap, FXuint position)
- {
- FXuint insPos;
-
- // if the position specified is greater than the array length,
- // don't insert and return FALSE
- if (position >= CD_TEXT_LANG_ARRAY_LENGTH)
- {
- return FALSE;
- }
-
- // next, check the array to be sure no values will be duplicated
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- if (i != position) // we don't need to check the item we're writing over
- {
- // check to be sure the map number isn't going to be duplicated
- if (m_languageMapArray[i]->mapNumber == insertMap->mapNumber)
- return FALSE;
- // check to be sure the language type isn't going to be duplicated
- if (m_languageMapArray[i]->languageType == insertMap->languageType)
- return FALSE;
- }
- }
-
- // Everything checks out, so insert the new item. If the position
- // is greater than the current array length, just append to the
- // end of the array
- if (position >= m_cdTextMapCount)
- {
- insPos = m_cdTextMapCount;
- m_cdTextMapCount++;
- m_languageMapArray[insPos] = new CdTextLanguageMap;
- }
- else
- {
- insPos = position;
- }
- m_languageMapArray[insPos]->mapNumber = insertMap->mapNumber;
- m_languageMapArray[insPos]->languageType = insertMap->languageType;
- m_languageMapArray[insPos]->description = insertMap->description;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::insertCdTextLanguageMap(FXint insertMapNumber, FXint insertLanguageType,
- FXString description, FXint position)
- {
- FXbool returnValue;
-
- // create a new language map to hold the values given
- CdTextLanguageMap* tempLanguageMap = new CdTextLanguageMap;
-
- // assign the input parameters to the temp Language Map
- tempLanguageMap->mapNumber = insertMapNumber;
- tempLanguageMap->languageType = insertLanguageType;
- tempLanguageMap->description = description;
-
- // call the other insertCdTextLanguageMap with the input position
- // and the temporary language map we created, returning its value
- returnValue = insertCdTextLanguageMap(tempLanguageMap, position);
-
- // delete the tempLanguageMap
- delete tempLanguageMap;
-
- return returnValue;
- }
- // 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 CFreeburnDisc::appendCdTextLanguageMap(CdTextLanguageMap* appendMap)
- {
- // We're appending to the end of the array, so call
- // isnertCdTextLanguageMap at the position of m_cdTextMapCount,
- // which is the next empty position of the array
- return insertCdTextLanguageMap(appendMap, m_cdTextMapCount);
- }
- // 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 CFreeburnDisc::appendCdTextLanguageMap(FXint appendMapNumber, FXint appendLanguageType,
- FXString description)
- {
- FXbool returnValue;
-
- // create a new language map to hold the values given
- CdTextLanguageMap* tempLanguageMap = new CdTextLanguageMap;
-
- // assign the input parameters to the temp Language Map
- tempLanguageMap->mapNumber = appendMapNumber;
- tempLanguageMap->languageType = appendLanguageType;
- tempLanguageMap->description = description;
-
- // call the other insertCdTextLanguageMap with m_cdTextMapCount
- // (the next empty value of the array) and the temporary language
- // map we created, returning its value
- returnValue = insertCdTextLanguageMap(tempLanguageMap, m_cdTextMapCount);
-
- // delete tempLanguageMap
- delete tempLanguageMap;
-
- return returnValue;
- }
- // This version of appendCdTextLanguageMap appends a new language type and
- // automatically gives the type the next map number not used.
- FXbool CFreeburnDisc::appendCdTextLanguageMap(FXint appendLanguageType, FXString description)
- {
- FXint highestMapNumber = 0; // to hold the highest map number in the array
-
- // first, search for the highest language number in the array
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- if (m_languageMapArray[i]->mapNumber > highestMapNumber)
- highestMapNumber = m_languageMapArray[i]->mapNumber;
- }
-
- // now increate highestMapNumber by one; that's the number we'll use
- highestMapNumber++;
-
- // call appendCdTextLanguageMap with the new map number
- return appendCdTextLanguageMap(highestMapNumber, appendLanguageType, description);
- }
- // Get the map number for a specified language type
- // Returns:
- // FXint of the map number
- // If the return value is negative, the mapping was not found.
- FXint CFreeburnDisc::mapNumber(FXint langType)
- {
- // iterate through the map array to search for the
- // language type
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- if (m_languageMapArray[i]->languageType == langType)
- {
- return m_languageMapArray[i]->mapNumber;
- }
- }
-
- // if the language type wasn't found, return FALSE
- return -1;
- }
- // Get the map number for a specified array position
- // Returns:
- // FXint of the map number
- // If the return value is negative, the mapping was not found.
- FXint CFreeburnDisc::mapNumberPosition(FXuint position)
- {
- // check for a valid position
- if (position > m_cdTextMapCount-1) // position should be values 0..7
- {
- return -1;
- }
-
- // position is good, so return the value
- return m_languageMapArray[position]->mapNumber;
- }
- // 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 CFreeburnDisc::mapDescription(FXint langType)
- {
- // iterate through the map array to search for the
- // language type
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- if (m_languageMapArray[i]->languageType == langType)
- {
- return m_languageMapArray[i]->description;
- }
- }
-
- // if the language type wasn't found, return FALSE
- return "";
- }
- FXString CFreeburnDisc::mapDescriptionPosition(FXuint position)
- {
- // check for a valid position
- if (position > m_cdTextMapCount-1) // position should be values 0..7
- {
- return "";
- }
-
- // position is good, so return the value
- return m_languageMapArray[position]->description;
- }
- // Set the global (disc) CD Text Information by values
- // Returns:
- // TRUE is set, FALSE if not
- FXbool CFreeburnDisc::setGlobalCdTextInfo(FXint mapNum, FXString title, FXString performer, FXString songwriter,
- FXString composer, FXString arranger, FXString message, FXString discid, FXString genre)
- {
- FXbool haveMapNumber = FALSE; // for checking the map number
-
- // the map number should be in the map array, so check to be sure
- for (FXuint i = 0; i < m_cdTextMapCount; i++)
- {
- // if the map number is in the map array, we can
- // break out of the loop
- if (m_languageMapArray[i]->mapNumber == mapNum)
- {
- haveMapNumber = TRUE;
- break;
- }
- }
-
- // if we didn't find the map number, return FALSE
- if (haveMapNumber == FALSE)
- return FALSE;
-
- // if we got this far, we can assign the values to the global CD Text struct
- m_pGlobalCdText->map_number = mapNum;
- m_pGlobalCdText->title = title;
- m_pGlobalCdText->performer = performer;
- m_pGlobalCdText->songwriter = songwriter;
- m_pGlobalCdText->composer = composer;
- m_pGlobalCdText->arranger = arranger;
- m_pGlobalCdText->message = message;
- m_pGlobalCdText->discid = discid;
- m_pGlobalCdText->genre = genre;
-
- return TRUE;
- }
- // Set the global (disc) CD Text Information by a global CD Text Struct.
- // Returns:
- // TRUE is set, FALSE if not
- FXbool CFreeburnDisc::setGlobalCdTextInfo(CdTextGlobal* globalText)
- {
- // call the above method for the values in globalText
- return setGlobalCdTextInfo(globalText->map_number, globalText->title, globalText->performer,
- globalText->songwriter, globalText->composer, globalText->arranger, globalText->message,
- globalText->discid, globalText->genre);
- }
- // 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 CFreeburnDisc::discTextMapNumber(FXint num)
- {
- m_pGlobalCdText->map_number = num;
- }
- FXint CFreeburnDisc::discTextMapNumber()
- {
- return m_pGlobalCdText->map_number;
- }
-
- void CFreeburnDisc::discTitle(FXString title)
- {
- m_pGlobalCdText->title = title;
- }
-
- FXString CFreeburnDisc::discTitle()
- {
- return m_pGlobalCdText->title;
- }
-
- void CFreeburnDisc::discPerformer(FXString performer)
- {
- m_pGlobalCdText->performer = performer;
- }
- FXString CFreeburnDisc::discPerformer()
- {
- return m_pGlobalCdText->performer;
- }
-
- void CFreeburnDisc::discSongWriter(FXString songwriter)
- {
- m_pGlobalCdText->songwriter = songwriter;
- }
- FXString CFreeburnDisc::discSongWriter()
- {
- return m_pGlobalCdText->songwriter;
- }
-
- void CFreeburnDisc::discComposer(FXString composer)
- {
- m_pGlobalCdText->composer = composer;
- }
- FXString CFreeburnDisc::discComposer()
- {
- return m_pGlobalCdText->composer;
- }
-
- void CFreeburnDisc::discArranger(FXString arranger)
- {
- m_pGlobalCdText->arranger = arranger;
- }
- FXString CFreeburnDisc::discArranger()
- {
- return m_pGlobalCdText->arranger;
- }
-
- void CFreeburnDisc::discMessage(FXString message)
- {
- m_pGlobalCdText->message = message;
- }
- FXString CFreeburnDisc::discMessage()
- {
- return m_pGlobalCdText->message;
- }
-
- void CFreeburnDisc::discId(FXString id)
- {
- m_pGlobalCdText->discid = id;
- }
- FXString CFreeburnDisc::discId()
- {
- return m_pGlobalCdText->discid;
- }
-
- void CFreeburnDisc::discGenre(FXString genre)
- {
- m_pGlobalCdText->genre = genre;
- }
- FXString CFreeburnDisc::discGenre()
- {
- return m_pGlobalCdText->genre;
- }
-
- // Create a new track at the end of the disc, and set the
- // active track to the newly added track
- // Returns:
- // TRUE if the track is added
- // FALSE if the track was not added (i.e., the disc is full)
- FXbool CFreeburnDisc::createTrack(FXint trackMode, FXint copyProperties, FXint preEmphProperties,
- FXbool twoChannelAudio, FXbool fourChannelAudio, FXint initialDataArraySize)
- {
- // make sure the disc isn't full first
- if (m_trackCount >= MAX_CD_TRACKS) // disc is full
- return FALSE;
-
- // if the track doesn't match the disc type, return false
- switch (trackMode)
- {
- // audio tracks are allowed on any kind of disc
- case AUDIO:
- break;
- case MODE_1:
- case MODE_1_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CDROM_XA) return FALSE;
- break;
- case MODE_2_FORM_2:
- case MODE_2_FORM_1:
- case MODE_2_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CD_ROM) return FALSE;
- break;
- default:
- return FALSE;
- }
-
-
- // add the new track to the end of the track array
- m_trackArray[m_trackCount] = new CFreeburnTrack(trackMode, copyProperties, preEmphProperties,
- twoChannelAudio, fourChannelAudio, initialDataArraySize);
-
- // set the active track index to the newly added track
- m_currentTrackIndex = m_trackCount;
-
- // increment the track count
- m_trackCount++;
-
- // set the track cd text strings to the strings corresponding with the disc strings
- activeTrackTitle(discTitle());
- activeTrackPerformer(discPerformer());
- activeTrackSongWriter(discSongWriter());
- activeTrackComposer(discComposer());
- activeTrackArranger(discArranger());
- activeTrackMessage(discMessage());
-
- return TRUE;
- }
- // Like the above, but inserts a new track at the specified track position
- // (real pos is pos-1) and set the active track to the new one. If the
- // array is full, it will not insert.
- FXbool CFreeburnDisc::insertTrack(FXuint pos, FXint trackMode, FXint copyProperties, FXint preEmphProperties,
- FXbool twoChannelAudio, FXbool fourChannelAudio, FXint initialDataArraySize)
- {
- // make sure the disc isn't full first
- if (m_trackCount >= MAX_CD_TRACKS) // disc is full
- return FALSE;
-
- // make sure the position is valid
- if ((pos < MIN_CD_TRACKS) || (pos > MAX_CD_TRACKS))
- return FALSE;
-
- // if the track doesn't match the disc type, return false
- switch (trackMode)
- {
- // audio tracks are allowed on any kind of disc
- case AUDIO:
- break;
- case MODE_1:
- case MODE_1_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CDROM_XA) return FALSE;
- break;
- case MODE_2_FORM_2:
- case MODE_2_FORM_1:
- case MODE_2_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CD_ROM) return FALSE;
- break;
- default:
- return FALSE;
- }
-
- // if pos is larger than the amount of tracks, just append
- // the item to the end of the array
- if (pos >= m_trackCount)
- {
- pos = m_trackCount;
- }
- // otherwise, make room for the new item
- else
- {
- // bump the items from the insert position to the end down one
- for (FXuint i = (m_trackCount - 1); i >= (pos - 1); i--)
- {
- m_trackArray[i+1] = m_trackArray[i]; // move each item up by one
- // to make space for the new item
- }
- }
-
- // insert the new track at the position specified (the new empty spot in the array)
- m_trackArray[pos - 1] = new CFreeburnTrack(trackMode, copyProperties, preEmphProperties,
- twoChannelAudio, fourChannelAudio, initialDataArraySize);
-
- // set the active track index to the newly added track
- m_currentTrackIndex = pos - 1;
-
- // increment the track count
- m_trackCount++;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::setActiveTrack(FXuint trackNumber)
- {
- // check to see if 1 <= trackNumber <= 99
- if ((trackNumber < MIN_CD_TRACKS) || (trackNumber > MAX_CD_TRACKS))
- return FALSE;
-
- // check to see if the trackNubmer exists
- if (trackNumber > m_trackCount)
- return FALSE;
-
- // trackNumber is the actual track number to set, while the
- // array is indexed starting at zero. So we need to set the
- // active track number to trackNumber - 1
- m_currentTrackIndex = trackNumber - 1;
-
- return TRUE;
- }
- // get the active track number (1..99)
- FXint CFreeburnDisc::getActiveTrack()
- {
- // since the active track index is the array index, and the
- // array index starts at zero, return the track index + 1
- return m_currentTrackIndex + 1;
- }
- // 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 CFreeburnDisc::deleteTrack(FXuint pos)
- {
- // make sure the pos is in range
- // check to see if 1 <= trackNumber <= 99
- if ((pos < MIN_CD_TRACKS) || (pos > MAX_CD_TRACKS))
- return FALSE;
-
- // check to see if the trackNubmer exists
- if (pos > m_trackCount)
- return FALSE;
-
- // delete the track at the given position (minus 1 for the 0-index array)
- delete m_trackArray[pos-1];
-
- // if the track wasn't the last one in the array, bump
- // the rest of the items down to fill the gap
- if (pos != m_trackCount)
- {
- for (FXuint i = (pos - 1); i < (m_trackCount - 1); i++)
- {
- m_trackArray[i] = m_trackArray[i+1];
- }
- }
- // set the last pointer to NULL
- m_trackArray[m_trackCount - 1] = NULL;
-
- // decrement the track count
- m_trackCount--;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackMode(FXint newMode)
- {
- // if the track doesn't match the disc type, return false
- switch (newMode)
- {
- // audio tracks are allowed on any kind of disc
- case AUDIO:
- break;
- case MODE_1:
- case MODE_1_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CDROM_XA) return FALSE;
- break;
- case MODE_2_FORM_2:
- case MODE_2_FORM_1:
- case MODE_2_RAW:
- if (m_discType == CD_DA) return FALSE;
- if (m_discType == CD_ROM) return FALSE;
- break;
- default:
- return FALSE;
- }
-
- // run a switch on newMode. If the mode is a good mode, the
- // new mode will be set. If the mode isn't good, it will hit
- // the default switch and return FALSE.
- switch (newMode)
- {
- case AUDIO:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- case MODE_1:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- case MODE_1_RAW:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- case MODE_2_FORM_1:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- case MODE_2_FORM_2:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- case MODE_2_RAW:
- m_trackArray[m_currentTrackIndex]->m_trackMode = newMode;
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
- }
- FXint CFreeburnDisc::activeTrackMode()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackMode;
- }
- // 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 CFreeburnDisc::activeTrackCopyMode(FXint copyMode)
- {
- // run a switch on copyMode. If the mode is a good mode, the
- // new mode will be set. If the mode isn't good, it will hit
- // the default switch and return FALSE.
- switch (copyMode)
- {
- case COPY:
- m_trackArray[m_currentTrackIndex]->m_trackCopyProperties = copyMode;
- break;
- case NO_COPY:
- m_trackArray[m_currentTrackIndex]->m_trackCopyProperties = copyMode;
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
- }
- FXint CFreeburnDisc::activeTrackCopyMode()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCopyProperties;
- }
- // 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 CFreeburnDisc::activeTrackPreEmphMode(FXint newMode)
- {
- // run a switch on copyMode. If the mode is a good mode, the
- // new mode will be set. If the mode isn't good, it will hit
- // the default switch and return FALSE.
- switch (newMode)
- {
- case NO_PRE_EMPHASIS:
- m_trackArray[m_currentTrackIndex]->m_trackPreEmphasisProperties = newMode;
- break;
- case PRE_EMPHASIS:
- m_trackArray[m_currentTrackIndex]->m_trackPreEmphasisProperties = newMode;
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
- }
- FXint CFreeburnDisc::activeTrackPreEmphMode()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackPreEmphasisProperties;
- }
- // Get/set the track 2 channel and 4 channel audio properties
- void CFreeburnDisc::activeTrackTwoChannelAudio(FXbool mode)
- {
- m_trackArray[m_currentTrackIndex]->m_trackTwoChannelAudio = mode;
- }
- FXbool CFreeburnDisc::activeTrackTwoChannelAudio()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackTwoChannelAudio;
- }
- void CFreeburnDisc::activeTrackFourChannelAudio(FXbool mode)
- {
- m_trackArray[m_currentTrackIndex]->m_trackFourChannelAudio = mode;
- }
- FXbool CFreeburnDisc::activeTrackFourChannelAudio()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackFourChannelAudio;
- }
- // methods to get/set the active track's CD Text properties
- void CFreeburnDisc::activeTrackTextMapNumber(FXint num)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->map_number = num;
- }
- FXint CFreeburnDisc::activeTrackTextMapNumber()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->map_number;
- }
- void CFreeburnDisc::activeTrackTitle(FXString title)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->title = title;
- }
- FXString CFreeburnDisc::activeTrackTitle()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->title;
- }
- void CFreeburnDisc::activeTrackPerformer(FXString performer)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->performer = performer;
- }
- FXString CFreeburnDisc::activeTrackPerformer()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->performer;
- }
- void CFreeburnDisc::activeTrackSongWriter(FXString songwriter)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->songwriter = songwriter;
- }
- FXString CFreeburnDisc::activeTrackSongWriter()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->songwriter;
- }
- void CFreeburnDisc::activeTrackComposer(FXString composer)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->composer = composer;
- }
- FXString CFreeburnDisc::activeTrackComposer()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->composer;
- }
- void CFreeburnDisc::activeTrackArranger(FXString arranger)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->arranger = arranger;
- }
- FXString CFreeburnDisc::activeTrackArranger()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->arranger;
- }
- void CFreeburnDisc::activeTrackMessage(FXString message)
- {
- m_trackArray[m_currentTrackIndex]->m_trackCdText->message = message;
- }
- FXString CFreeburnDisc::activeTrackMessage()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->message;
- }
- // this sets both the CD Text ISRC and the regular track ISRC
- void CFreeburnDisc::activeTrackIsrc(FXString isrc)
- {
- FXint count;
- FXint pos;
-
- m_trackArray[m_currentTrackIndex]->m_trackCdText->isrc = isrc;
- m_trackArray[m_currentTrackIndex]->m_trackIsrc = isrc;
- // the regular track isrc doesn't need dashes
- count = m_trackArray[m_currentTrackIndex]->m_trackIsrc.count('-');
- while (count != 0)
- {
- pos = m_trackArray[m_currentTrackIndex]->m_trackIsrc.findf('-');
- m_trackArray[m_currentTrackIndex]->m_trackIsrc.remove(pos);
- count = m_trackArray[m_currentTrackIndex]->m_trackIsrc.count('-');
- }
- }
- FXString CFreeburnDisc::activeTrackIsrc()
- {
- return m_trackArray[m_currentTrackIndex]->m_trackCdText->isrc;
- }
- // 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 CFreeburnDisc::activeTrackAddData()
- {
- // call insert data for the end of the array
- return activeTrackInsertData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1);
- }
- // 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 CFreeburnDisc::activeTrackAddAudioData(FXString filename, DiscTime start, DiscTime length)
- {
- // call insert data for the end of the array
- return activeTrackInsertAudioData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1,
- filename, start, 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 CFreeburnDisc::activeTrackAddDataData(FXString filename, FXuint length)
- {
- // call insert data for the end of the array
- return activeTrackInsertDataData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, filename, 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 CFreeburnDisc::activeTrackAddSilenceData(DiscTime length)
- {
- // call insert data for the end of the array
- return activeTrackInsertSilenceData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, 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 CFreeburnDisc::activeTrackAddZeroData(FXuint length)
- {
- // call insert data for the end of the array
- return activeTrackInsertZeroData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, 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 CFreeburnDisc::activeTrackAddStartData(DiscTime length)
- {
- // call insert data for the end of the array
- return activeTrackInsertStartData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, 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 CFreeburnDisc::activeTrackAddPregapData(DiscTime length)
- {
- // call insert data for the end of the array
- return activeTrackInsertPregapData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, 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 CFreeburnDisc::activeTrackAddIndexData(DiscTime length)
- {
- // call insert data for the end of the array
- return activeTrackInsertIndexData(m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex+1, 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 CFreeburnDisc::activeTrackInsertData(FXint pos)
- {
- // to set up the real index based on input
- FXint insPos;
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // first, check the array length. If the array is full, then
- // we need to grow it out so it will fit the new data
- if (pTempTrack->m_trackDataArrayLastIndex ==
- (pTempTrack->m_trackDataArrayLength -1))
- {
- if (activeTrackGrowDataArray() == FALSE)
- return FALSE; // the array is full, and we couldn't grow it
- }
-
- // if pos is greater than the last indexed item in the array, make
- // pos the next un-indexed item in the array
- if (pos > pTempTrack->m_trackDataArrayLastIndex)
- insPos = pTempTrack->m_trackDataArrayLastIndex + 1;
- else
- insPos = pos;
-
- // if insPos is not the new last item in the array, bump the
- // other items down to make room
- if (insPos <= pTempTrack->m_trackDataArrayLastIndex)
- {
- for (FXint i = pTempTrack->m_trackDataArrayLastIndex + 1; i > insPos; i--)
- {
- // copy the data type
- pTempTrack->m_trackDataArray[i].dataType = pTempTrack->m_trackDataArray[i-1].dataType;
- // copy the file name
- pTempTrack->m_trackDataArray[i].filename = pTempTrack->m_trackDataArray[i-1].filename;
- // copy the start time
- pTempTrack->m_trackDataArray[i].startTime.minutes = pTempTrack->m_trackDataArray[i-1].startTime.minutes;
- pTempTrack->m_trackDataArray[i].startTime.seconds = pTempTrack->m_trackDataArray[i-1].startTime.seconds;
- pTempTrack->m_trackDataArray[i].startTime.frames = pTempTrack->m_trackDataArray[i-1].startTime.frames;
- // copy the data length
- pTempTrack->m_trackDataArray[i].lengthData = pTempTrack->m_trackDataArray[i-1].lengthData;
- // copy the time length
- pTempTrack->m_trackDataArray[i].lengthTime.minutes = pTempTrack->m_trackDataArray[i-1].lengthTime.minutes;
- pTempTrack->m_trackDataArray[i].lengthTime.seconds = pTempTrack->m_trackDataArray[i-1].lengthTime.seconds;
- pTempTrack->m_trackDataArray[i].lengthTime.frames = pTempTrack->m_trackDataArray[i-1].lengthTime.frames;
- }
- }
-
- // now insert "dummy" data into the newly inserted track data element
- pTempTrack->m_trackDataArray[insPos].dataType = AUDIOFILE; // AUDIOFILE == 0
- pTempTrack->m_trackDataArray[insPos].filename = "";
- pTempTrack->m_trackDataArray[insPos].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[insPos].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[insPos].startTime.frames = 0;
- pTempTrack->m_trackDataArray[insPos].lengthData = 0;
- pTempTrack->m_trackDataArray[insPos].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[insPos].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[insPos].lengthTime.frames = 0;
-
- // adjust the current index and max index
- pTempTrack->m_trackDataArrayIndex = insPos;
- pTempTrack->m_trackDataArrayLastIndex++;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertAudioData(FXint pos, FXString filename, DiscTime start, DiscTime length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the filename doesn't exist, exit
- if (FXFile::exists(filename) == FALSE) return FALSE;
- // if the start times are not right, exit
- if (!((start.frames > MIN_FRAMES) || (start.frames < MAX_FRAMES))) return FALSE;
- if (!((start.seconds > MIN_SECONDS) || (start.frames < MAX_SECONDS))) return FALSE;
- if (!((start.minutes > MIN_MINUTES) ||
- (start.minutes < (m_discCurrentSize + m_discFreeSpace)/BLOCKS_IN_ONE_MINUTE))) return FALSE;
- // if the length times are not right, exit
- if ((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES)) return FALSE;
- if ((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS)) return FALSE;
- if ((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE)) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for an audio file data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = AUDIOFILE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = filename;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = start.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = start.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = start.frames;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertDataData(FXint pos, FXString filename, FXuint length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an data type, exit
- switch (pTempTrack->m_trackMode)
- {
- case MODE_1:
- break;
- case MODE_1_RAW:
- break;
- case MODE_2_FORM_1:
- break;
- case MODE_2_RAW:
- break;
- default: // not a data track
- return FALSE;
- }
-
- // if the filename doesn't exist, exit
- if (FXFile::exists(filename) == FALSE) return FALSE;
- // if the length is too big, then exit
- if (length > m_discFreeSpace) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for an audio file data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = DATAFILE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = filename;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = length;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = 0;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length / BYTES_IN_ONE_BLOCK;
- if ((length % BYTES_IN_ONE_BLOCK) != 0) // there is a remainder from the divide, so add 1
- blockLength += 1;
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertSilenceData(FXint pos, DiscTime length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for silence data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = SILENCE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertZeroData(FXint pos, FXuint length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an data type, exit
- switch (pTempTrack->m_trackMode)
- {
- case MODE_1:
- break;
- case MODE_1_RAW:
- break;
- case MODE_2_FORM_1:
- break;
- case MODE_2_RAW:
- break;
- default: // not a data track
- return FALSE;
- }
-
- // if the length is too big, then exit
- if (length > m_discFreeSpace) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for zero data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = ZERO;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = length;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = 0;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length / BYTES_IN_ONE_BLOCK;
- if ((length % BYTES_IN_ONE_BLOCK) != 0) // there is a remainder from the divide, so add 1
- blockLength += 1;
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertStartData(FXint pos, DiscTime length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // START can be used on audio and data tracks, but if START was already
- // set for this track (we don't want it), return false
- if (pTempTrack->m_trackStartSet) return FALSE;
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for start data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = START;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // set START
- pTempTrack->m_trackStartSet = TRUE;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertPregapData(FXint pos, DiscTime length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // pregap can be used on audio or data tracks, but it replaces
- // START, so we can't do this if start is set.
- // if start was already set for this track, return false
- if (pTempTrack->m_trackStartSet) return FALSE;
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for pregap data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = PREGAP;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // set START
- pTempTrack->m_trackStartSet = TRUE;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackInsertIndexData(FXint pos, DiscTime length)
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // insert a blank track at pos
- if (activeTrackInsertData(pos) == FALSE)
- return FALSE;
-
- // insert the right data for index data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = INDEX;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- FXint blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // 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 CFreeburnDisc::activeTrackDeleteData(FXint pos)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // check to see if the trackNubmer exists
- // Zero is used because it's a common base index for an array, and it is in FreeBurn as well
- if ((pos > pTempTrack->m_trackDataArrayLastIndex) || (pos < 0))
- return FALSE;
-
- // if the item we're deleting is a START element, then change the status of having it set
- if ((pTempTrack->m_trackDataArray[pos].dataType == START) ||
- (pTempTrack->m_trackDataArray[pos].dataType == PREGAP))
- pTempTrack->m_trackStartSet = FALSE;
-
- // restore the old disc size
- // DATAFILE and ZERO are the only two data track data types; all others are audio
- if ((pTempTrack->m_trackDataArray[pos].dataType == DATAFILE) ||
- pTempTrack->m_trackDataArray[pos].dataType == ZERO)
- {
- blockLength = pTempTrack->m_trackDataArray[pos].lengthData / BYTES_IN_ONE_BLOCK;
- // if there is a remainder from the divide, add 1 block that will contain the remaining space
- if ((pTempTrack->m_trackDataArray[pos].lengthData % BYTES_IN_ONE_BLOCK) != 0)
- blockLength += 1;
- }
- else
- {
- blockLength = pTempTrack->m_trackDataArray[pos].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pos].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pos].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- }
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // if the track wasn't the last one in the array, bump
- // the rest of the items down to fill the gap
- if (pos != pTempTrack->m_trackDataArrayLastIndex)
- {
- for (FXint i = pos; i < pTempTrack->m_trackDataArrayLastIndex; i++)
- {
- // copy the (i+1) element to the i element, which
- // bumps each item down by one
- pTempTrack->m_trackDataArray[i].dataType = pTempTrack->m_trackDataArray[i+1].dataType;
- pTempTrack->m_trackDataArray[i].filename = pTempTrack->m_trackDataArray[i+1].filename;
- pTempTrack->m_trackDataArray[i].startTime.minutes = pTempTrack->m_trackDataArray[i+1].startTime.minutes;
- pTempTrack->m_trackDataArray[i].startTime.seconds = pTempTrack->m_trackDataArray[i+1].startTime.seconds;
- pTempTrack->m_trackDataArray[i].startTime.frames = pTempTrack->m_trackDataArray[i+1].startTime.frames;
- pTempTrack->m_trackDataArray[i].lengthData = pTempTrack->m_trackDataArray[i+1].lengthData;
- pTempTrack->m_trackDataArray[i].lengthTime.minutes = pTempTrack->m_trackDataArray[i+1].lengthTime.minutes;
- pTempTrack->m_trackDataArray[i].lengthTime.seconds = pTempTrack->m_trackDataArray[i+1].lengthTime.seconds;
- pTempTrack->m_trackDataArray[i].lengthTime.frames = pTempTrack->m_trackDataArray[i+1].lengthTime.frames;
- }
- }
- // delete the last data item in the array (set it's values to dummy values
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].dataType = AUDIOFILE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayLastIndex].lengthTime.frames = 0;
-
- // decrement the data array count, and the current index
- // if it was the last item in the array
- if (pTempTrack->m_trackDataArrayIndex == pTempTrack->m_trackDataArrayLastIndex)
- pTempTrack->m_trackDataArrayIndex--;
- pTempTrack->m_trackDataArrayLastIndex--;
-
- return TRUE;
- }
- // change the index of the track data item
- FXbool CFreeburnDisc::activeTrackActiveDataIndex(FXint pos)
- {
- // check for a valid pos
- if ((pos < 0) || (pos > m_trackArray[m_currentTrackIndex]->m_trackDataArrayLastIndex))
- return FALSE;
-
- // set the pos
- m_trackArray[m_currentTrackIndex]->m_trackDataArrayIndex = pos;
-
- return TRUE;
- }
- // get the index of the active track data item
- FXint CFreeburnDisc::activeTrackActiveDataIndex()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArrayIndex;
- }
- // Get the elements of the currently indexed track data item
- FXint CFreeburnDisc::activeTrackActiveDataType()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType;
- }
- FXString CFreeburnDisc::activeTrackActiveFileName()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename;
- }
- FXint CFreeburnDisc::activeTrackActiveStartTimeMinutes()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes;
- }
- FXint CFreeburnDisc::activeTrackActiveStartTimeSeconds()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds;
- }
- FXint CFreeburnDisc::activeTrackActiveStartTimeFrames()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames;
- }
- FXint CFreeburnDisc::activeTrackActiveTimeLengthMinutes()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes;
- }
- FXint CFreeburnDisc::activeTrackActiveTimeLengthSeconds()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds;
- }
- FXint CFreeburnDisc::activeTrackActiveTimeLengthFrames()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds;
- }
- FXint CFreeburnDisc::activeTrackActiveDataLength()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- return pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData;
- }
- // Set the currently indexed track data item to the new data type
- // Returns: True on change, False if not
- FXbool CFreeburnDisc::activeTrackDataSetAudio(FXString filename, DiscTime start, DiscTime length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the filename doesn't exist, exit
- if (FXFile::exists(filename) == FALSE) return FALSE;
- // if the start times are not right, exit
- if (!((start.frames > MIN_FRAMES) || (start.frames < MAX_FRAMES))) return FALSE;
- if (!((start.seconds > MIN_SECONDS) || (start.frames < MAX_SECONDS))) return FALSE;
- if (!((start.minutes > MIN_MINUTES) ||
- (start.minutes < (m_discCurrentSize + m_discFreeSpace)/BLOCKS_IN_ONE_MINUTE))) return FALSE;
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore the old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for an audio file data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = AUDIOFILE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = filename;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = start.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = start.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = start.frames;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetData(FXString filename, FXuint length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an data type, exit
- switch (pTempTrack->m_trackMode)
- {
- case MODE_1:
- break;
- case MODE_1_RAW:
- break;
- case MODE_2_FORM_1:
- break;
- case MODE_2_RAW:
- break;
- default: // not a data track
- return FALSE;
- }
-
- // if the filename doesn't exist, exit
- if (FXFile::exists(filename) == FALSE) return FALSE;
- // if the length is too big, then exit
- if (length > m_discFreeSpace) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData / BYTES_IN_ONE_BLOCK;
- // if there is a remainder from the divide, add 1 block that will contain the remaining space
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData % BYTES_IN_ONE_BLOCK) != 0)
- blockLength += 1;
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for a data file data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = DATAFILE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = filename;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = length;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = 0;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length / BYTES_IN_ONE_BLOCK;
- if ((length % BYTES_IN_ONE_BLOCK) != 0) // there is a remainder from the divide, so add 1
- blockLength += 1;
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetSilence(DiscTime length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore the old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for silence data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = SILENCE;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetZero(FXuint length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an data type, exit
- switch (pTempTrack->m_trackMode)
- {
- case MODE_1:
- break;
- case MODE_1_RAW:
- break;
- case MODE_2_FORM_1:
- break;
- case MODE_2_RAW:
- break;
- default: // not a data track
- return FALSE;
- }
-
- // if the length is too big, then exit
- if (length > m_discFreeSpace) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData / BYTES_IN_ONE_BLOCK;
- // if there is a remainder from the divide, add 1 block that will contain the remaining space
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData % BYTES_IN_ONE_BLOCK) != 0)
- blockLength += 1;
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for zero data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = ZERO;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = length;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = 0;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length / BYTES_IN_ONE_BLOCK;
- if ((length % BYTES_IN_ONE_BLOCK) != 0) // there is a remainder from the divide, so add 1
- blockLength += 1;
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetStart(DiscTime length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // START can be used on audio and data tracks, but if START was already
- // set for this track (we don't want it), return false
- if (pTempTrack->m_trackStartSet &&
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType != START) &&
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType != PREGAP))
- return FALSE;
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore the old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for start data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = START;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // set START
- pTempTrack->m_trackStartSet = TRUE;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetPregap(DiscTime length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // pregap can be used on audio or data tracks, but it replaces
- // START, so we can't do this if start is set.
- // if start was already set for this track, return false
- if (pTempTrack->m_trackStartSet &&
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType != START) &&
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType != PREGAP))
- return FALSE;
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore the old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for pregap data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = PREGAP;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // set START
- pTempTrack->m_trackStartSet = TRUE;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- FXbool CFreeburnDisc::activeTrackDataSetIndex(DiscTime length)
- {
- FXint blockLength;
-
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // if the track type isn't an audio type, exit
- switch (pTempTrack->m_trackMode)
- {
- case AUDIO:
- break;
- case MODE_2_FORM_2:
- break;
- default: // not an audio track
- return FALSE;
- }
-
- // if the length times are not right, exit
- if (!((length.frames > MIN_FRAMES) || (length.frames < MAX_FRAMES))) return FALSE;
- if (!((length.seconds > MIN_SECONDS) || (length.frames < MAX_SECONDS))) return FALSE;
- // 4500 is 75 Frames * 60 Seconds, or the number of frames per minute
- if (!((length.minutes > MIN_MINUTES) || (length.minutes < m_discFreeSpace/BLOCKS_IN_ONE_MINUTE))) return FALSE;
-
- // restore START status
- if ((pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == START) ||
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType == PREGAP))
- {
- pTempTrack->m_trackStartSet = FALSE;
- }
-
- // restore the old disc size
- blockLength = pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds * BLOCKS_IN_ONE_SECOND) +
- (pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace += blockLength;
- m_discCurrentSize -= blockLength;
-
- // insert the right data for index data
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].dataType = INDEX;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].filename = "";
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.minutes = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.seconds = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].startTime.frames = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthData = 0;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.minutes = length.minutes;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.seconds = length.seconds;
- pTempTrack->m_trackDataArray[pTempTrack->m_trackDataArrayIndex].lengthTime.frames = length.frames;
-
- // the disc sizes have changed, so adjust them accordingly
- blockLength = length.frames +
- (length.seconds * BLOCKS_IN_ONE_SECOND) + (length.minutes * BLOCKS_IN_ONE_MINUTE);
- m_discFreeSpace -= blockLength;
- m_discCurrentSize += blockLength;
-
- return TRUE;
- }
- // This method will double the size of the active tracks
- // data array, in case the size of the array is too small
- FXbool CFreeburnDisc::activeTrackGrowDataArray()
- {
- // a pointer to the active track class, to reduce typing
- CFreeburnTrack* pTempTrack = m_trackArray[m_currentTrackIndex];
-
- // a temp pointer to the current track data array
- TrackDataStruct* tempTrackData = pTempTrack->m_trackDataArray;
- // a pointer to the new track data array
- TrackDataStruct* newTrackData;
-
- // allocate the new data array for twice the size of the current array
- newTrackData = new TrackDataStruct[pTempTrack->m_trackDataArrayLength * 2];
-
- // copy the items in the old array to the new array
- for (FXint i = 0; i < pTempTrack->m_trackDataArrayLength; i++)
- {
- newTrackData[i].dataType = tempTrackData[i].dataType;
- newTrackData[i].filename = tempTrackData[i].filename;
- newTrackData[i].startTime.minutes = tempTrackData[i].startTime.minutes;
- newTrackData[i].startTime.seconds = tempTrackData[i].startTime.seconds;
- newTrackData[i].startTime.frames = tempTrackData[i].startTime.frames;
- newTrackData[i].lengthData = tempTrackData[i].lengthData;
- newTrackData[i].lengthTime.minutes = tempTrackData[i].lengthTime.minutes;
- newTrackData[i].lengthTime.seconds = tempTrackData[i].lengthTime.seconds;
- newTrackData[i].lengthTime.frames = tempTrackData[i].lengthTime.frames;
- }
-
- // set the new array length size
- pTempTrack->m_trackDataArrayLength *= 2;
-
- // delete the old array
- delete[] m_trackArray[m_currentTrackIndex]->m_trackDataArray;
-
- // assign the new array to the class array pointer
- m_trackArray[m_currentTrackIndex]->m_trackDataArray = newTrackData;
-
- return TRUE;
- }