ProjectRenderer: added support for 24 Bit WAVs

Integrated patch by Skiessi which adds support for exporting 24 Bit WAV
files in LMMS.
This commit is contained in:
Tobias Doerffel
2009-04-05 16:02:27 +02:00
parent 7cb7bc1dcf
commit 1b91b599ba
4 changed files with 23 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
/*
* project_renderer.h - projectRenderer-class for easily rendering projects
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -43,6 +43,7 @@ public:
enum Depths
{
Depth_16Bit,
Depth_24Bit,
Depth_32Bit,
NumDepths
} ;

View File

@@ -4,7 +4,7 @@
* audio_file_wave.cpp - audio-device which encodes wave-stream and writes it
* into a WAVE-file. This is used for song-export.
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -72,6 +72,7 @@ bool audioFileWave::startEncoding( void )
switch( depth() )
{
case 32: m_si.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; break;
case 24: m_si.format = SF_FORMAT_WAV | SF_FORMAT_PCM_24; break;
case 16:
default: m_si.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; break;
}
@@ -86,7 +87,18 @@ void audioFileWave::writeBuffer( const surroundSampleFrame * _ab,
const fpp_t _frames,
const float _master_gain )
{
if( depth() == 32 )
if( depth() == 16 )
{
intSampleFrameA * buf = (intSampleFrameA *)
alignedMalloc(
sizeof( intSampleFrameA ) * _frames );
alignedConvertToS16( _ab, buf, _frames, _master_gain,
!isLittleEndian() );
sf_writef_short( m_sf, (int_sample_t *) buf, _frames );
alignedFree( buf );
}
else
{
float * buf = new float[_frames*channels()];
for( fpp_t frame = 0; frame < _frames; ++frame )
@@ -100,17 +112,6 @@ void audioFileWave::writeBuffer( const surroundSampleFrame * _ab,
sf_writef_float( m_sf, buf, _frames );
delete[] buf;
}
else
{
intSampleFrameA * buf = (intSampleFrameA *)
alignedMalloc(
sizeof( intSampleFrameA ) * _frames );
alignedConvertToS16( _ab, buf, _frames, _master_gain,
!isLittleEndian() );
sf_writef_short( m_sf, (int_sample_t *) buf, _frames );
alignedFree( buf );
}
}

View File

@@ -1,7 +1,7 @@
/*
* project_renderer.cpp - projectRenderer-class for easily rendering projects
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -84,7 +84,7 @@ projectRenderer::projectRenderer( const mixer::qualitySettings & _qs,
_os.samplerate, DEFAULT_CHANNELS, success_ful,
_out_file, _os.vbr,
_os.bitrate, _os.bitrate - 64, _os.bitrate + 64,
_os.depth == Depth_32Bit ? 32 : 16,
_os.depth == Depth_32Bit ? 32 : (Depth_24Bit ? 24 : 16),
engine::getMixer() );
if( success_ful == FALSE )
{

View File

@@ -149,6 +149,11 @@
<string>16 Bit Integer</string>
</property>
</item>
<item>
<property name="text" >
<string>24 Bit Integer</string>
</property>
</item>
<item>
<property name="text" >
<string>32 Bit Float</string>