-
Notifications
You must be signed in to change notification settings - Fork 54
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
moved source buffer struct member to local var in converter callback … #2
Open
AlexanderBollbach
wants to merge
1
commit into
abbood:master
Choose a base branch
from
AlexanderBollbach:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+14.6 KB
...oject.xcworkspace/xcuserdata/alexanderbollbach.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
91 changes: 91 additions & 0 deletions
91
...xcodeproj/xcuserdata/alexanderbollbach.xcuserdatad/xcschemes/CH06_AudioConverter.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0710" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "011C4AA114A505C300A35D5F" | ||
BuildableName = "CH06_AudioConverter" | ||
BlueprintName = "CH06_AudioConverter" | ||
ReferencedContainer = "container:CH06_AudioConverter.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "011C4AA114A505C300A35D5F" | ||
BuildableName = "CH06_AudioConverter" | ||
BlueprintName = "CH06_AudioConverter" | ||
ReferencedContainer = "container:CH06_AudioConverter.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "011C4AA114A505C300A35D5F" | ||
BuildableName = "CH06_AudioConverter" | ||
BlueprintName = "CH06_AudioConverter" | ||
ReferencedContainer = "container:CH06_AudioConverter.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "011C4AA114A505C300A35D5F" | ||
BuildableName = "CH06_AudioConverter" | ||
BlueprintName = "CH06_AudioConverter" | ||
ReferencedContainer = "container:CH06_AudioConverter.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
22 changes: 22 additions & 0 deletions
22
...ter.xcodeproj/xcuserdata/alexanderbollbach.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>CH06_AudioConverter.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>011C4AA114A505C300A35D5F</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
#endif | ||
|
||
|
||
#define kInputFileLocation CFSTR("/Insert/Path/To/Audio/File.xxx") | ||
#define kInputFileLocation CFSTR("/Users/alexanderbollbach/Desktop/qt.m4a") | ||
// #define kInputFileLocation CFSTR("/Users/kevin/Desktop/tmp_storage/audio_tests/cdsd_scratch.aiff") | ||
// #define kInputFileLocation CFSTR("/Volumes/Sephiroth/Tunes//菅野よう子/ESCAFLOWNE - ORIGINAL MOVIE SOUNDTRACK/We're flying.m4a") | ||
|
||
|
@@ -24,7 +24,7 @@ typedef struct MyAudioConverterSettings | |
AudioStreamPacketDescription *inputFilePacketDescriptions; // array of packet descriptions for read buffer | ||
|
||
// KEVIN: sourceBuffer is never used outside of the callback. why couldn't it be a local there? | ||
void *sourceBuffer; | ||
|
||
|
||
} MyAudioConverterSettings; | ||
|
||
|
@@ -68,7 +68,9 @@ OSStatus MyAudioConverterCallback(AudioConverterRef inAudioConverter, | |
AudioStreamPacketDescription **outDataPacketDescription, | ||
void *inUserData) | ||
{ | ||
MyAudioConverterSettings *audioConverterSettings = (MyAudioConverterSettings *)inUserData; | ||
void *sourceBuffer = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C convention is to use |
||
|
||
MyAudioConverterSettings *audioConverterSettings = (MyAudioConverterSettings *)inUserData; | ||
|
||
// initialize in case of failure | ||
ioData->mBuffers[0].mData = NULL; | ||
|
@@ -81,13 +83,13 @@ OSStatus MyAudioConverterCallback(AudioConverterRef inAudioConverter, | |
if(*ioDataPacketCount == 0) | ||
return noErr; | ||
|
||
if (audioConverterSettings->sourceBuffer != NULL) | ||
if (sourceBuffer != NULL) | ||
{ | ||
free(audioConverterSettings->sourceBuffer); | ||
audioConverterSettings->sourceBuffer = NULL; | ||
free(sourceBuffer); | ||
sourceBuffer = NULL; | ||
} | ||
|
||
audioConverterSettings->sourceBuffer = (void *)calloc(1, *ioDataPacketCount * audioConverterSettings->inputFilePacketMaxSize); | ||
sourceBuffer = (void *)calloc(1, *ioDataPacketCount * audioConverterSettings->inputFilePacketMaxSize); | ||
|
||
UInt32 outByteCount = 0; | ||
OSStatus result = AudioFileReadPackets(audioConverterSettings->inputFile, | ||
|
@@ -96,7 +98,7 @@ OSStatus MyAudioConverterCallback(AudioConverterRef inAudioConverter, | |
audioConverterSettings->inputFilePacketDescriptions, | ||
audioConverterSettings->inputFilePacketIndex, | ||
ioDataPacketCount, | ||
audioConverterSettings->sourceBuffer); | ||
sourceBuffer); | ||
|
||
// it's not an error if we just read the remainder of the file | ||
#ifdef MAC_OS_X_VERSION_10_7 | ||
|
@@ -120,7 +122,7 @@ OSStatus MyAudioConverterCallback(AudioConverterRef inAudioConverter, | |
} | ||
*/ | ||
// chris' hacky asssume-one-buffer equivalent | ||
ioData->mBuffers[0].mData = audioConverterSettings->sourceBuffer; | ||
ioData->mBuffers[0].mData = sourceBuffer; | ||
ioData->mBuffers[0].mDataByteSize = outByteCount; | ||
|
||
if (outDataPacketDescription) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should revert this back to the generic path
/Insert/Path/To/Audio/File.xxx
, since other users won't have analexanderbollbach
directory, and it's better for them to blow up on a self-explanatory problem if they forget to reset thekInputFileLocation
.