|
|
|
@ -1,16 +1,16 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Copyright (c) 2019, Dimitri Diakopoulos All rights reserved.
|
|
|
|
Copyright (c) 2019, Dimitri Diakopoulos All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
@ -37,6 +37,7 @@ using namespace nqr;
|
|
|
|
#include "minimp3/minimp3.h"
|
|
|
|
#include "minimp3/minimp3.h"
|
|
|
|
#include "minimp3/minimp3_ex.h"
|
|
|
|
#include "minimp3/minimp3_ex.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
|
|
|
|
void mp3_decode_internal(AudioData * d, const std::vector<uint8_t> & fileData)
|
|
|
|
void mp3_decode_internal(AudioData * d, const std::vector<uint8_t> & fileData)
|
|
|
|
@ -55,7 +56,7 @@ void mp3_decode_internal(AudioData * d, const std::vector<uint8_t> & fileData)
|
|
|
|
d->samples.resize(info.samples);
|
|
|
|
d->samples.resize(info.samples);
|
|
|
|
std::memcpy(d->samples.data(), info.buffer, sizeof(float) * info.samples);
|
|
|
|
std::memcpy(d->samples.data(), info.buffer, sizeof(float) * info.samples);
|
|
|
|
|
|
|
|
|
|
|
|
delete info.buffer;
|
|
|
|
std::free(info.buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
//////////////////////
|
|
|
|
|