mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Unjumble the PT5 wav ordering in regions/tracks
by sorting alphanumerically and case insensitively Signed-off-by: Damien Zammit <damien@zamaudio.com>
This commit is contained in:
parent
255fbe7b55
commit
81a9f7a956
2 changed files with 32 additions and 4 deletions
|
|
@ -630,6 +630,17 @@ PTFFormat::parserest5(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PTFFormat::resort(std::vector<wav_t> *ws) {
|
||||||
|
int j = 0;
|
||||||
|
std::sort((*ws).begin(), (*ws).end());
|
||||||
|
for (std::vector<wav_t>::iterator i = (*ws).begin();
|
||||||
|
i != (*ws).end(); ++i) {
|
||||||
|
(*i).index = j;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PTFFormat::parseaudio5(void) {
|
PTFFormat::parseaudio5(void) {
|
||||||
int i,k,l;
|
int i,k,l;
|
||||||
|
|
@ -670,6 +681,7 @@ PTFFormat::parseaudio5(void) {
|
||||||
|
|
||||||
wavnumber = 0;
|
wavnumber = 0;
|
||||||
i+=16;
|
i+=16;
|
||||||
|
char ext[5];
|
||||||
while (i < len && numberofwavs > 0) {
|
while (i < len && numberofwavs > 0) {
|
||||||
i++;
|
i++;
|
||||||
if ( (ptfunxored[i ] == 0x5a) &&
|
if ( (ptfunxored[i ] == 0x5a) &&
|
||||||
|
|
@ -684,11 +696,19 @@ PTFFormat::parseaudio5(void) {
|
||||||
wavname[l] = ptfunxored[i+l];
|
wavname[l] = ptfunxored[i+l];
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
i+=lengthofname + 4;
|
i+=lengthofname;
|
||||||
|
ext[0] = ptfunxored[i++];
|
||||||
|
ext[1] = ptfunxored[i++];
|
||||||
|
ext[2] = ptfunxored[i++];
|
||||||
|
ext[3] = ptfunxored[i++];
|
||||||
|
ext[4] = '\0';
|
||||||
|
|
||||||
wavname[l] = 0;
|
wavname[l] = 0;
|
||||||
if (foundin(wavname, ".wav")) {
|
if (foundin(wavname, ".L") || foundin(wavname, ".R")) {
|
||||||
|
extension = string("");
|
||||||
|
} else if (foundin(wavname, ".wav") || foundin(ext, "WAVE")) {
|
||||||
extension = string(".wav");
|
extension = string(".wav");
|
||||||
} else if (foundin(wavname, ".aif")) {
|
} else if (foundin(wavname, ".aif") || foundin(ext, "AIFF")) {
|
||||||
extension = string(".aif");
|
extension = string(".aif");
|
||||||
} else {
|
} else {
|
||||||
extension = string("");
|
extension = string("");
|
||||||
|
|
@ -707,6 +727,8 @@ PTFFormat::parseaudio5(void) {
|
||||||
numberofwavs--;
|
numberofwavs--;
|
||||||
i += 7;
|
i += 7;
|
||||||
}
|
}
|
||||||
|
resort(&actualwavs);
|
||||||
|
resort(&audiofiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@
|
||||||
#define PTFFORMAT_H
|
#define PTFFORMAT_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "ptformat/visibility.h"
|
#include "ptformat/visibility.h"
|
||||||
|
|
||||||
class LIBPTFORMAT_API PTFFormat {
|
class LIBPTFORMAT_API PTFFormat {
|
||||||
|
|
@ -39,6 +39,11 @@ public:
|
||||||
int64_t posabsolute;
|
int64_t posabsolute;
|
||||||
int64_t length;
|
int64_t length;
|
||||||
|
|
||||||
|
bool operator <(const struct wav& other) {
|
||||||
|
return (strcasecmp(this->filename.c_str(),
|
||||||
|
other.filename.c_str()) < 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool operator ==(const struct wav& other) {
|
bool operator ==(const struct wav& other) {
|
||||||
return (this->filename == other.filename ||
|
return (this->filename == other.filename ||
|
||||||
this->index == other.index);
|
this->index == other.index);
|
||||||
|
|
@ -125,6 +130,7 @@ private:
|
||||||
void parserest10(void);
|
void parserest10(void);
|
||||||
void parseaudio5(void);
|
void parseaudio5(void);
|
||||||
void parseaudio(void);
|
void parseaudio(void);
|
||||||
|
void resort(std::vector<wav_t> *ws);
|
||||||
std::vector<wav_t> actualwavs;
|
std::vector<wav_t> actualwavs;
|
||||||
float ratefactor;
|
float ratefactor;
|
||||||
std::string extension;
|
std::string extension;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue