2016-04-29 Fred Gleason <fredg@paravelsystems.com>

* Implemented export for marker data in WAV files in
	'lib/rdwavefile.cpp' and 'lib/rdwavefile.h'.
This commit is contained in:
Fred Gleason
2016-04-29 13:29:28 -04:00
parent fa988211a8
commit 09aa449509
3 changed files with 51 additions and 24 deletions

View File

@@ -15107,3 +15107,6 @@
2016-04-27 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'lib/rdcut.cpp' that caused the cut 'Description'
field to be applied as a cut Title.
2016-04-29 Fred Gleason <fredg@paravelsystems.com>
* Implemented export for marker data in WAV files in
'lib/rdwavefile.cpp' and 'lib/rdwavefile.h'.

View File

@@ -1741,14 +1741,14 @@ QString RDWaveFile::getCartTimerLabel(int index) const
return QString("");
}
/*
void RDWaveFile::setCartTimerLabel(int index,QString label)
{
if(index<MAX_TIMERS) {
cart_timer_label[index]=label;
}
}
*/
unsigned RDWaveFile::getCartTimerSample(int index) const
{
@@ -1758,14 +1758,14 @@ unsigned RDWaveFile::getCartTimerSample(int index) const
return 0;
}
/*
void RDWaveFile::setCartTimerSample(int index,unsigned sample)
{
if(index<MAX_TIMERS) {
cart_timer_sample[index]=sample;
}
}
*/
QString RDWaveFile::getCartURL() const
{
@@ -4135,11 +4135,40 @@ bool RDWaveFile::MakeCart()
(const char *)cart_user_def.left(64));
}
WriteDword(cart_chunk_data,680,cart_level_ref);
for(int i=0;i<MAX_TIMERS;i++) {
if(!cart_timer_label[i].isEmpty()) {
sprintf((char *)cart_chunk_data+684+i*MAX_TIMERS,"%4s",
(const char *)cart_timer_label[i].left(4));
WriteDword(cart_chunk_data,688+i*MAX_TIMERS,cart_timer_sample[i]);
if(wave_data!=NULL) {
int timer=0;
if((wave_data->segueStartPos()>=0)&&
(wave_data->segueEndPos()>wave_data->segueStartPos())) {
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"SEGs");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->segueStartPos()));
timer++;
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"SEGe");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->segueEndPos()));
timer++;
}
if((wave_data->introStartPos()>=0)&&
(wave_data->introEndPos()>wave_data->introStartPos())) {
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"INTs");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->introStartPos()));
timer++;
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"INTe");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->introEndPos()));
timer++;
}
if((wave_data->startPos()>=0)&&
(wave_data->endPos()>wave_data->startPos())) {
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"AUDs");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->startPos()));
timer++;
sprintf((char *)cart_chunk_data+684+timer*MAX_TIMERS,"AUDe");
WriteDword(cart_chunk_data,688+timer*MAX_TIMERS,
FrameOffset(wave_data->endPos()));
timer++;
}
}
if(!cart_url.isEmpty()) {
@@ -4615,3 +4644,12 @@ int RDWaveFile::WriteOggBuffer(char *buf,int size)
#endif // HAVE_VORBIS
return 0;
}
unsigned RDWaveFile::FrameOffset(int msecs) const
{
if(msecs<0) {
return 0;
}
return (unsigned)((double)msecs*(double)samples_per_sec/1000.0);
}

View File

@@ -643,13 +643,6 @@ class RDWaveFile
**/
QString getCartTimerLabel(int index) const;
/**
* Set the label for one of the eight CartChunk timers.
* @param index The index number of the timer to access (0 - 7).
* @param label the label of the corresponding timer.
**/
void setCartTimerLabel(int index,QString label);
/**
* Retrieve the sample value for one of the eight CartChunk timers.
* @param index The index number of the timer to access (0 - 7).
@@ -657,13 +650,6 @@ class RDWaveFile
**/
unsigned getCartTimerSample(int index) const;
/**
* Set the sample value for one of the eight CartChunk timers.
* @param index The index number of the timer to access (0 - 7).
* @param sample the sample value of the corresponding timer.
**/
void setCartTimerSample(int index,unsigned sample);
/**
* Returns the contents of the URL field in the WAV file's CART chunk.
**/
@@ -1082,6 +1068,7 @@ class RDWaveFile
int WriteOggPage(ogg_page *page);
#endif // HAVE_VORBIS
int WriteOggBuffer(char *buf,int size);
unsigned FrameOffset(int msecs) const;
QFile wave_file;
RDWaveData *wave_data;
bool recordable; // Allow DATA chunk writes?
@@ -1196,7 +1183,6 @@ class RDWaveFile
unsigned char *cook_buffer;
int cook_buffer_size;
// RDWaveFile::Encoding cook_encoding;
float encode_quality;
int serial_number;
int atx_offset;