Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

SDI (Sound Device Interface)--A library for Auditory Display

, 2 May 2004
A GDI-like API for 3D positioning of speech, and MIDI composition using a single string.
newseverywhere.zip
newseverywhere_release.zip
release_sdi.zip
Release
sdi32.lib
sdi32.dll
a3dapi.dll
ibmeci.dll
SDI1.0Document.doc
TestSDI.exe
sdi.zip
sdi32.lib
sdi32.dll
a3dapi.dll
ibmeci.dll
SDI1.0Document.doc
TestSDI.exe
sdi_demo.zip
SDI_Demo
resource.aps
sdi32.lib
sdi32.dll
a3dapi.dll
TestSDIdll.dsp
ibmeci.dll
TestSDIdll.dsw
TestSDIdll.exe
comeacross.mid
sdi_src.zip
sdi32.lib
sdi32.dll
a3dapi.dll
ibmeci.dll
SDI1.0Document.doc
TestSDI.exe
src_sdi.zip
Source
sdi32
sdi32.dsw
exports.def
sdi32.dsp
DS_Buffer.gif
lib
ibmeci.lib
a3dapi.lib
ia3dutil.lib
ia3dutild.lib
ThirdParty
Document
DS_Buffer.gif
SDI1.0Document.doc
technote.doc
GNU General Public License.mht
General MIDI.mht
MIDI Specification.mht
MIDI File Format.mht
Downloadable Sounds (Level 1) Specification.pdf
Sample
NewsEverywhere_SourceCode
NewsEverywhereMFC
NewsEverywhereMFC.dsp
NewsEverywhereMFC.dsw
ParserDLLZXW
ParserDLLZXW.dsp
ParserDLLZXW.dsw
ParserDLLZXW.def
Parser
ParserDLLZXW.dll
res
NewsEverywhereMFC.ico
ico00002.ico
icon1.ico
title_ro.ico
buttonK1.ico
ico00001.ico
HTML.ico
Browser.ico
ico00003.ico
ico00004.ico
A3D_logo.bmp
Cursor
3dwarro.cur
move_r.cur
SDI_Demo
TestSDIdll.dsp
TestSDIdll.dsw
comeacross.mid
/******************************************************************************
SDI 1.0
    A library for Auditory Display
Copyright 2004 Dong Lin

This file is part of SDI.

    SDI is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    SDI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with SDI; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Last Updated : Apr.15th, 2004

For any question, suggestion or failure report, please contact me by:
e-mail: jonathan1983@126.com
*******************************************************************************/
/******************************************************************

File Name: Earcon.h

Description:
	Earcon Object

Note:

********************************************************************/

#if !defined(EARCON_H_51CA635A_695B_47CB_A0B5_DBFCFEB699F8_INCLUDED)
#define EARCON_H_51CA635A_695B_47CB_A0B5_DBFCFEB699F8_INCLUDED

//////////////////////////////////////////////////////////////
// Included Headers
////////////////////////
#include "SDIKernel.h"

//////////////////////////////////////////////////////////////
// Constants
////////////////////////
// Parameters for earcon object
#define SDI_EARCON_AUDIOCHANNELS		(1)
#define SDI_EARCON_SAMPLERATE			(22050)
#define SDI_EARCON_BITDEPTH				(16)

/************** Obsolete*****************************
      See readme.txt for tech notes.
****************************************************/
#define SDI_EARCON_NUM_DSBSECTION		(15)
#define SDI_EARCON_SECTIONSIZE			(3000)	
#define SDI_EARCON_DSBUFFERSIZE			(SDI_EARCON_NUM_DSBSECTION*SDI_EARCON_SECTIONSIZE)
#define SDI_EARCON_NUM_SRCSECTION		(4)
#define SDI_EARCON_SOURCEBUFFERSIZE		(SDI_EARCON_NUM_SRCSECTION*SDI_EARCON_SECTIONSIZE)	// 4500*4
#define SDI_EARCON_DMBUFFERSIZE			(100*1024)
/***************************************************/

#define SDI_EARCON_MAXEARCON			(64)	// Maxium number of earcon objects

#define MICROSEC_TO_100NANOSEC			(10)
#define REFTIME_PER_SEC					(10000000)
#define SDI_EARCON_NUM_CHANNEL			(16)

#define HIGHNOTE						(119)
#define LOWNOTE							(24)

