Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
233ee37d
Commit
233ee37d
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#3757] Resample ringtone data
parent
3b20c2b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sflphone-common/src/audio/sound/audiofile.cpp
+16
-4
16 additions, 4 deletions
sflphone-common/src/audio/sound/audiofile.cpp
sflphone-common/src/audio/sound/audiofile.h
+2
-2
2 additions, 2 deletions
sflphone-common/src/audio/sound/audiofile.h
with
18 additions
and
6 deletions
sflphone-common/src/audio/sound/audiofile.cpp
+
16
−
4
View file @
233ee37d
...
...
@@ -33,6 +33,7 @@
*/
#include
"audiofile.h"
#include
"audio/codecs/codecDescriptor.h"
#include
"audio/samplerateconverter.h"
#include
<fstream>
#include
<math.h>
#include
<samplerate.h>
...
...
@@ -196,10 +197,10 @@ WaveFile::~WaveFile()
bool
WaveFile
::
openFile
(
const
std
::
string
&
fileName
)
bool
WaveFile
::
openFile
(
const
std
::
string
&
fileName
,
int
audioSamplingRate
)
{
if
(
isFileExist
(
fileName
))
{
openExistingWaveFile
(
fileName
);
openExistingWaveFile
(
fileName
,
audioSamplingRate
);
}
return
true
;
...
...
@@ -244,9 +245,11 @@ bool WaveFile::isFileOpened()
}
bool
WaveFile
::
openExistingWaveFile
(
const
std
::
string
&
fileName
)
bool
WaveFile
::
openExistingWaveFile
(
const
std
::
string
&
fileName
,
int
audioSamplingRate
)
{
SamplerateConverter
_converter
;
_debug
(
"WaveFile: Opening %s"
,
fileName
.
c_str
());
_file_stream
.
open
(
fileName
.
c_str
(),
std
::
ios
::
in
|
std
::
ios
::
binary
);
...
...
@@ -365,6 +368,12 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName)
_debug
(
"WaveFile: data size in frame %ld"
,
_file_size
);
SFLDataFormat
*
tempBuffer
=
new
SFLDataFormat
[
_file_size
];
SFLDataFormat
*
tempBufferRsmpl
=
new
SFLDataFormat
[
_file_size
];
// int nbSample = _converter.upsampleData ( tempBuffer, tempBufferRsmpl, audioSamplingRate, srate, nb_sample_down);
// Init audio loop buffer info
_buffer
=
new
SFLDataFormat
[
_file_size
];
_size
=
_file_size
;
...
...
@@ -375,6 +384,9 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName)
_debug
(
"WaveFile: file successfully opened"
);
delete
[]
tempBuffer
;
delete
[]
tempBufferRsmpl
;
return
true
;
}
...
...
@@ -383,7 +395,7 @@ bool WaveFile::openExistingWaveFile (const std::string& fileName)
bool
WaveFile
::
loadFile
(
const
std
::
string
&
filename
,
AudioCodec
*
codec
,
unsigned
int
sampleRate
)
{
openFile
(
filename
);
openFile
(
filename
,
sampleRate
);
return
true
;
}
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/sound/audiofile.h
+
2
−
2
View file @
233ee37d
...
...
@@ -140,7 +140,7 @@ class WaveFile : public AudioFile
~
WaveFile
();
bool
openFile
(
const
std
::
string
&
fileName
);
bool
openFile
(
const
std
::
string
&
fileName
,
int
audioSamplingRate
);
bool
closeFile
();
...
...
@@ -161,7 +161,7 @@ class WaveFile : public AudioFile
bool
setWaveFile
();
bool
openExistingWaveFile
(
const
std
::
string
&
fileName
);
bool
openExistingWaveFile
(
const
std
::
string
&
fileName
,
int
audioSamplingRate
);
SOUND_FORMAT
_snd_format
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment