Skip to content

Commit a6f9dd0

Browse files
committed
Merge branch 'release-2.15.11'
2 parents 3c34a7a + c5a6e41 commit a6f9dd0

File tree

15 files changed

+133
-100
lines changed

15 files changed

+133
-100
lines changed

architecture/faust/audio/coreaudio-dsp.h

+33-72
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ class TCoreAudioRenderer
212212

213213
int fPhysicalInputs;
214214
int fPhysicalOutputs;
215-
216-
int fDefaultPhysicalInputs;
217-
int fDefaultPhysicalOutputs;
218-
215+
219216
float** fInChannel;
220217
float** fOutChannel;
221218

@@ -233,9 +230,10 @@ class TCoreAudioRenderer
233230
AudioDeviceID fDeviceID;
234231
AudioUnit fAUHAL;
235232
bool fState;
236-
233+
237234
OSStatus GetDefaultDeviceAndSampleRate(int inChan, int outChan, int& sample_rate, AudioDeviceID* device)
238235
{
236+
239237
UInt32 theSize = sizeof(UInt32);
240238
AudioDeviceID inDefault;
241239
AudioDeviceID outDefault;
@@ -310,41 +308,10 @@ class TCoreAudioRenderer
310308
// Otherwise force the one we want...
311309
SetupSampleRateAux(*device, sample_rate);
312310
}
311+
//printf("samplerate %d\n", sample_rate);
313312
fSampleRate = sample_rate;
314-
315-
// Get default input total channels
316-
GetTotalChannels(inDefault, fDefaultPhysicalInputs, true);
317-
318-
// Get default output total channels
319-
GetTotalChannels(outDefault, fDefaultPhysicalOutputs, false);
320-
321313
return noErr;
322314
}
323-
324-
OSStatus GetTotalChannels(AudioDeviceID device, int& channelCount, bool isInput)
325-
{
326-
OSStatus err = noErr;
327-
UInt32 outSize;
328-
Boolean outWritable;
329-
330-
channelCount = 0;
331-
err = AudioDeviceGetPropertyInfo(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, &outWritable);
332-
if (err == noErr) {
333-
int stream_count = outSize / sizeof(AudioBufferList);
334-
//printf("GetTotalChannels stream_count = %d\n", stream_count);
335-
AudioBufferList* bufferList = new AudioBufferList(); // stack allocation sometimes crashes...
336-
err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyStreamConfiguration, &outSize, bufferList);
337-
if (err == noErr) {
338-
for (uint i = 0; i < bufferList->mNumberBuffers; i++) {
339-
channelCount += bufferList->mBuffers[i].mNumberChannels;
340-
//printf("GetTotalChannels stream = %d channels = %d\n", i, bufferList->mBuffers[i].mNumberChannels);
341-
}
342-
}
343-
delete bufferList;
344-
}
345-
//printf("GetTotalChannels channelCount = %d\n", channelCount);
346-
return err;
347-
}
348315

349316
OSStatus CreateAggregateDevice(AudioDeviceID captureDeviceID, AudioDeviceID playbackDeviceID, int& sample_rate)
350317
{
@@ -1011,7 +978,6 @@ class TCoreAudioRenderer
1011978
:fAggregateDeviceID(-1),fAggregatePluginID(-1),
1012979
fDevNumInChans(0),fDevNumOutChans(0),
1013980
fPhysicalInputs(0), fPhysicalOutputs(0),
1014-
fDefaultPhysicalInputs(0), fDefaultPhysicalOutputs(0),
1015981
fInChannel(0),fOutChannel(0),
1016982
fBufferSize(0),fSampleRate(0),
1017983
fIsInJackDevice(false),
@@ -1028,7 +994,7 @@ class TCoreAudioRenderer
1028994

1029995
int GetBufferSize() {return fBufferSize;}
1030996
int GetSampleRate() {return fSampleRate;}
1031-
997+
1032998
static OSStatus RestartProc(AudioObjectID objectID, UInt32 numberAddresses,
1033999
const AudioObjectPropertyAddress inAddresses[],
10341000
void *clientData)
@@ -1227,13 +1193,14 @@ class TCoreAudioRenderer
12271193
goto error;
12281194
}
12291195
}
1230-
1196+
12311197
err = AudioUnitGetPropertyInfo(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 1, &outSize, &isWritable);
12321198
if (err != noErr) {
12331199
//printf("Error calling AudioUnitGetPropertyInfo - kAudioOutputUnitProperty_ChannelMap 1\n");
12341200
//printError(err);
12351201
} else {
12361202
fPhysicalInputs = outSize / sizeof(SInt32);
1203+
//printf("fPhysicalInputs = %ld\n", fPhysicalInputs);
12371204
}
12381205