// Message
#define MSG_EARCON_QUIT				0x0001
#define MSG_EARCON_PLAY				0x0002
#define MSG_EARCON_STOP				0x0003
#define MSG_EARCON_PAUSE			0x0004

// Refer to MIDI Specification for the following codes
// MIDI Message Code
#define NOTE_OFF			0x80
#define NOTE_ON				0x90
#define AFTER_TOUCH			0xA0
#define CONTROL_CHANGE		0xB0
#define PROGRAM_CHANGE		0xC0
#define CHANNEL_PRESSURE	0xD0
#define PITCH_WHEEL			0xE0
#define SYSTEM_EXCLUSIVE	0xF0
#define MTC_QUARTER_FRAME	0xF1
#define SONG_POSITION		0xF2
#define SONG_SELECT			0xF3
#define TUNE_REQUEST		0xF6
#define MIDI_CLOCK			0xF8
#define MIDI_START			0xFA
#define MIDI_CONTINUE		0xFB
#define MIDI_STOP			0xFC
#define ACTIVE_SENSE		0xFE

// MIDI File Format 
// Meta-Event Type
#define NONMIDI				0xFF	// Replace the RESET MIDI message
#define END_OF_TRACK		0x2F

// Controller Number
#define BANK_SELECT			0x00


// Status Mask
#define STATUS_EARCON_PLAYING		0x0001

//////////////////////////////////////////////////////////////
// Macros (Inline Functions)
////////////////////////

							


//////////////////////////////////////////////////////////////
// Structures
////////////////////////
struct SDIEARCONLIST{
	COMMONDATA data;

	DWORD		timeSignature;
	WORD		keySignature;	
	FLOAT		BPM;	

	DWORD		dwTempo;		// Microseconds Per Beat
	WORD		nTicksPerQN;	// Delta-ticks Per Beat
	WORD		nChannelGroup;
	
	IDirectMusicCollection8* pCollection;	// Custom Instruments Collection
	IDirectMusicDownloadedInstrument8* pDownloadedInstruments[SDI_EARCON_NUM_CHANNEL];
	
	// Track
	struct TRACK{
		BYTE* pbData;
		DWORD dwLength;
		BYTE* pbCursor;
		DWORD dwInterval;
		BYTE  byPrevStatus;
	} track[SDI_EARCON_NUM_CHANNEL];
	BYTE nTracks;
	BYTE nCurTrack;

	// Sound Display
	IDirectSoundBuffer8*	pSoundBuffer;
	IDirectSound3DBuffer8*	p3DBuffer;
	IDirectMusicBuffer8*	pMusicBuffer;
	IDirectMusicPort8*		pPort;
	IReferenceClock*		pClock;
	
	HANDLE					hDSBSync;
	BYTE					nDsbSec;
	BYTE					nSrcSec;
};

//////////////////////////////////////////////////////////////
// Function Prototypes
// [Non-exported]
////////////////////////

// Make 32-bit MIDI message
DWORD MakeVoiceMsg(BYTE byStatus, BYTE byChannel, BYTE byData1, BYTE byData2);

// Read MIDI message from file data pointer
DWORD ReadMsg(BYTE** ppData);

// Read and write variable-length number. 
// Refer to "Standard MIDI-file Format Spec" for info on Variable length number.
DWORD ReadVarLen(BYTE** ppData);
BOOL  WriteVarLen(BYTE** ppData, LONGLONG data_64);

// Read and write fixed-length number.
// cb: the number of bytes
DWORD ReadFixLen(BYTE** ppData, BYTE cb);
BOOL WriteFixLen(BYTE** ppData, DWORD data_64, BYTE cb);

BOOL  ResetEarcon(SDIEARCONLIST* pEarcon);
BOOL  RewindEarcon(SDIEARCONLIST* pEarcon);
BOOL	PlayNonstop(HEARCON hEarcon, BYTE* pMusicData);

#endif //!defined(EARCON_H_51CA635A_695B_47CB_A0B5_DBFCFEB699F8_INCLUDED)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dong Lin
Engineer
China China
A student at Zhejiang University, Zhejiang, China.
Major in Automation.
Now I want to study machine vision and robotics, but I'm really consumed with choices between hardware and software, and between research and engineering.
I'll be glad if you can give some suggestions.

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 3 May 2004
Article Copyright 2004 by Dong Lin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid