Skip to content

Commit e5f6a74

Browse files
committed
inline to prevent linker errors when multiple compilation units
1 parent 9eff463 commit e5f6a74

File tree

14 files changed

+42
-41
lines changed

14 files changed

+42
-41
lines changed

docs/.DS_Store

0 Bytes
Binary file not shown.

examples/.DS_Store

2 KB
Binary file not shown.

src/AudioCodecs/CodecWAV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct WAVAudioInfo : AudioBaseInfo {
3131
uint32_t file_size=0;
3232
};
3333

34-
const char* wav_mime = "audio/wav";
34+
inline const char* wav_mime = "audio/wav";
3535

3636
/**
3737
* @brief Parser for Wav header data

src/AudioHttp/HttpHeader.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ namespace audio_tools {
1313
// Class Configuration
1414

1515
// Define relevant header content
16-
const char* CONTENT_TYPE = "Content-Type";
17-
const char* CONTENT_LENGTH = "Content-Length";
18-
const char* CONNECTION = "Connection";
19-
const char* CON_CLOSE = "close";
20-
const char* CON_KEEP_ALIVE = "keep-alive";
21-
const char* TRANSFER_ENCODING = "Transfer-Encoding";
22-
const char* CHUNKED = "chunked";
23-
const char* ACCEPT = "Accept";
24-
const char* ACCEPT_ALL = "*/*";
25-
const char* SUCCESS = "Success";
26-
const char* USER_AGENT = "User-Agent";
27-
const char* DEFAULT_AGENT = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
28-
const char* HOST_C = "Host";
29-
const char* ACCEPT_ENCODING = "Accept-Encoding";
30-
const char* IDENTITY = "identity";
31-
const char* LOCATION = "Location";
16+
inline const char* CONTENT_TYPE = "Content-Type";
17+
inline const char* CONTENT_LENGTH = "Content-Length";
18+
inline const char* CONNECTION = "Connection";
19+
inline const char* CON_CLOSE = "close";
20+
inline const char* CON_KEEP_ALIVE = "keep-alive";
21+
inline const char* TRANSFER_ENCODING = "Transfer-Encoding";
22+
inline const char* CHUNKED = "chunked";
23+
inline const char* ACCEPT = "Accept";
24+
inline const char* ACCEPT_ALL = "*/*";
25+
inline const char* SUCCESS = "Success";
26+
inline const char* USER_AGENT = "User-Agent";
27+
inline const char* DEFAULT_AGENT = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
28+
inline const char* HOST_C = "Host";
29+
inline const char* ACCEPT_ENCODING = "Accept-Encoding";
30+
inline const char* IDENTITY = "identity";
31+
inline const char* LOCATION = "Location";
3232

3333

3434
// Http methods
35-
const char* methods[] = {"?","GET","HEAD","POST","PUT","DELETE","TRACE","OPTIONS","CONNECT","PATCH",nullptr};
35+
inline const char* methods[] = {"?","GET","HEAD","POST","PUT","DELETE","TRACE","OPTIONS","CONNECT","PATCH",nullptr};
3636