12391206
err = AudioUnitGetPropertyInfo(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, &outSize, &isWritable);
@@ -1242,58 +1209,52 @@ class TCoreAudioRenderer
12421209
//printError(err);
12431210
} else {
12441211
fPhysicalOutputs = outSize / sizeof(SInt32);
1212+
//printf("fPhysicalOutputs = %ld\n", fPhysicalOutputs);
12451213
}
12461214

1247-
{
1215+
/*
1216+
Just ignore this case : seems to work without any further change...
1217+
1218+
if (outChan > fPhysicalOutputs) {
1219+
printf("This device hasn't required output channels\n");
1220+
goto error;
1221+
}
1222+
if (inChan > fPhysicalInputs) {
1223+
printf("This device hasn't required input channels\n");
1224+
goto error;
1225+
}
1226+
*/
1227+
1228+
if (inChan < fPhysicalInputs) {
12481229
SInt32 chanArr[fPhysicalInputs];
12491230
for (int i = 0; i < fPhysicalInputs; i++) {
12501231
chanArr[i] = -1;
12511232
}
1252-
1253-
//printf("fDefaultPhysicalInputs %d fPhysicalInputs %d\n", fDefaultPhysicalInputs, fPhysicalInputs);
1254-
1255-
/*
1256-
If aggregated device, default physical inputs to activate are placed at the begining of the channel list
1257-
The DSP channels will be accessed from 0
1258-
*/
1259-
int offset = 0;
12601233
for (int i = 0; i < inChan; i++) {
1261-
chanArr[offset++] = i;
1234+
chanArr[i] = i;
12621235
}
1263-
12641236
AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * fPhysicalInputs);
12651237
if (err != noErr) {
12661238
printf("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 1\n");
12671239
printError(err);
1268-
goto error;
12691240
}
12701241
}
1271-
1272-
{
1242+
1243+
if (outChan < fPhysicalOutputs) {
12731244
SInt32 chanArr[fPhysicalOutputs];
12741245
for (int i = 0; i < fPhysicalOutputs; i++) {
12751246
chanArr[i] = -1;
12761247
}
1277-
1278-
//printf("fDefaultPhysicalOutputs %d fPhysicalOutputs %d\n", fDefaultPhysicalOutputs, fPhysicalOutputs);
1279-
1280-
/*
1281-
If aggregated device, default physical outputs to activate are placed at the end of the channel list
1282-
The DSP channels will be accessed from offset
1283-
*/
1284-
int offset = fPhysicalOutputs - fDefaultPhysicalOutputs;
12851248
for (int i = 0; i < outChan; i++) {
1286-
chanArr[offset++] = i;
1249+
chanArr[i] = i;
12871250
}
1288-
12891251
err = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * fPhysicalOutputs);
12901252
if (err != noErr) {
12911253
printf("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap 0\n");
12921254
printError(err);
1293-
goto error;
12941255
}
12951256
}
1296-
1257+
12971258
if (inChan > 0) {
12981259
outSize = sizeof(AudioStreamBasicDescription);
12991260
err = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, &outSize);
@@ -1484,8 +1445,8 @@ class TCoreAudioRenderer
14841445
fDSP = DSP;
14851446
}
14861447

1487-
int GetNumInputs() { return fDefaultPhysicalInputs; }
1488-
int GetNumOutputs() { return fDefaultPhysicalOutputs; }
1448+
int GetNumInputs() { return fPhysicalInputs; }
1449+
int GetNumOutputs() { return fPhysicalOutputs; }
14891450

14901451
};
14911452

