struct not_padded { int8 c; int32 l; }; // fails assert_anywhere( sizeof (not_padded) == 5 ); struct padded { int8 c; int8 pad [3]; int32 l; }; // passes assert_anywhere( sizeof (padded) == 8 );
for ( int i = Count1Types() + 1; --i; ) { UInt32 type; Get1IndType( &type, i ); for ( int i = Count1Resources( type ) + 1; --i; ++num_resources ) { // get resource and info Handle h = Get1IndResource( type, i ); short id; Str255 str; GetResInfo( h, &id, &type, str ); // add toc entry resfile_flat_item entry; entry.type = type; entry.id = id; entry.size = GetHandleSize( h ); entry.data_offset = GetHandleSize( data_h ); PtrAndHand( &entry, toc_h, sizeof entry ); // add resource data HandAndHand( h, data_h ); ReleaseResource( h ); } } // write data to file long toc_size = GetHandleSize( toc_h ); uint32 data_offset = 6 + toc_size; fwrite_chk( &data_offset, 4, file ); fwrite_chk( &num_resources, 2, file ); fwrite_chk( *toc_h, toc_size, file ); fwrite_chk( *data_h, GetHandleSize( data_h ), file );
class MIDIOutObject { public: MIDIOutObject(); virtual ~MIDIOutObject(); virtual void InitMIDIOutput(); virtual void SetupMIDIPorts(); virtual void SetupMIDIChannel(short channelNum, short patchNum); virtual void ShutdownMIDIOutput(); virtual OSErr OutputMIDIPacket(MIDIPacketPtr packet); };
// Partial data handler declaration class MIPlayer { public: MIPlayer(OSType id, MIMusicServer* server, MITrack* track = nil); virtual ~MIPlayer(); ... // For Windows 95 version. Called during BeginSession() to perform needed // byte-swappping on the individual player's data virtual void FormatData() {}; ... // Setup called once for each new sequence virtual void BeginSession() {if (dataTrack) {FormatData(); playIterator = dataTrack->Iterator();}}; };