3737
/**
3838
* @brief A individual key - value header line

src/AudioI2S/I2SConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum I2SSignalType {
2121
PDM
2222
};
2323

24-
const char* i2s_formats[] = {"I2S_STD_FORMAT","I2S_LSB_FORMAT","I2S_MSB_FORMAT","I2S_PHILIPS_FORMAT","I2S_RIGHT_JUSTIFIED_FORMAT","I2S_LEFT_JUSTIFIED_FORMAT","I2S_PCM_LONG","I2S_PCM_SHORT"};
24+
inline const char* i2s_formats[] = {"I2S_STD_FORMAT","I2S_LSB_FORMAT","I2S_MSB_FORMAT","I2S_PHILIPS_FORMAT","I2S_RIGHT_JUSTIFIED_FORMAT","I2S_LEFT_JUSTIFIED_FORMAT","I2S_PCM_LONG","I2S_PCM_SHORT"};
2525

2626

2727
/**

src/AudioLibs/AudioFaust.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ class FaustStream : public AudioStreamX {
133133
allocateFloatBuffer(samples, with_output_buffer);
134134
int16_t *data16 = (int16_t*) write_data;
135135
// convert to float
136-
for(int j=0;j<samples;j+=cfg.channels){
136+
int frameCount = samples/cfg.channels;
137+
for(int j=0;j<frameCount;j++){
137138
for(int i=0;i<cfg.channels;i++){
138-
p_buffer[i][j] = static_cast<FAUSTFLOAT>(data16[j+i])/32767.0;
139+
p_buffer[i][j] = static_cast<FAUSTFLOAT>(data16[(j*cfg.channels)+i])/32767.0;
139140
}
140141
}
141142
FAUSTFLOAT** p_float_out = with_output_buffer ? p_buffer_out : p_buffer;
@@ -260,9 +261,10 @@ class FaustStream : public AudioStreamX {
260261
/// Converts the float buffer to int16 values
261262
void convertFloatBufferToInt16(int samples, void *data, FAUSTFLOAT**p_float_out){
262263
int16_t *data16 = (int16_t*) data;
263-
for (int j=0;j<samples;j+=cfg.channels){
264+
int frameCount = samples/cfg.channels;
265+
for (int j=0;j<frameCount;j++){
264266
for (int i=0;i<cfg.channels;i++){
265-
data16[j+i]=p_float_out[i][j]*32767;
267+
data16[(j*cfg.channels)+i]=p_float_out[i][j]*32767;
266268
}
267269
}
268270
}

src/AudioMetaData/AbstractMetaData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ enum ID3TypeSelection { SELECT_ID3V1=0b001, SELECT_ID3V2=0b010, SELECT_ID3=0b011
1010
enum MetaDataType { Title, Artist, Album, Genre, Name, Description };
1111

1212
/// Test Description for meta info
13-
const char* MetaDataTypeStr[] = {"Title", "Artist", "Album", "Genre","Name", "Description"};
13+
inline const char* MetaDataTypeStr[] = {"Title", "Artist", "Album", "Genre","Name", "Description"};
1414

1515
/// Converts the MetaDataType to a string
16-
const char *toStr(MetaDataType t){
16+
inline const char *toStr(MetaDataType t){
1717
return MetaDataTypeStr[t];
1818
}
1919

src/AudioMetaData/MetaDataID3.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace audio_tools {
1515

1616
/// String array with genres
17-
const char *genres[] = { "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "Alternative Rock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Insdustiral", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native US", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic","Humour", "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhytmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "Acapella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "SynthPop" };
17+
inline const char *genres[] = { "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "Alternative Rock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Insdustiral", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native US", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic","Humour", "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhytmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "Acapella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "SynthPop" };
1818

1919
/// current status of the parsing
2020
enum ParseStatus { TagNotFound, PartialTagAtTail, TagFoundPartial, TagFoundComplete, TagProcessed};
@@ -266,7 +266,7 @@ class MetaDataID3V1 : public MetaDataID3Base {
266266
#define ExperimentalIndicatorFlag 0x10
267267

268268
/// Relevant v2 Tags
269-
const char* id3_v2_tags[] = {"TALB", "TOPE", "TIT2", "TCON"};
269+
inline const char* id3_v2_tags[] = {"TALB", "TOPE", "TIT2", "TCON"};
270270

271271

272272
/// ID3 verion 2 TAG Header (10 bytes)
@@ -275,7 +275,6 @@ struct ID3v2 {
275275
uint8_t version[2];
276276
uint8_t flags;
277277
uint8_t size[4];
278-
279278
};
280279

281280
// /// ID3 verion 2 Extended Header
@@ -307,7 +306,7 @@ struct ID3v2FrameString {
307306
uint8_t encoding; // encoding byte for strings
308307
};
309308

310-
const int ID3FrameSize = 11;
309+
inline const int ID3FrameSize = 11;
311310

312311
/**
313312
* @brief Simple ID3 Meta Data API which supports ID3 V2: We only support the "TALB", "TOPE", "TIT2", "TCON" tags

src/AudioPWM/PWMAudioAVR.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ class PWMAudioStreamAVR : public PWMAudioStreamBase {
127127
};
128128

129129
/// separate method that can be defined as friend so that we can access protected information
130-
void defaultPWMAudioOutputCallback(){
130+
inline void defaultPWMAudioOutputCallback(){
131131
if (accessAudioPWM!=nullptr && accessAudioPWM->is_timer_started){
132132
accessAudioPWM->playNextFrame();
133133
}
134134
}
135135

136136
/// timer callback: write the next frame to the pins
137-
ISR(TIMER1_COMPA_vect){
137+
inline ISR(TIMER1_COMPA_vect){
138138
defaultPWMAudioOutputCallback();
139139
TimerAlarmRepeatingAVR::tickerCallback();
140140

src/AudioPWM/PWMAudioBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct PWMConfig : public AudioBaseInfo {
9090
Pins pins_data;
9191

9292

93-
} default_config;
93+
} inline default_config;
9494

9595

9696
/**

0 commit comments

Comments
 (0)