2015-08-29 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDAudioConvert::Stage3Pcm24()' method in
	'lib/rdaudioconvert.cpp' and 'lib/rdaudioconvert.h'.
	* Added a 'Format::Pcm24' value to the 'RDSettings::Format'
	enumeration in 'lib/rdsettings.h'.
	* Modified the 'RDAudioConvert' class to support generating PCM24
	output in 'lib/rdaudioconvert.cpp' and 'lib/rdaudioconvert.h'.
	* Modified the 'RDPlayStream' class to support playing PCM24
	data in 'rdhpi/rdplaystream.cpp'.
	* Modified the 'RDRecordStream' class to support capturing PCM24
	data in 'rdhpi/rdrecordstream.cpp'.
	* Added an 'audio_peaks_test' harness in 'tests/audio_peaks_test.cpp'
	and 'tests/audio_peaks_test.h'.
	* Added 'PCM24' to the list of available formats in
	'rdadmin/edit_rdlibrary.cpp' and 'rdadmin/edit_rdlibrary.h'.
	* Added 'PCM24' to the list of available formats in
	'rdadmin/edit_decks.cpp'.
	* Added PCM24 support for file importation in
	'web/rdxport/import.cpp'.
	* Added an 'RDCae::Pcm24' value to the 'RDCae::AudioCoding
	enumeration in 'lib/rdcae.h'.
This commit is contained in:
Fred Gleason
2015-08-30 07:49:44 -04:00
parent e48a90a363
commit 8d70a79387
45 changed files with 1329 additions and 854 deletions

View File

@@ -196,6 +196,13 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;
case RDWaveFile::Pcm24:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_PCM24_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;
case RDWaveFile::MpegL1:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L1,
@@ -244,6 +251,10 @@ bool RDHPIPlayStream::formatSupported()
return formatSupported(RDWaveFile::Pcm16);
break;
case 24:
return formatSupported(RDWaveFile::Pcm24);
break;
default:
return false;
}
@@ -421,6 +432,11 @@ bool RDHPIPlayStream::play()
HPI_FORMAT_PCM16_SIGNED,
getSamplesPerSec(),0,0));
break;
case 24:
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM24_SIGNED,
getSamplesPerSec(),0,0));
break;
case 32:
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,

View File

@@ -2,9 +2,7 @@
//
// A class for recording Microsoft WAV files.
//
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
//
// $Id: rdhpirecordstream.cpp,v 1.7 2011/05/19 22:16:54 cvs Exp $
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -219,6 +217,13 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
break;
case RDWaveFile::Pcm24:
LogHpi(HPI_FormatCreate(&hformat,getChannels(),
HPI_FORMAT_PCM24_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
break;
case RDWaveFile::MpegL1:
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1,
getSamplesPerSec(),getHeadBitRate(),0));
@@ -264,6 +269,10 @@ bool RDHPIRecordStream::formatSupported()
return formatSupported(RDWaveFile::Pcm16);
break;
case 24:
return formatSupported(RDWaveFile::Pcm24);
break;
default:
return false;
}
@@ -399,98 +408,110 @@ bool RDHPIRecordStream::recordReady()
return false;
}
switch(getFormatTag()) {
case WAVE_FORMAT_PCM:
if(debug) {
printf("RDHPIRecordStream: using PCM%d format\n",
getBitsPerSample());
}
switch(getBitsPerSample()) {
case 8:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(),
0,0);
break;
case 16:
hpi_error=HPI_FormatCreate(&format,getChannels(),
case WAVE_FORMAT_PCM:
if(debug) {
printf("RDHPIRecordStream: using PCM%d format\n",
getBitsPerSample());
}
switch(getBitsPerSample()) {
case 8:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(),
0,0);
break;
case 16:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
0,0);
break;
case 24:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM24_SIGNED,getSamplesPerSec(),
0,0);
break;
case 32:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(),
0,0);
break;
default:
if(debug) {
printf("RDHPIRecordStream: unsupported sample size\n");
}
return false;
}
break;
case WAVE_FORMAT_MPEG:
if(debug) {
printf("RDHPIRecordStream: using MPEG-1 Layer %d\n",getHeadLayer());
}
switch(getHeadLayer()) {
case 1:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
case 2:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
case 3:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
default:
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
if(debug) {
printf("RDHPIRecordStream: invalid MPEG-1 layer\n");
}
return false;
}
if(getMextChunk()) {
setMextHomogenous(true);
setMextPaddingUsed(false);
setMextHackedBitRate(true);
setMextFreeFormat(false);
setMextFrameSize(144*getHeadBitRate()/getSamplesPerSec());
setMextAncillaryLength(5);
setMextLeftEnergyPresent(true);
if(getChannels()>1) {
setMextRightEnergyPresent(true);
}
else {
setMextRightEnergyPresent(false);
}
setMextPrivateDataPresent(false);
}
break;
case WAVE_FORMAT_VORBIS:
if(debug) {
printf("RDHPIRecordStream: using OggVorbis\n");
}
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
0,0);
break;
case 32:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(),
0,0);
break;
default:
if(debug) {
printf("RDHPIRecordStream: unsupported sample size\n");
}
return false;
}
break;
break;
case WAVE_FORMAT_MPEG:
if(debug) {
printf("RDHPIRecordStream: using MPEG-1 Layer %d\n",getHeadLayer());
}
switch(getHeadLayer()) {
case 1:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
case 2:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
case 3:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
break;
default:
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
if(debug) {
printf("RDHPIRecordStream: invalid MPEG-1 layer\n");
}
return false;
}
if(getMextChunk()) {
setMextHomogenous(true);
setMextPaddingUsed(false);
setMextHackedBitRate(true);
setMextFreeFormat(false);
setMextFrameSize(144*getHeadBitRate()/getSamplesPerSec());
setMextAncillaryLength(5);
setMextLeftEnergyPresent(true);
if(getChannels()>1) {
setMextRightEnergyPresent(true);
}
else {
setMextRightEnergyPresent(false);
}
setMextPrivateDataPresent(false);
}
break;
case WAVE_FORMAT_VORBIS:
if(debug) {
printf("RDHPIRecordStream: using OggVorbis\n");
}
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
0,0);
break;
default:
if(debug) {
printf("RDHPIRecordStream: invalid format tag\n");
}
return false;
break;
default:
if(debug) {
printf("RDHPIRecordStream: invalid format tag\n");
}
return false;
break;
}
if((hpi_error=HPI_InStreamQueryFormat(NULL,hpi_stream,
&format))!=0) {
&format))!=0) {
if(debug) {
HPI_GetErrorText(hpi_error,hpi_text);
printf("Num: %d\n",hpi_error);

View File

@@ -2,9 +2,7 @@
//
// A class for recording Microsoft WAV files.
//
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
//
// $Id: rdhpirecordstream.h,v 1.6.6.1 2012/05/04 14:56:22 cvs Exp $
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as