mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Android: Fixed some compiler warnings when compiling with Oboe enabled
This commit is contained in:
parent
baebb9d1b5
commit
6c4224d05a
2 changed files with 24 additions and 16 deletions
|
|
@ -169,7 +169,10 @@
|
|||
#error "Oboe cannot be enabled at the same time as openSL! Please disable JUCE_USE_ANDROID_OPENSLES"
|
||||
#endif
|
||||
|
||||
#include <oboe/Oboe.h>
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <oboe/Oboe.h>
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -511,8 +511,8 @@ private:
|
|||
void open (int deviceId, oboe::Direction direction,
|
||||
oboe::SharingMode sharingMode,
|
||||
int channelCount, oboe::AudioFormat format,
|
||||
int32 sampleRate, int32 bufferSize,
|
||||
oboe::AudioStreamCallback* callback = nullptr)
|
||||
int32 newSampleRate, int32 newBufferSize,
|
||||
oboe::AudioStreamCallback* newCallback = nullptr)
|
||||
{
|
||||
oboe::DefaultStreamValues::FramesPerBurst = getDefaultFramesPerBurst();
|
||||
|
||||
|
|
@ -526,9 +526,9 @@ private:
|
|||
builder.setSharingMode (sharingMode);
|
||||
builder.setChannelCount (channelCount);
|
||||
builder.setFormat (format);
|
||||
builder.setSampleRate (sampleRate);
|
||||
builder.setSampleRate (newSampleRate);
|
||||
builder.setPerformanceMode (oboe::PerformanceMode::LowLatency);
|
||||
builder.setCallback (callback);
|
||||
builder.setCallback (newCallback);
|
||||
|
||||
JUCE_OBOE_LOG (String ("Preparing Oboe stream with params:")
|
||||
+ "\nAAudio supported = " + String (int (builder.isAAudioSupported()))
|
||||
|
|
@ -538,17 +538,17 @@ private:
|
|||
+ "\nSharingMode = " + getOboeString (sharingMode)
|
||||
+ "\nChannelCount = " + String (channelCount)
|
||||
+ "\nFormat = " + getOboeString (format)
|
||||
+ "\nSampleRate = " + String (sampleRate)
|
||||
+ "\nSampleRate = " + String (newSampleRate)
|
||||
+ "\nPerformanceMode = " + getOboeString (oboe::PerformanceMode::LowLatency));
|
||||
|
||||
openResult = builder.openStream (&stream);
|
||||
JUCE_OBOE_LOG ("Building Oboe stream with result: " + getOboeString (openResult)
|
||||
+ "\nStream state = " + (stream != nullptr ? getOboeString (stream->getState()) : String ("?")));
|
||||
|
||||
if (stream != nullptr && bufferSize != 0)
|
||||
if (stream != nullptr && newBufferSize != 0)
|
||||
{
|
||||
JUCE_OBOE_LOG ("Setting the bufferSizeInFrames to " + String (bufferSize));
|
||||
stream->setBufferSizeInFrames (bufferSize);
|
||||
JUCE_OBOE_LOG ("Setting the bufferSizeInFrames to " + String (newBufferSize));
|
||||
stream->setBufferSizeInFrames (newBufferSize);
|
||||
}
|
||||
|
||||
JUCE_OBOE_LOG (String ("Stream details:")
|
||||
|
|
@ -573,6 +573,7 @@ private:
|
|||
if (stream != nullptr)
|
||||
{
|
||||
oboe::Result result = stream->close();
|
||||
ignoreUnused (result);
|
||||
JUCE_OBOE_LOG ("Requested Oboe stream close with result: " + getOboeString (result));
|
||||
}
|
||||
}
|
||||
|
|
@ -665,16 +666,16 @@ private:
|
|||
}
|
||||
|
||||
// Not strictly required as these should not change, but recommended by Google anyway
|
||||
void checkStreamSetup (OboeStream* stream, int deviceId, int numChannels, int sampleRate,
|
||||
int bufferSize, oboe::AudioFormat format)
|
||||
void checkStreamSetup (OboeStream* stream, int deviceId, int numChannels, int expectedSampleRate,
|
||||
int expectedBufferSize, oboe::AudioFormat format)
|
||||
{
|
||||
if (auto* nativeStream = stream != nullptr ? stream->getNativeStream() : nullptr)
|
||||
{
|
||||
ignoreUnused (deviceId, numChannels, sampleRate, bufferSize);
|
||||
ignoreUnused (deviceId, numChannels, sampleRate, expectedBufferSize);
|
||||
ignoreUnused (streamFormat, bitDepth);
|
||||
|
||||
jassert (numChannels == nativeStream->getChannelCount());
|
||||
jassert (sampleRate == 0 || sampleRate == nativeStream->getSampleRate());
|
||||
jassert (expectedSampleRate == 0 || expectedSampleRate == nativeStream->getSampleRate());
|
||||
jassert (format == nativeStream->getFormat());
|
||||
}
|
||||
}
|
||||
|
|
@ -874,9 +875,7 @@ private:
|
|||
const int64_t appFrameIndex = isOutput ? nativeStream.getFramesWritten() : nativeStream.getFramesRead();
|
||||
|
||||
// Assume that the next frame will be processed at the current time
|
||||
using namespace std::chrono;
|
||||
int64_t appFrameAppTime = getCurrentTimeNanos();//duration_cast<nanoseconds> (steady_clock::now().time_since_epoch()).count();
|
||||
int64_t appFrameAppTime2 = duration_cast<nanoseconds> (steady_clock::now().time_since_epoch()).count();
|
||||
int64_t appFrameAppTime = getCurrentTimeNanos();
|
||||
|
||||
// Calculate the number of frames between app and hardware
|
||||
int64_t frameIndexDelta = appFrameIndex - hardwareFrameIndex;
|
||||
|
|
@ -903,6 +902,8 @@ private:
|
|||
|
||||
void onErrorBeforeClose (oboe::AudioStream* stream, oboe::Result error) override
|
||||
{
|
||||
ignoreUnused (error);
|
||||
|
||||
// only output stream should be the master stream receiving callbacks
|
||||
jassert (stream->getDirection() == oboe::Direction::Output);
|
||||
|
||||
|
|
@ -1202,6 +1203,8 @@ public:
|
|||
|
||||
for (auto& device : inputDevices)
|
||||
{
|
||||
ignoreUnused (device);
|
||||
|
||||
JUCE_OBOE_LOG ("name = " << device.name);
|
||||
JUCE_OBOE_LOG ("id = " << String (device.id));
|
||||
JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size()));
|
||||
|
|
@ -1212,6 +1215,8 @@ public:
|
|||
|
||||
for (auto& device : outputDevices)
|
||||
{
|
||||
ignoreUnused (device);
|
||||
|
||||
JUCE_OBOE_LOG ("name = " << device.name);
|
||||
JUCE_OBOE_LOG ("id = " << String (device.id));
|
||||
JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue