Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS sound support 2 #1865

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from 104 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
d9abe62
iOS sound support. opus lib modified because of "Compile sources as" …
ngocdh Apr 13, 2021
1c90af9
resolving merge
ngocdh Apr 14, 2021
60fcdef
BOOL -> bool
ngocdh Apr 14, 2021
9b9474f
Android built-in mic / external device
ngocdh Apr 14, 2021
ed1e28e
Update sound.h
ngocdh Apr 14, 2021
4c4eb56
Update sound.cpp
ngocdh Apr 14, 2021
444a820
Update clientdlg.cpp
ngocdh Apr 14, 2021
36e7232
Update sound.cpp
ngocdh Apr 14, 2021
4eaf3de
Update sound.cpp
ngocdh Apr 14, 2021
7660feb
Update clientdlg.cpp
ngocdh Apr 14, 2021
6e4d23e
Update clientsettingsdlg.cpp
ngocdh Apr 14, 2021
e88bf3b
Update client.cpp
ngocdh Apr 14, 2021
5d5b757
Update client.cpp
ngocdh Apr 14, 2021
c7b9cac
Update clientdlg.cpp
ngocdh Apr 14, 2021
84c49dd
Update clientsettingsdlg.cpp
ngocdh Apr 14, 2021
6fc18e2
Update chatdlg.cpp
ngocdh Apr 14, 2021
99c5e58
Update clientdlg.cpp
ngocdh Apr 14, 2021
f36b806
Update chatdlg.cpp
ngocdh Apr 14, 2021
9ab1fa7
Update clientsettingsdlg.cpp
ngocdh Apr 14, 2021
d7d0611
Update clientdlg.h
ngocdh Apr 15, 2021
6e436c4
Update client.cpp
ngocdh Apr 15, 2021
4d16da0
Update sound.cpp
ngocdh Apr 15, 2021
133feb8
Update sound.cpp
ngocdh Apr 15, 2021
4ad5680
Update sound.h
ngocdh Apr 15, 2021
16f2284
Update sound.cpp
ngocdh Apr 15, 2021
ef748a7
Update clientdlg.cpp
ngocdh Apr 15, 2021
4d189e7
Update client.h
ngocdh Apr 15, 2021
f853767
Update sound.cpp
ngocdh Apr 15, 2021
68f7881
Update sound.h
ngocdh Apr 15, 2021
e5f4372
Update clientdlg.cpp
ngocdh Apr 15, 2021
faf9fb2
Update sound.h
ngocdh Apr 15, 2021
45e217c
Update sound.h
ngocdh Apr 15, 2021
108c6ab
Update sound.h
ngocdh Apr 15, 2021
3adc7f8
Update sound.h
ngocdh Apr 15, 2021
bced568
Update clientdlg.cpp
ngocdh Apr 15, 2021
055fbe3
Update client.h
ngocdh Apr 15, 2021
3167c95
Update sound.cpp
ngocdh Apr 15, 2021
3b5c530
Update sound.cpp
ngocdh Apr 15, 2021
4c4de4d
Update sound.cpp
ngocdh Apr 15, 2021
55dfa4c
test device 9
ngocdh Apr 15, 2021
64bf820
android build only
ngocdh Apr 15, 2021
b918af5
Revert changes in opus, remove Foundation.h, remove unused BOOL. Add …
ngocdh Apr 16, 2021
2eb2754
Merge remote-tracking branch 'refs/remotes/origin/master'
ngocdh Apr 16, 2021
022a004
Revert "android build only"
ngocdh Apr 16, 2021
726060a
resolving conflict in src/clientdlg.h (add SendTabChange)
ngocdh Apr 16, 2021
75bf59c
Merge remote-tracking branch 'refs/remotes/truemaster/master'
ngocdh Apr 16, 2021
d526b1b
trying setAudioApi AAudio
ngocdh Apr 19, 2021
8877002
Update sound.cpp
ngocdh Apr 19, 2021
6d2a71e
dev 9 aaudio
ngocdh Apr 19, 2021
b6b2ebf
Update sound.cpp
ngocdh Apr 20, 2021
27ffe92
check getDeviceId() instead of oboe::Result::OK
ngocdh Apr 20, 2021
6ee7197
AAudio 7 only when builtinmic=true
ngocdh Apr 20, 2021
0465a5d
dev 20 for google pixel 5
ngocdh Apr 20, 2021
2517706
Merge pull request #2 from ngocdh/master
ngocdh Apr 20, 2021
b7f8b3d
Add input device id text box
ngocdh Apr 20, 2021
9c2d4ab
void OnBuiltInMicIdChanged();
ngocdh Apr 20, 2021
56ac5e3
edtBuiltInMicId and OnBuiltInMicIdChanged
ngocdh Apr 20, 2021
8556f81
iBuiltInMicId
ngocdh Apr 20, 2021
284518f
SetInputDeviceId iBuiltInMicId
ngocdh Apr 20, 2021
3bcdba8
iBuiltInMicId - SetInputDeviceId ( const int deviceid )
ngocdh Apr 20, 2021
81ee2d5
SetInputDeviceId ( int deviceid );
ngocdh Apr 20, 2021
742e7a1
void CSound::SetInputDeviceId ( int deviceid )
ngocdh Apr 20, 2021
5726ecb
SetInputDeviceId( int deviceid );
ngocdh Apr 20, 2021
7fdb2d6
Update sound.mm
ngocdh Apr 20, 2021
0846c5b
setBuiltinMic unsetBuiltinMic
ngocdh Apr 20, 2021
ea4614e
auto dev
ngocdh Apr 20, 2021
f2d3302
Update sound.h
ngocdh Apr 20, 2021
9e3a60a
SetInputDeviceId ( int deviceid );
ngocdh Apr 20, 2021
1372fb6
revert change (committed by error)
ngocdh Apr 20, 2021
94961b3
Merge branch 'master' into mobile-builtinmic
ngocdh Apr 20, 2021
e76929c
remove SetBuiltinMic
ngocdh Apr 20, 2021
7527ade
SetBuiltInMicId GetBuiltInMicId
ngocdh Apr 20, 2021
1dc63a0
GetBuiltInMicId instead of direct access
ngocdh Apr 20, 2021
83311ab
pClient->SetBuiltInMicId
ngocdh Apr 20, 2021
5e2dbb2
close menu action
ngocdh Apr 20, 2021
276ae3b
Device id text box for Android only
ngocdh Apr 20, 2021
dd29299
different close menu for ios and android
ngocdh Apr 20, 2021
2daaf6a
experimental textbox for Built-in Mic deviceid input - Android only (…
ngocdh Apr 22, 2021
e26aa4a
Merge remote-tracking branch 'refs/remotes/truemaster/master'
ngocdh May 19, 2021
4ca2e30
Client.cpp: iOS 4 sound inits down to 1 <- reduce launch time
ngocdh May 19, 2021
3cbb2c4
iOS: Sound inits down to 1 from 36
ngocdh May 20, 2021
ab49a72
Sound inits back to 9 times (not 9*4=36) until a way to check if app …
ngocdh May 20, 2021
474e0b8
Remove unused libs to speed up launch
ngocdh May 26, 2021
92010f5
iOS: remove unused libs
ngocdh May 26, 2021
eea2908
autobuild: +x bit for mac or else check will fail
ngocdh May 26, 2021
4d61784
autobuild mac artifacts +x
ngocdh May 26, 2021
c5edb9d
Fix connect button crash
ngocdh Jun 6, 2021
cc13fc6
really fix connect crash?
ngocdh Jun 7, 2021
cb53bea
connect crash
ngocdh Jun 7, 2021
114460e
Temporary crash fix, TODO: reopen socket when SIGPIPE
ngocdh Jun 7, 2021
99a6230
Fix iOS return-from-idle crash: reopen socket
ngocdh Jun 7, 2021
ab02049
Merge master into master
ngocdh Jun 12, 2021
b1a5b51
update as requested
ngocdh Jun 12, 2021
73c677f
remove qm changes and add ngocdh as contributor in about
ngocdh Jun 12, 2021
775730b
Merge branch 'iossound2'
ngocdh Jun 12, 2021
afe07aa
style
ngocdh Jun 12, 2021
37526fa
Merge branch 'master' into ngocdhmaster2
ngocdh Jun 12, 2021
c898634
removed unwanted directory
ngocdh Jun 12, 2021
88fb1f9
remove unwanted file
ngocdh Jun 12, 2021
b008230
clang
ngocdh Jun 13, 2021
c137b72
style
ngocdh Jun 13, 2021
4987fbd
style
ngocdh Jun 13, 2021
0b1ec5a
style
ngocdh Jun 13, 2021
86f82ac
style
ngocdh Jun 13, 2021
89ead4f
Merge remote-tracking branch 'refs/remotes/origin/ngocdhmaster2'
ngocdh Jun 13, 2021
22931c5
style
ngocdh Jun 13, 2021
45d854c
Merge remote-tracking branch 'refs/remotes/origin/ngocdhmaster2'
ngocdh Jun 13, 2021
4de56d2
clang-format -style=file -i *
ngocdh Jun 13, 2021
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
8 changes: 2 additions & 6 deletions Jamulus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,8 @@ win32 {
OBJECTIVE_SOURCES += ios/sound.mm
QMAKE_TARGET_BUNDLE_PREFIX = com.jamulussoftware.jamulus
QMAKE_APPLICATION_BUNDLE_NAME. = $$TARGET
LIBS += -framework CoreFoundation \
-framework CoreServices \
-framework AVFoundation \
-framework CoreMIDI \
-framework AudioToolbox \
-framework Foundation
LIBS += -framework AVFoundation \
-framework AudioToolbox
} else:android {
# we want to compile with C++14
CONFIG += c++14
Expand Down
33 changes: 33 additions & 0 deletions android/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,36 @@ void CSound::Stats::log() const
<< "frames_in: " << frames_in << ",frames_out: " << frames_out << ",frames_filled_out: " << frames_filled_out
<< ",in_callback_calls: " << in_callback_calls << ",out_callback_calls: " << out_callback_calls << ",ring_overrun: " << ring_overrun;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this android file changing in an iOS change?

void CSound::SetInputDeviceId ( int deviceid ) // 0 for external device (auto to be exact)
{
closeStream ( mRecordingStream );

oboe::AudioStreamBuilder inBuilder;

// Setup input stream
inBuilder.setDirection ( oboe::Direction::Input );

// Only set callback for the input direction
// the output will be handled writing directly on the stream
inBuilder.setCallback ( this );
setupCommonStreamParams ( &inBuilder );

if ( inBuilder.isAAudioSupported() )
inBuilder.setAudioApi ( oboe::AudioApi::AAudio );

inBuilder.setDeviceId ( deviceid );
oboe::Result result = inBuilder.openManagedStream ( mRecordingStream );
if ( result != oboe::Result::OK )
{
inBuilder.setDeviceId ( oboe::kUnspecified );
result = inBuilder.openManagedStream ( mRecordingStream );
}

mRecordingStream->setBufferSizeInFrames ( iOboeBufferSizeStereo );

warnIfNotLowLatency ( mRecordingStream, "RecordStream" );
printStreamDetails ( mRecordingStream );

mRecordingStream->requestStart();
}
1 change: 1 addition & 0 deletions android/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class CSound : public CSoundBase, public oboe::AudioStreamCallback
virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start();
virtual void Stop();
virtual void SetInputDeviceId ( int deviceid );

// Call backs for Oboe
virtual oboe::DataCallbackResult onAudioReady ( oboe::AudioStream* oboeStream, void* audioData, int32_t numFrames );
Expand Down
Empty file modified distributions/raspijamulus.sh
100755 → 100644
Empty file.
12 changes: 11 additions & 1 deletion ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -29,19 +33,25 @@
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UILaunchScreen</key>
<dict/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down
59 changes: 7 additions & 52 deletions ios/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2004-2020
*
* Author(s):
* ann0see based on code from Volker Fischer
* ann0see and ngocdh based on code from Volker Fischer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the copyright date could do with updating.

*
******************************************************************************
*
Expand All @@ -23,13 +23,12 @@
\******************************************************************************/

#pragma once
#include <CoreMIDI/CoreMIDI.h>
#include <QMutex>
#include <QMessageBox>
#include "soundbase.h"
#include "global.h"

/* Classes ********************************************************************/
#import <AudioToolbox/AudioToolbox.h>

class CSound : public CSoundBase
{
Q_OBJECT
Expand All @@ -44,64 +43,20 @@ class CSound : public CSoundBase
virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start();
virtual void Stop();
virtual void processBufferList ( AudioBufferList*, CSound* );
virtual void SetInputDeviceId ( int deviceid );

// channel selection
virtual int GetNumInputChannels() { return iNumInChanPlusAddChan; }
virtual QString GetInputChannelName ( const int iDiD ) { return sChannelNamesInput[iDiD]; }
virtual void SetLeftInputChannel ( const int iNewChan );
virtual void SetRightInputChannel ( const int iNewChan );
virtual int GetLeftInputChannel() { return iSelInputLeftChannel; }
virtual int GetRightInputChannel() { return iSelInputRightChannel; }

virtual int GetNumOutputChannels() { return iNumOutChan; }
virtual QString GetOutputChannelName ( const int iDiD ) { return sChannelNamesOutput[iDiD]; }
virtual void SetLeftOutputChannel ( const int iNewChan );
virtual void SetRightOutputChannel ( const int iNewChan );
virtual int GetLeftOutputChannel() { return iSelOutputLeftChannel; }
virtual int GetRightOutputChannel() { return iSelOutputRightChannel; }
AudioUnit audioUnit;

// these variables/functions should be protected but cannot since we want
// to access them from the callback function
CVector<short> vecsTmpAudioSndCrdStereo;
int iCoreAudioBufferSizeMono;
int iCoreAudioBufferSizeStereo;
long lCurDev;
int iNumInChan;
int iNumInChanPlusAddChan; // includes additional "added" channels
int iNumOutChan;
int iSelInputLeftChannel;
int iSelInputRightChannel;
int iSelOutputLeftChannel;
int iSelOutputRightChannel;
int iSelInBufferLeft;
int iSelInBufferRight;
int iSelInInterlChLeft;
int iSelInInterlChRight;
int iSelAddInBufferLeft;
int iSelAddInBufferRight;
int iSelAddInInterlChLeft;
int iSelAddInInterlChRight;
int iSelOutBufferLeft;
int iSelOutBufferRight;
int iSelOutInterlChLeft;
int iSelOutInterlChRight;
CVector<int> vecNumInBufChan;
CVector<int> vecNumOutBufChan;
bool isInitialized;

protected:
virtual QString LoadAndInitializeDriver ( QString strDriverName, bool );

QString CheckDeviceCapabilities ( const int iDriverIdx );
void GetAvailableInOutDevices();

static void callbackMIDI ( const MIDIPacketList* pktlist, void* refCon, void* );

// AVAudioSession audioSession;

MIDIPortRef midiInPortRef;

QString sChannelNamesInput[MAX_NUM_IN_OUT_CHANNELS];
QString sChannelNamesOutput[MAX_NUM_IN_OUT_CHANNELS];

QMutex Mutex;
};
Loading