@@ -1506,7 +1467,7 @@ class coreaudio : public audio {
15061467
public:
15071468

15081469
coreaudio(int srate, int bsize) : fAudioDevice(this), fSampleRate(srate), fBufferSize(bsize) {}
1509-
coreaudio(int bsize) : fAudioDevice(this), fSampleRate(-1), fBufferSize(bsize) {}
1470+
coreaudio(int bsize) : fAudioDevice(this), fSampleRate(-1), fBufferSize(bsize) {}
15101471
virtual ~coreaudio() { fAudioDevice.Close(); }
15111472

15121473
virtual bool init(const char* /*name*/, dsp* DSP)
@@ -1529,12 +1490,12 @@ class coreaudio : public audio {
15291490
}
15301491
return true;
15311492
}
1532-
1533-
virtual void stop()
1493+
1494+
virtual void stop()
15341495
{
15351496
fAudioDevice.Stop();
15361497
}
1537-
1498+
15381499
virtual int getBufferSize() { return fAudioDevice.GetBufferSize(); }
15391500
virtual int getSampleRate() { return fAudioDevice.GetSampleRate(); }
15401501

build/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ file (GLOB FAUSTARCHS ${ARCHDIR}/*.cpp ${ARCHDIR}/*.c
336336
${ARCHDIR}/*.java ${ARCHDIR}/*.h
337337
${ARCHDIR}/mathdoctexts-*.txt ${ARCHDIR}/latexheader.tex)
338338
install (
339-
FILES ${FAUSTDSPLIBS} ${FAUSTARCHS} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust
339+
FILES ${FAUSTDSPLIBS} ${FAUSTARCHS} ${ROOT}/tools/faust2appls/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust
340340
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
341341
)
342342

@@ -358,12 +358,12 @@ install (
358358

359359
####################################
360360
# install ios lib
361-
#if (APPLE)
361+
if (NOT WIN32)
362362
install (
363363
FILES ${ARCHDIR}/ios-libsndfile.a DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
364364
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
365365
)
366-
#endif()
366+
endif()
367367

368368
####################################
369369
# install VS redistributables

build/MakePkg.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ IF NOT EXIST faust.sln (
77
)
88

99

10-
cmake -DUSE_LLVM_CONFIG=off -DPACK=on -C ../backends/most.cmake -C ../targets/most.cmake ..
10+
cmake -DUSE_LLVM_CONFIG=off -DPACK=on -C ../backends/most.cmake -C ../targets/windows.cmake ..
1111
cmake --build . --config Release -- /maxcpucount:4
1212
cpack -G NSIS64
1313
move Faust-*.exe ..

build/Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -197,23 +197,30 @@ package/README.html: ../README.md
197197
#===============================================================
198198
# release
199199
#===============================================================
200+
FAUSTLIVE ?=../../faustlive
200201
release: FAUSTGEN=../embedded/faustgen
202+
release: APATH=$(shell pwd)
201203
release:
202204
git pull --rebase
205+
@echo "################## Building faust package ###################"
203206
$(MAKE) cmake BACKENDS=all.cmake TARGETS=all.cmake
204207
$(MAKE) all
205208
$(MAKE) package
206209
@[ -d Release-$(VERSION) ] || mkdir Release-$(VERSION)
207210
rm -rf Release-$(VERSION)/*
208211
cp Faust-$(VERSION).dmg Release-$(VERSION)
209212
$(MAKE) install PREFIX=$(HOME)/Faust-$(VERSION)
213+
@echo "################## Building faustgen package ###################"
210214
$(MAKE) -C $(FAUSTGEN) clean
211215
$(MAKE) -C $(FAUSTGEN) FAUST=$(HOME)/Faust-$(VERSION)/bin/faust
212216
$(MAKE) -C $(FAUSTGEN) package
213217
cp $(FAUSTGEN)/package/*.dmg Release-$(VERSION)
218+
@echo "################## Building faust src distribution ###################"
214219
$(MAKE) -C .. dist
215220
mv ../faust-$(VERSION).tar.gz Release-$(VERSION)
216-
221+
@echo "################## Building faustlive package ###################"
222+
$(MAKE) -C $(FAUSTLIVE)/Build release FAUST=$(HOME)/Faust-$(VERSION)/bin/faust DEST=$(APATH)/Release-$(VERSION)
223+
217224

218225
#===============================================================
219226
# building universal binaries on macos

build/targets/windows.cmake

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# this file may be used to select different target
2+
# values are among ON or OFF
3+
4+
set ( INCLUDE_EXECUTABLE ON CACHE STRING "Include faust compiler" FORCE )
5+
set ( INCLUDE_STATIC ON CACHE STRING "Include static faust library" FORCE )
6+
set ( INCLUDE_DYNAMIC ON CACHE STRING "Include dynamic faust library" FORCE )
7+
8+
set ( INCLUDE_OSC ON CACHE STRING "Include Faust OSC static library" FORCE )
9+
set ( INCLUDE_HTTP ON CACHE STRING "Include Faust HTTPD library" FORCE )
10+
11+
set ( OSCDYNAMIC OFF CACHE STRING "Include Faust OSC dynamic library" FORCE )
12+
set ( HTTPDYNAMIC OFF CACHE STRING "Include Faust HTTP dynamic library" FORCE )
13+

compiler/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ Input options:
3333

3434
**-t** \<sec> **--timeout** \<sec> abort compilation after \<sec> seconds (default 120).
3535

36-
**-time** **--compilation-time** display compilation phases timing information.
37-
3836

3937
Output options:
4038
---------------------------------------
@@ -163,6 +161,8 @@ Debug options:
163161

164162
**-d** **--details** print compilation details.
165163

164+
**-time** **--compilation-time** display compilation phases timing information.
165+
166166
**-tg** **--task-graph** print the internal task graph in dot format.
167167

168168
**-sg** **--signal-graph** print the internal signal graph in dot format.

compiler/generator/text_instructions.hh

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TextInstVisitor : public InstVisitor {
8989
visitAux(inst, true);
9090
}
9191

92-
void visitAux(RetInst* inst, bool gen_empty)
92+
virtual void visitAux(RetInst* inst, bool gen_empty)
9393
{
9494
if (inst->fResult) {
9595
*fOut << "return ";
@@ -349,7 +349,7 @@ class TextInstVisitor : public InstVisitor {
349349
for (it = inst->fCode.begin(); it != inst->fCode.end(); it++) {
350350
// Special case for "return" as last instruction
351351
if ((*it == *inst->fCode.rbegin()) && (ret_inst = dynamic_cast<RetInst*>(*it))) {
352-
visitAux(ret_inst, false);
352+
visitAux(ret_inst, false);
353353
} else {
354354
(*it)->accept(this);
355355
}

compiler/generator/wasm/wast_instructions.hh

+4-2
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ class WASTInstVisitor : public TextInstVisitor, public WASInst {
126126
}
127127
}
128128
}
129-
130-
virtual void visit(RetInst* inst)
129+
130+
virtual void visitAux(RetInst* inst, bool gen_empty)
131131
{
132132
if (inst->fResult) {
133133
*fOut << "(return ";
134134
inst->fResult->accept(this);
135135
*fOut << ")";
136+
} else if (gen_empty) {
137+
*fOut << "(return)";
136138
}
137139
}
138140

compiler/libcode.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,7 @@ static void printHelp()
742742

743743
cout << tab << "-t <sec> --timeout <sec> abort compilation after <sec> seconds (default 120)."
744744
<< endl;
745-
cout << tab << "-time --compilation-time display compilation phases timing information." << endl;
746-
745+
747746
cout << endl << "Output options:" << line;
748747
cout << tab << "-o <file> the output file." << endl;
749748
cout << tab << "-e --export-dsp export expanded DSP (all included libraries)." << endl;
@@ -868,6 +867,7 @@ static void printHelp()
868867

869868
cout << endl << "Debug options:" << line;
870869
cout << tab << "-d --details print compilation details." << endl;
870+
cout << tab << "-time --compilation-time display compilation phases timing information." << endl;
871871
cout << tab << "-tg --task-graph print the internal task graph in dot format." << endl;
872872
cout << tab << "-sg --signal-graph print the internal signal graph in dot format." << endl;
873873
cout << tab << "-norm --normalized-form print signals in normalized form and exit." << endl;

documentation/man/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ Input options:
3333

3434
**-t** \<sec> **--timeout** \<sec> abort compilation after \<sec> seconds (default 120).
3535

36-
**-time** **--compilation-time** display compilation phases timing information.
37-
3836

3937
Output options:
4038
---------------------------------------
@@ -163,6 +161,8 @@ Debug options:
163161

164162
**-d** **--details** print compilation details.
165163

164+
**-time** **--compilation-time** display compilation phases timing information.
165+
166166
**-tg** **--task-graph** print the internal task graph in dot format.
167167

168168
**-sg** **--signal-graph** print the internal signal graph in dot format.

0 commit comments

Comments
 (0)