/*==========================================================================
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File:MStream.h
* Content:Main header file for the MSTREAM sample application
*
***************************************************************************/
#ifndef __MSTREAM_INCLUDED__
#define __MSTREAM_INCLUDED__
/*****************************************************************************/
/* Controls for buffer size, etc. */
#define TRACK_BUFFER_SIZE1024
#define OUT_BUFFER_SIZE 1024 // Max stream buffer size in bytes
#define BUFFER_TIME_LENGTH60 // Amount to fill in milliseconds
#define NUM_STREAM_BUFFERS 2
#define DEBUG_CALLBACK_TIMEOUT2000// Wait 2 seconds for callback
/*****************************************************************************/
/* A bunch of constants used for calculating position */
/* and size of child controls for the main window. */
#define BORDER_SPACE_CX10
#define BORDER_SPACE_CY10
#define CONTROL_SPACE_CX4
#define CONTROL_SPACE_CY4
#define TEXT_SPACE_CY3
#define TEXT_SPACE_CX2
#define BUTTON_CX68
#define BUTTON_CY26
#define CHECK_CX68
#define CHECK_CY26
#define BUTTON_SPACE_CX4
#define BUTTON_SPACE_CY4
#define CHECK_SPACE_CY4
#define TEMPO_TB_CX150
#define TEMPO_TB_CY 32
#define VOL_TB_CX150
#define VOL_TB_CY 32
#define TEMPO_TEXT_CXTEMPO_TB_CX
#define VOL_TEXT_CXVOL_TB_CX
#define VOL_TB_MIN0
#define VOL_TB_MAX1000
#define VOL_PAGESIZE10
#define VOL_MIN0
#define VOL_MAX127
#define VOL_CACHE_INIT100
#define TEMPO_MIN1
#define TEMPO_MAX500
#define TEMPO_PAGESIZE10
#define WM_MSTREAM_PROGRESS(WM_USER + 100)
#define WM_MSTREAM_UPDATEVOLUME(WM_USER + 101)
/*****************************************************************************/
/* All sorts of bit flags and error codes for */
/* communicating between various subsystems. */
#define MSTREAM_STOPF_NOREOPEN0x0001
#define STREAMF_BUFFER_WARNING0x00000002
#define CONVERTF_RESET0x00000001
#define CONVERTF_STATUS_DONE0x00000001
#define CONVERTF_STATUS_STUCK0x00000002
#define CONVERTF_STATUS_GOTEVENT0x00000004
#define CONVERTERR_NOERROR0// No error occured
#define CONVERTERR_CORRUPT-101// The input file is corrupt
// The converter has already encountered a corrupt file and cannot convert any
// more of this file -- you must reset the converter
#define CONVERTERR_STUCK-102
#define CONVERTERR_DONE-103// Converter is done
#define CONVERTERR_BUFFERFULL-104// The buffer is full
#define CONVERTERR_METASKIP-105// Skipping unknown meta event
#define STATUS_KILLCALLBACK100// Signals that the callback should die
#define STATUS_CALLBACKDEAD200// Signals callback is done processing
#define STATUS_WAITINGFOREND300 // Callback's waiting for buffers to play
#define VOLUME_BUFFER3567// Random value which acts as a buffer id
#ifdef DEBUG
#define DebugPrint( sz ) DPF( 3, sz )
#else
#define DebugPrint( sz )
#endif
/*
* This structure is used to pass information to the ConvertToBuffer()
* system and then internally by that function to send information about the
* target stream buffer and current state of the conversion process to lower
* level conversion routines internal to the MSTRCONV module. See that source
* file for specific details.
*/
typedef struct _ConvertInfo
{
MIDIHDRmhBuffer; // Standard Windows stream buffer header
DWORDdwStartOffset; // Start offset from mhStreamBuffer.lpStart
DWORDdwMaxLength; // Max length to convert on this pass
DWORDdwBytesRecorded; // Used internally by the MSTRCONV module
DWORDtkStart; // Used internally by the MSTRCONV module
BOOLbTimesUp; // Used internally by the MSTRCONV module
} CONVERTINFO, *LPCONVERTINFO;
/*****************************************************************************/
/* Function declarations */
LRESULT CALLBACK MainWindowProc( HWND, unsigned, WPARAM, LPARAM );
BOOL CALLBACK DLG_About( HWND, UINT, WPARAM, LPARAM );
void CALLBACK MidiProc( HMIDIIN, UINT, DWORD, DWORD, DWORD );
void BuildTitleBarText( void );
void ErrorMessageBox( UINT, DWORD );
void HandleTempoScroll( int, int );
void HandleVolScroll( int, int );
void MidiErrorMessageBox( MMRESULT );
void SetAllChannelVolumes( DWORD dwVolumePercent );
void SetChannelVolume( DWORD dwChannel, DWORD dwVolumePercent );
void UpdateFromControls( void );
int CreateChildren( RECT );
int HandleCommDlgError( DWORD );
BOOL StreamBufferSetup( void );
BOOL ConverterInit( LPSTR szInFile );
void ConverterCleanup( void );
intConvertToBuffer( DWORD, LPCONVERTINFO );
#endif /* __MSTREAM_INCLUDED__ */