initial checkin

This commit is contained in:
chudov
2008-10-13 19:25:11 +00:00
parent 2e379c72e2
commit 36757fca7a
937 changed files with 184964 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
/***************************************************************************************
Analyze - Sample 1
Copyright (C) 2000-2001 by Matthew T. Ashland All Rights Reserved.
Feel free to use this code in any way that you like.
This example opens an APE file and displays some basic information about it. To use it,
just type Sample 1.exe followed by a file name and it'll display information about that
file.
Notes for use in a new project:
-you need to include "MACLib.lib" in the included libraries list
-life will be easier if you set the [MAC SDK]\\Shared directory as an include
directory and an additional library input path in the project settings
-set the runtime library to "Mutlithreaded"
WARNING:
-This class driven system for using Monkey's Audio is still in development, so
I can't make any guarantees that the classes and libraries won't change before
everything gets finalized. Use them at your own risk.
***************************************************************************************/
// includes
#include "all.h"
#include "stdio.h"
#include "maclib.h"
#include "apetag.h"
int main(int argc, char* argv[])
{
///////////////////////////////////////////////////////////////////////////////
// error check the command line parameters
///////////////////////////////////////////////////////////////////////////////
if (argc != 2)
{
printf("~~~Improper Usage~~~\r\n\r\n");
printf("Usage Example: Sample 1.exe 'c:\\1.ape'\r\n\r\n");
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// variable declares
///////////////////////////////////////////////////////////////////////////////
int nRetVal = 0; // generic holder for return values
char cTempBuffer[256]; ZeroMemory(&cTempBuffer[0], 256); // generic buffer for string stuff
char * pFilename = argv[1]; // the file to open
IAPEDecompress * pAPEDecompress = NULL; // APE interface
///////////////////////////////////////////////////////////////////////////////
// open the file and error check
///////////////////////////////////////////////////////////////////////////////
pAPEDecompress = CreateIAPEDecompress(pFilename, &nRetVal);
if (pAPEDecompress == NULL)
{
printf("Error opening APE file. (error code %d)\r\n\r\n", nRetVal);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// display some information about the file
///////////////////////////////////////////////////////////////////////////////
printf("Displaying information about '%s':\r\n\r\n", pFilename);
// file format information
printf("File Format:\r\n");
printf("\tVersion: %.2f\r\n", float(pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)) / float(1000));
switch (pAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL))
{
case COMPRESSION_LEVEL_FAST: printf("\tCompression level: Fast\r\n\r\n"); break;
case COMPRESSION_LEVEL_NORMAL: printf("\tCompression level: Normal\r\n\r\n"); break;
case COMPRESSION_LEVEL_HIGH: printf("\tCompression level: High\r\n\r\n"); break;
case COMPRESSION_LEVEL_EXTRA_HIGH: printf("\tCompression level: Extra High\r\n\r\n"); break;
}
// audio format information
printf("Audio Format:\r\n");
printf("\tSamples per second: %d\r\n", pAPEDecompress->GetInfo(APE_INFO_SAMPLE_RATE));
printf("\tBits per sample: %d\r\n", pAPEDecompress->GetInfo(APE_INFO_BITS_PER_SAMPLE));
printf("\tNumber of channels: %d\r\n", pAPEDecompress->GetInfo(APE_INFO_CHANNELS));
printf("\tPeak level: %d\r\n\r\n", pAPEDecompress->GetInfo(APE_INFO_PEAK_LEVEL));
// size and duration information
printf("Size and Duration:\r\n");
printf("\tLength of file (s): %d\r\n", pAPEDecompress->GetInfo(APE_INFO_LENGTH_MS) / 1000);
printf("\tFile Size (kb): %d\r\n\r\n", pAPEDecompress->GetInfo(APE_INFO_APE_TOTAL_BYTES) / 1024);
// tag information
printf("Tag Information:\r\n");
CAPETag * pAPETag = (CAPETag *) pAPEDecompress->GetInfo(APE_INFO_TAG);
BOOL bHasID3Tag = pAPETag->GetHasID3Tag();
BOOL bHasAPETag = pAPETag->GetHasAPETag();
if (bHasID3Tag || bHasAPETag)
{
// iterate through all the tag fields
BOOL bFirst = TRUE;
CAPETagField * pTagField;
while (pAPETag->GetNextTagField(bFirst, &pTagField))
{
bFirst = FALSE;
// output the tag field properties (don't output huge fields like images, etc.)
if (pTagField->GetFieldValueSize() > 128)
{
printf("\t%s: --- too much data to display ---\r\n", pTagField->GetFieldName());
}
else
{
printf("\t%s: %s\r\n", pTagField->GetFieldName(), pTagField->GetFieldValue());
}
}
}
else
{
printf("\tNot tagged\r\n\r\n");
}
///////////////////////////////////////////////////////////////////////////////
// cleanup (just delete the object
///////////////////////////////////////////////////////////////////////////////
delete pAPEDecompress;
///////////////////////////////////////////////////////////////////////////////
// quit
///////////////////////////////////////////////////////////////////////////////
return 0;
}

View File

@@ -0,0 +1,102 @@
# Microsoft Developer Studio Project File - Name="Sample 1" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Sample 1 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Sample 1.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Sample 1.mak" CFG="Sample 1 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Sample 1 - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Sample 1 - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Sample 1 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\Shared" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib maclib.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Shared"
!ELSEIF "$(CFG)" == "Sample 1 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\Shared" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib maclib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Shared"
!ENDIF
# Begin Target
# Name "Sample 1 - Win32 Release"
# Name "Sample 1 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=".\Sample 1.cpp"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\Shared\APEInfo.h
# End Source File
# End Group
# End Target
# End Project