Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Simple getCodes() from Codegen object #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Codegen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Codegen::Codegen(const float* pcm, unsigned int numSamples, int start_offset) {
pFingerprint->Compute();

_CodeString = createCodeString(pFingerprint->getCodes());
_vCodes = pFingerprint->getCodes();
_NumCodes = pFingerprint->getCodes().size();

delete pFingerprint;
Expand Down
5 changes: 4 additions & 1 deletion src/Codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
#define CODEGEN_API
#endif

#include "FPCode.h"

class Fingerprint;
class SubbandAnalysis;
struct FPCode;

class CODEGEN_API Codegen {
public:
Codegen(const float* pcm, unsigned int numSamples, int start_offset);

std::string getCodeString(){return _CodeString;}
std::vector<FPCode> const & getCodes() const {return _vCodes; }
int getNumCodes(){return _NumCodes;}
static double getVersion() { return ECHOPRINT_VERSION; }
private:
Expand All @@ -42,6 +44,7 @@ class CODEGEN_API Codegen {

std::string compress(const std::string& s);
std::string _CodeString;
std::vector<FPCode> _vCodes;
int _NumCodes;
};

Expand Down
17 changes: 17 additions & 0 deletions src/FPCode.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#include "FPCode.h"

FPCode::FPCode()
: frame(0), code(0) {}

FPCode::FPCode(FPCode const & copy)
: frame( copy.frame), code( copy.code) {}

FPCode::FPCode(uint32_t f, uint32_t c)
: frame(f), code(c) {}

19 changes: 19 additions & 0 deletions src/FPCode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//

#ifndef FPCODE_H
#define FPCODE_H

#include <stdint.h>

struct FPCode {
FPCode();
FPCode(FPCode const & copy);
FPCode(uint32_t f, uint32_t c);
uint32_t frame;
uint32_t code;
};

#endif /* FPCODE_H */
7 changes: 1 addition & 6 deletions src/Fingerprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
#define HASH_BITMASK 0x000fffff
#define SUBBANDS 8

struct FPCode {
FPCode() : frame(0), code(0) {}
FPCode(uint f, int c) : frame(f), code(c) {}
uint frame;
uint code;
};
#include "FPCode.h"

unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed );

Expand Down
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MODULES_LIB = \
AudioBufferInput.o \
AudioStreamInput.o \
Base64.o \
FPCode.o \
Codegen.o \
Fingerprint.o \
MatrixUtility.o \
Expand Down Expand Up @@ -72,7 +73,7 @@ install: all
mkdir -p $(DESTDIR)$(BINDIR)
install ../echoprint-codegen $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(INCLUDEDIR)/echoprint
install -pm 644 Codegen.h $(DESTDIR)$(INCLUDEDIR)/echoprint/
install -pm 644 FPCode.h Codegen.h $(DESTDIR)$(INCLUDEDIR)/echoprint/
mkdir -p $(DESTDIR)$(LIBDIR)
ifeq ($(UNAME),Darwin)
install -m 755 libcodegen.$(VERSION).dylib $(DESTDIR)$(LIBDIR)
Expand Down