Apple Newton Utilities Guia do Utilizador Página 517

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 942
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 516
CHAPTER 12
Special-Purpose Objects for Data Storage and Retrieval
Using Special-Purpose Data Storage Objects 12-11
The following code fragment adds sound sample data to an empty VBO and
demonstrates the use of the
EntryUndoChanges function to undo those changes:
// create a temporary soup
mySoup := RegUnionSoup('|foo:myApp:mySig|,
{name: "foo:myApp:mySig", indexes: '[]}) ;
// get a soup entry that is a sound
anEntry := mySoup:AddToDefaultStoreXmit('{sndFrameType: nil,
samples:nil,
samplingRate:nil,
dataType:nil,
compressionType: nil,
userName: nil}, nil) ;
// make a VBO to use for the samples
myVBO := GetDefaultStore():NewCompressedVBO('samples,5000,nil, nil);
// grab some samples from ROM and fill in most of sound frame
romSound := Clone(ROM_FunBeep) ;
anEntry.sndFrameType := romSound.sndFrameType ;
anEntry.samplingRate := romSound.samplingRate ;
anEntry.dataType := romSound.dataType ;
anEntry.compressionType := romSound.compressionType ;
anEntry.samples := myVBO ;
// put the samples in the VBO
BinaryMunger(myVBO, 0, nil, romSound.samples, 0, nil) ;
// write the VBO to the soup
try
EntryChangeXmit(anEntry, nil);
onException |evt.ex.fr.store| do
:Notify(kNotifyAlert, "My App", "Sorry, can’t save changes.");
// listen to the sound to verify change
PlaySound(anEntry);
// change the sound
BinaryMunger(anEntry.samples,0, nil, ROM_PlinkBeep.samples, 0, nil);
PlaySound(anEntry) ;
Vista de página 516
1 2 ... 512 513 514 515 516 517 518 519 520 521 522 ... 941 942

Comentários a estes Manuais

Sem comentários