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

Use System.arrayCopy #6

Merged
merged 1 commit into from
Dec 11, 2015
Merged
Changes from all commits
Commits
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
11 changes: 3 additions & 8 deletions Sonic.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ private short[] resize(
newLength *= numChannels;
short[] newArray = new short[newLength];
int length = oldArray.length <= newLength? oldArray.length : newLength;


for(int x = 0; x < length; x++) {
newArray[x] = oldArray[x];
}

System.arraycopy(oldArray, 0, newArray, 0, length);
return newArray;
}

Expand All @@ -68,9 +65,7 @@ private void move(
int sourcePos,
int numSamples)
{
for(int xSample = 0; xSample < numSamples*numChannels; xSample++) {
dest[destPos*numChannels + xSample] = source[sourcePos*numChannels + xSample];
}
System.arraycopy(source, sourcePos*numChannels, dest, destPos*numChannels, numSamples*numChannels);
}

// Scale the samples by the factor.
Expand Down