mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-29 04:21:03 +08:00
@@ -171,10 +171,13 @@ int SDL_GetDefaultSampleFramesFromFreq(const int freq)
|
|||||||
|
|
||||||
int *SDL_ChannelMapDup(const int *origchmap, int channels)
|
int *SDL_ChannelMapDup(const int *origchmap, int channels)
|
||||||
{
|
{
|
||||||
const size_t chmaplen = sizeof (*origchmap) * channels;
|
int *chmap = NULL;
|
||||||
int *chmap = (int *)SDL_malloc(chmaplen);
|
if ((channels > 0) && origchmap) {
|
||||||
if (chmap) {
|
const size_t chmaplen = sizeof (*origchmap) * channels;
|
||||||
SDL_memcpy(chmap, origchmap, chmaplen);
|
chmap = (int *)SDL_malloc(chmaplen);
|
||||||
|
if (chmap) {
|
||||||
|
SDL_memcpy(chmap, origchmap, chmaplen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return chmap;
|
return chmap;
|
||||||
}
|
}
|
||||||
@@ -1617,9 +1620,7 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count)
|
|||||||
SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
|
SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
|
||||||
if (device) {
|
if (device) {
|
||||||
channels = device->spec.channels;
|
channels = device->spec.channels;
|
||||||
if (channels > 0 && device->chmap) {
|
result = SDL_ChannelMapDup(device->chmap, channels);
|
||||||
result = SDL_ChannelMapDup(device->chmap, channels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ReleaseAudioDevice(device);
|
ReleaseAudioDevice(device);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user